php - Incorrect rows returned by webshop filter -


I have a table of products with field id, name, URL, brand, then I have a field called product_filter Field ID, PRODUCT_ID, TYPE, VALUE

Assume that I have a table of the following products

1 | Product 1 | Product-1 Brand 1
2 | Product 2 | Product -2 Brand 2
3 | Product 3 | Product -3 Brand 1

and product_filter table

1 | 1 | Content | Wool | 2 | 1 | Content | Cotton
3 | 2 | Content | Cotton | 4 | 3 | Content | Wool 5 1 | Weather | Decline | 5 | 2 | Weather | Decline | 5 | 1 | Weather |

Content: wool, cotton season: fall

P> My result is 1 product (content and The right season is both) and the product is 2 (1 material and right season).

I tried to join the

  DISTINCT (shop_product.product_number), `shop_product`.`color_count`,` shop_product`.`category_id` , `Shop_product`.in_stock`,` shop_product`.`url_image`, `shop_product_description`. * From ( `shop_product`) Join combination based on shop_product`.`id` =` `shop_product_description`.`product_id` shop_category_description` on` `shop_product_description`` shop_product`.`category_id` = `shop_category_description`.`category_id` insider `Join Pr` shop_filters` shop_product`.`id` =` shop_filters`.`product_id` Jhan` shop_product`.`status` = 1 and `shop_product_description`.`language_id` = '1' and` shop_category_description`.` language_id` = '1' and ((Shop_filters.type = '1' and shop_filte rs.keyword = 'cotton') or (shop_filters.type = '1' and shop_filters.keyword = 'wool')) and (shop_filters.type = '2' and shop_filters.keyword = 'degradation') Order by shop_product` `Url_image` asc,` shop_product_description` .`name` name LIMIT 36  

I used separate to get 1 oyour product back (the product is due to be both the content).

But by the time I change

  ((shop_filters.type = '1' and shop_filters.keyword = 'cotton'), I have no results Or (shop_filters.type = '1' and shop_filters keyword = 'wool')) and (shop_filters.type = '2' and shop_filters.keyword = 'fall')  

to

  ((shop_filters. type = '1' and shop_filters.keyword = 'cotton') or (shop_filters.type = '1' and shop_filters.keyword = 'wool')) or (shop_filters.type = '2' and shop_filters.keyword = 'degradation')  

Although my results are products of cotton or wool or fall, if there is any suggestion, please consider ... < / P>

You must match the filter several times against the table, the easiest to check against each filter.