Color Filter for products

I did code for color filter and wrote this query, which are working fine

select distinct(p.products_id), p.products_image, pd.products_name,
 pd.products_description, p.manufacturers_id, p.products_price, 
p.products_date_available, p.products_tax_class_id, IF(s.status, 
s.specials_new_products_price, NULL) as specials_new_products_price,
 IF(s.status, s.specials_new_products_price, p.products_price) as 
final_price from products_description pd, products p left join 
manufacturers m on p.manufacturers_id = m.manufacturers_id left join 
specials s on p.products_id = s.products_id, products_to_categories p2c, 
colors_info ci, products_to_colors ptoc where p.products_status = '1' and 
p.products_id = p2c.products_id and pd.products_id = p2c.products_id and 
pd.language_id = '1' and p2c.categories_id = '22' and p.products_id = 
ptoc.products_id and ci.colors_id = ptoc.colors_id and ( ci.colors_id = 
'8' or ci.colors_id = '1' or ci.colors_id = '2' ) and ci.languages_id = 
'1' group by p.products_id order by pd.products_name

But my client wrote me, he need like if user select red(which having 4 products) show 4 products, if user also select blue(which having 2 produc)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s