FoxComm / highlander

Because there can only be one
MIT License
9 stars 3 forks source link

Promotions form. Only active products should appear in the products_search_view for single item specific offers. #2162

Open alexanderfc opened 7 years ago

alexanderfc commented 7 years ago

Preconditions:

  1. Active product with active SKU.

Steps:

  1. Archive the product from preconditions.
  2. Open /promotions/new
  3. Set offer to Percent off single item
  4. Look for a just archived product there.

Actual result: product is there and can be selected. Expected result: product isn't displayed in the list of products.

Video: https://www.dropbox.com/s/em1jxos78dfek5j/highlander_2162.mp4?dl=0

alexanderfc commented 7 years ago

My guess is that products_search_view is queried with a payload that doesn't filter out archived products.

Payload currently used for querying products_search_view:

{
  "query": {
    "bool": {
      "should": [],
      "minimum_number_should_match": 1
    }
  }
}

Payload used at /admin/products for querying products in All tab:

{
  "query": {
    "bool": {
      "filter": [{
        "missing": {
          "field": "archivedAt"
        }
      }]
    }
  }
}
bagratinho commented 7 years ago

https://github.com/FoxComm/highlander/pull/2203

Your right @alexanderfc