getRow('
SELECT `id_product`
FROM `'._DB_PREFIX_.'product`
WHERE `ean13` = "'.pSQL(Tools::getValue('ean')).'
')) {
$product = new Product((int) $row['id_product'], FALSE, 2);
foreach(Db::getInstance()->ExecuteS('
SELECT pa.`id_product_attribute`, pa.`id_product`, pa.`quantity`, ag.`public_name` as `group`, al.`name`, pa.`ean13`, pa.`reference`
FROM `'._DB_PREFIX_.'product_attribute` pa, `'._DB_PREFIX_.'product_attribute_combination` ac, `'._DB_PREFIX_.'attribute` a, `'._DB_PREFIX_.'attribute_lang` al, `'._DB_PREFIX_.'attribute_group_lang` ag
WHERE pa.`id_product` = '.(int) $product->id.'
AND ac.`id_product_attribute` = pa.`id_product_attribute`
AND al.`id_attribute` = ac.`id_attribute`
AND al.`id_lang` = 2
AND a.`id_attribute` = al.`id_attribute`
AND ag.`id_attribute_group` = a.`id_attribute_group`
AND ag.`id_lang` = 2
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
') as $attr) {
if(!isset($attributes[$attr['id_product_attribute']])) {
$attributes[$attr['id_product_attribute']] = array();
}
$attributes[$attr['id_product_attribute']]['name'] .= '
'.$attr['group'].' : '.$attr['name'];
$attributes[$attr['id_product_attribute']]['id_product_attribute'] = $attr['id_product_attribute'];
$attributes[$attr['id_product_attribute']]['ean13'] = $attr['ean13'];
$attributes[$attr['id_product_attribute']]['reference'] = $attr['reference'];
}
$cover = Product::getCover($product->id);
} else {
if($row = Db::getInstance()->getRow('
SELECT `id_product`, `id_product_attribute`
FROM `'._DB_PREFIX_.'product_attribute`
WHERE `ean13` = "'.pSQL(Tools::getValue('ean')).'"
')) {
$product = new Product((int) $row['id_product'], FALSE, 2);
$attr = Db::getInstance()->getRow('
SELECT pa.`id_product_attribute`, pa.`id_product`, pa.`quantity`, ag.`public_name` as `group`, al.`name`, pa.`ean13`, pa.`reference`
FROM `'._DB_PREFIX_.'product_attribute` pa, `'._DB_PREFIX_.'product_attribute_combination` ac, `'._DB_PREFIX_.'attribute` a, `'._DB_PREFIX_.'attribute_lang` al, `'._DB_PREFIX_.'attribute_group_lang` ag
WHERE pa.`id_product` = '.(int) $product->id.'
AND ac.`id_product_attribute` = pa.`id_product_attribute`
AND pa.`id_product_attribute` = '.(int) $row['id_product_attribute'].'
AND al.`id_attribute` = ac.`id_attribute`
AND al.`id_lang` = 2
AND a.`id_attribute` = al.`id_attribute`
AND ag.`id_attribute_group` = a.`id_attribute_group`
AND ag.`id_lang` = 2
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
');
$attributes[$attr['id_product_attribute']] = array();
$attributes[$attr['id_product_attribute']]['name'] .= '
'.$attr['group'].' : '.$attr['name'];
$attributes[$attr['id_product_attribute']]['id_product_attribute'] = $attr['id_product_attribute'];
$attributes[$attr['id_product_attribute']]['ean13'] = $attr['ean13'];
$attributes[$attr['id_product_attribute']]['reference'] = $attr['reference'];
$cover = Product::getCover($product->id);
}
}
if($product) {
$link = new Link();
echo '
EAN | Référence | Nom | Nouvel EAN | |
---|---|---|---|---|
'.(!empty($attr['ean13'])? $attr['ean13']: ''.$product->ean13).''.' | '.((string) $attr['reference'] == ''? $product->reference: $attr['reference']).' | '.$product->name.$attr['name'].' | ||
'.$product->ean13.' | '.$product->reference.' | '.$product->name.' |