Merge branch 'develop' of git@gitlab.antadis.net:dev-antadis/bebeboutik.git into develop

This commit is contained in:
Michael RICOIS 2017-11-07 12:18:12 +01:00
commit 6c09de8b18
2 changed files with 97 additions and 5 deletions

View File

@ -137,7 +137,7 @@ class AdminAntWp extends AdminTab
$ids = array();
foreach (Db::getInstance()->executeS('
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`,
p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.*
p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country`
FROM
`'._DB_PREFIX_.'product` p
INNER JOIN (SELECT date_add, max(id_product) as maxid FROM `'._DB_PREFIX_.'product` GROUP BY ean13) as b
@ -148,18 +148,52 @@ class AdminAntWp extends AdminTab
ON (cu.`id_product` = p.`id_product`)
WHERE p.`ean13` IN ("'.implode('","',$eans).'")
'.(!empty($refs)?' OR p.`supplier_reference` IN ("'.implode('","',$refs).'")':'').'
AND p.`id_product` IS NOT NULL
ORDER BY c.`position`
') as $row) {
if($row['ean13']!='' && isset($products[$row['ean13']])){
$products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
$product_found++;
$ids[] = (int)$row['id_product'];
} elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){
$products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row);
$product_found++;
$ids[] = (int)$row['id_product'];
}
}
foreach (Db::getInstance()->executeS('
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, at.`ean13`, p.`price`, p.`wholesale_price`,
p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country`
FROM
`'._DB_PREFIX_.'product` p
INNER JOIN (SELECT date_add, max(id_product) as maxid FROM `'._DB_PREFIX_.'product` GROUP BY `supplier_reference`) as b
ON p.`id_product` = b.maxid
LEFT JOIN `'._DB_PREFIX_.'category_product` c
ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`)
LEFT JOIN `'._DB_PREFIX_.'product_customs` cu
ON (cu.`id_product` = p.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` at
ON (at.`id_product` = p.`id_product`)
WHERE at.`ean13` IN ("'.implode('","',$eans).'")
AND p.`id_product` IS NOT NULL
ORDER BY c.`position`
') as $row) {
if($row['ean13']!='' && isset($products[$row['ean13']])){
$products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
$product_found++;
$ids[] = (int)$row['id_product'];
} elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){
$products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row);
$product_found++;
$ids[] = (int)$row['id_product'];
}
if(!in_array((int)$row['id_product'],$ids)){
$ids[] = (int)$row['id_product'];
}
$ids[] = (int)$row['id_product'];
}
$new_products = count($products) - $product_found;
if(!empty($ids)){
foreach (Db::getInstance()->executeS('
SELECT p.`ean13`, p.`supplier_reference`, pl.*

File diff suppressed because one or more lines are too long