diff --git a/modules/braderie/ajax.php b/modules/braderie/ajax.php index 41fbeb20..339ad38a 100644 --- a/modules/braderie/ajax.php +++ b/modules/braderie/ajax.php @@ -71,19 +71,21 @@ function getProductId() if (empty($result)) { $result = Db::getInstance()->getRow(' - SELECT pa.*, pl.`name`, p.`reference` as product_reference, al.`name` as attribute_name, i.`id_image` + SELECT pa.*, pl.`name`, p.`reference` as product_reference, al.`name` as attribute_name, ia.`id_image` as id_image_attribute, i.`id_image` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`) LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`) LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`) LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.`id_attribute` = pac.`id_attribute`) - LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` i ON (i.`id_product_attribute` = pa.`id_product_attribute`) + LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ia ON (ia.`id_product_attribute` = pa.`id_product_attribute`) + LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) WHERE pa.`ean13` = '.pSQL($ean).' AND pl.`id_lang` = '.(int)$cookie->id_lang.' ORDER BY pa.`id_product_attribute` DESC -- ORDER BY pa.`id_product_attribute` ASC' ); $result['reference'] = (!empty($result['reference'])) ? $result['reference'] : $result['product_reference']; + $result['id_image'] = (!empty($result['id_image_attribute'])) ? $result['id_image_attribute'] : $result['id_image']; } /*$category_name = Db::getInstance()->getRow('