Hi,
I've a "weird" issue with a select option and a query.
This is the use case.
I've three products:
- Product A, category path Bag, category id 1, categories ids for filter 1, 2,3
- Product B, category path Bag/Backpack, category id 2, categories ids for filter 2
- Product C, category path Bag/Belt Bags, category id 3, categories ids for filter 3
I'm filtering the products through a select option.
What I need to do is that if you select Bag, the query returns also the products having a subcategory of Bag.
For this, I've added the "categories ids for filter" in order to have all the ids to be used in the query condition.
CASE
WHEN {{select_Subcategory.selectedItems.length > 0 }} THEN p.category_id IN ( {{select_Subcategory.selectedItems.length > 0 ? select_Subcategory.value : 'NULL'}})
WHEN {{select_Subcategory.selectedItems.length == 0 }} THEN TRUE
END
The generated query seems ok, so it prints all the IDS in the IN condition, but the it returns only the first product.
The same query executed with an sql client returns all the three products.
Is there anything that I'm missing?