Покупали подарок другу. Ассортимент большой, Денис отлично помог с выбором. Огромное спасибо! Уверена что подарок порадует не только нашего друга, но и всю компанию
SELECT DISTINCT p.products_id, p.products_quantity, p.products_image, pd.products_name, pd.products_description, pd.products_short, pd.description_opt, if((p.products_date_added between date_sub(NOW(), interval 3 month) and NOW()),1,0) as new_product, p.manufacturers_id, p.products_price, pd.popular, pd.discount, pd.plan, pd.product_day, pd.video_link, pd.products_country_id, pd.products_brands_id, pd.material_id, pd.glass_thickness_id, pd.ice_id, pd.kick_hole_id, pd.length_id, pd.percolator_id, pd.heating_type_id, pd.created_id, pd.replaceable_battery_id, pd.heating_chamber_material_id, pd.automatic_shutdown_id, pd.charger_id, pd.diameter_id, pd.parts_id, pd.spatula_id, pd.height, p.products_tax_class_id, p.price_client, p.price_client as specials_new_products_price, p.price_client_shop as final_price, p.price_opt, p.price_opt_spec, p.price_client_shop_product_day, p.price_client_product_day, p.qty_serp, p.qty_ramenki, p.qty_kuzminki, p.qty_store, p.reserved_store, p.qty_garage, IF(pd.popular='popular' OR pd.discount='discount',1,0) as galki, cd1.categories_id as grandma_id, cd2.categories_id as grandpa_id, cd3.categories_id as granny_id, pd.products_url from products p INNER JOIN products_description pd ON pd.products_id = p.products_id and pd.language_id = '4'
INNER JOIN products_to_categories p2c ON p2c.products_id = p.products_id
INNER JOIN categories tc ON tc.categories_id=p2c.categories_id
INNER JOIN categories_description cd ON cd.categories_id=p2c.categories_id
LEFT JOIN categories tc1 ON tc1.categories_id=tc.parent_id LEFT JOIN categories_description cd1 ON cd1.categories_id=tc.parent_id LEFT JOIN categories tc2 ON tc2.categories_id=tc1.parent_id LEFT JOIN categories_description cd2 ON cd2.categories_id=tc1.parent_id LEFT JOIN categories tc3 ON tc3.categories_id=tc2.parent_id LEFT JOIN categories_description cd3 ON cd3.categories_id=tc2.parent_id
WHERE p.products_status = '1' AND tc.published = '1' AND (p.products_quantity>0 OR p.qty_ramenki>0 OR p.qty_krylo>0 OR p.qty_novokuzneckaya>0 OR p.qty_serp>0 OR p.qty_kuzminki>0) AND pd.plan='plan' group by p.products_id ORDER BY plan DESC, popular DESC, p2c.categories_id ASC
Покупали подарок другу. Ассортимент большой, Денис отлично помог с выбором. Огромное спасибо! Уверена что подарок порадует не только нашего друга, но и всю компанию