SELECT g.`id`, g.`name`, g.`fullname`, g.`slug`, p.`price`, g.`at_stock`, g.`on_hand`, g.`min_sale`, g.`mainPhotoID`, i.`path` AS imagePath, s.`name` AS supName, s.`abbr` AS supAbbr
FROM `goods` g
LEFT JOIN `prices` AS p ON (p.`good_id`=g.`id` AND p.`type`=g.`price_type`)
LEFT JOIN `category` AS c ON c.`id`=g.`category_id`
LEFT JOIN `brands` AS b ON b.`id`=g.`brand_id`
LEFT JOIN `suppliers` AS s ON s.`id`=g.`supplier_id`
LEFT JOIN `images2` AS i ON (i.`id`=g.`mainPhotoID` AND i.`hide`='no')
LEFT JOIN a_prod_catalog_goods as pg ON pg.good_id=g.id
LEFT JOIN `a_prod_filter_good_vs` AS gp ON (g.id = gp.good_id)
WHERE pg.`category_id` IN (7004,7004,70056,70057,70058,70059,70060,70061,70062,70063,70064,70065,70066,70067,70068,70069,70070,70071,70072,70073,70074,70075,70076,70077,70078,70079,70309,70505,70507,700011,700012,700013,700014,700015,700016,700017,700018,700019,700140,700141,700142,700143,700144,700145,700146,700147,700148,700398,700595,700596,700628,700700,702141,702142,702143,702144,702145,702146,702147,702148,702149,702150,702151,702152,702153,702154,702155,702156,702157,702158,702159,702160,702161,702162,702163,702164,702165,702166,702167,702168,702169,702170,702171,702172,702173,702174,702175,702176,702177,702178,702179,702180,702181,702182,702183,702184,702185,702186,702187,702188,702189,702190,702191,702192,702193,702194,702195,702196,702197,702198,702199,702200,702233,702234,702257,702314,702315,702317,702411,702482,702511)
AND p.`price`!=0
GROUP BY g.id
ORDER BY IF(g.`at_stock`='yes','0',IF(g.`at_stock`='order','1',IF(g.`on_hand`>0,'0','2'))), g.`fullname` LIMIT 94100,100; |
|