SELECT DISTINCT t.id,
t.name_bg,
t.title_bg,
t.price_bg,
t.price,
t.old_price,
t.pic,
t.pic2,
t.url,
GROUP_CONCAT(DISTINCT cc.product_id ORDER BY cc.product_id SEPARATOR ',') AS colors_ids,
GROUP_CONCAT(DISTINCT pp.pic ORDER BY pp.id SEPARATOR ',') AS colors_pics,
GROUP_CONCAT(DISTINCT pp.url ORDER BY pp.id SEPARATOR ',') AS colors_urls,
GROUP_CONCAT(DISTINCT pp.name_bg ORDER BY pp.id SEPARATOR ',') AS colors_names,
q.id as ima_razmeri
FROM products t
LEFT JOIN products_groups u ON (t.id = u.product_id)
LEFT JOIN pros_groups v ON (u.product_id = v.product_id AND u.group_id = v.group_id)
LEFT JOIN products_colors c on (c.product_id = t.id)
LEFT JOIN products_colors cc on (cc.code = c.code)
LEFT JOIN products pp on (cc.product_id = pp.id)
LEFT JOIN products q on (t.id = q.parent)
WHERE t.flag = '1' AND
t.status = '1' AND
IFNULL(u.group_id, '') LIKE ? AND
IFNULL(t.brand_id, '') LIKE ? AND
t.parent = 0
AND t.id IN (0,1145,335,337,356,357)
GROUP BY t.id
ORDER BY FIELD(t.id, 0,1145,335,337,356,357)