I have a category with products and a set of attributes. Those attributes are "Shape" and "Diameter".
When I open a category without applying filters I get products with following query:
"SELECT * FROM `products`
WHERE `category_id`
IN ('6', '7', '29', '8', '9', '36')"
Then I click on attribute "Diameter"(id = 2) with value "8mm"(id = 4) I generate the following query:
"SELECT * FROM `products`
JOIN `products_attributes_values`
ON (`products_attributes_values`.`product_id` = `products`.`id`)
WHERE `category_id` IN ('6', '7', '29', '8', '9', '36')
AND `products_attributes_values`.`attribute_id` = 2
AND `products_attributes_values`.`value_id` = ('4')"
And I get what I need, all beads with "Diameter 8mm" Then I want to filter my products more and click on attribute "Shape"(id = 3) with value "Round"(id = 11) And I get nothing, the query is look like:
"SELECT * FROM `products`
JOIN `products_attributes_values`
ON (`products_attributes_values`.`product_id` = `products`.`id`)
WHERE `category_id` IN ('6', '7', '29', '8', '9', '36')
AND `products_attributes_values`.`attribute_id` = 2
AND `products_attributes_values`.`value_id` = ('4')
AND `products_attributes_values`.`attribute_id` = 3
AND `products_attributes_values`.`value_id` = ('11')"
so instead of nothing I want to get beads with diameter of 8mm and round shape. Separately all filters works fine. It just not working when I want to mix them like in example above. How I need to modify the query to get the job done?
Thanks.
Update:
I want to combine multiple values on one attributes with one or more of another.
For instance I want to get Beads with Diameter(id=2) of 8mm(id=4) or Diameter(id=2) 10mm(id=5) and Shape(id=3) of Round(id=11) or Shape(id=3) Faceted(id=62)
So at end I want to get both 8mm or 10mm beads with round or faceted shape.