SELECT p.id_product, pl.name as product_name, pa.reference as product_reference, p.ean13 AS product_barcode, GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ",") as attribute, pa.ean13 AS attribute_barcode, pa.reference AS attribute_reference, ROUND(((p.price * 1.24) - coalesce(rd.reduction,0)),2) AS product_price, ROUND(p.wholesale_price,2) as product_wholesale, manu.name as product_manufacturer, cl.name
FROM mm_product p
LEFT JOIN mm_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN mm_category_product cp ON (p.id_product = cp.id_product)
LEFT JOIN mm_category_lang cl ON (cp.id_category = cl.id_category)
LEFT JOIN mm_category c ON (cp.id_category = c.id_category)
LEFT JOIN mm_product_tag pt ON (p.id_product = pt.id_product)
LEFT JOIN mm_product_attribute pa ON (p.id_product = pa.id_product)
LEFT JOIN mm_product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute)
LEFT JOIN mm_attribute_lang al ON (al.id_attribute = pac.id_attribute)
LEFT JOIN mm_attribute_lang pal ON (pac.id_attribute = pal.id_attribute)
LEFT JOIN mm_manufacturer manu ON (p.id_manufacturer = manu.id_manufacturer)
LEFT JOIN mm_specific_price rd ON (p.id_product = rd.id_product)
WHERE pl.id_lang = 2
AND cl.id_lang = 2
AND p.id_shop_default = 1
AND c.id_shop_default = 1
GROUP BY pac.id_product_attribute