Merge branch 'ticket-10444' into develop

This commit is contained in:
Marion Muszynski 2016-07-12 16:23:42 +02:00
commit 6ecf465e1e

View File

@ -119,7 +119,6 @@ class MakeStats {
foreach($lines as $line) foreach($lines as $line)
{ {
// if( ($line['product_quantity'] - $line['product_quantity_reinjected']) == 0) // if( ($line['product_quantity'] - $line['product_quantity_reinjected']) == 0)
// continue; // continue;
@ -282,11 +281,11 @@ class MakeStats {
WHERE product_id IN ("'.implode('","', $ids_products).'")'; WHERE product_id IN ("'.implode('","', $ids_products).'")';
$res = Db::getInstance()->ExecuteS($req); $res = Db::getInstance()->ExecuteS($req);
$ids_od = array(); /*$ids_od = array();
foreach($res as $k => $r) { foreach($res as $k => $r) {
$ids_od[] = $res[$k]['product_id']; $ids_od[] = $res[$k]['product_id'];
} }
$ids_no_od = array_diff($ids_products, $ids_od); $ids_no_od = array_diff($ids_products, $ids_od);*/
$req2 = 'SELECT $req2 = 'SELECT
p.id_product as product_id, p.price as product_price, p.price as product_price, p.ean13 as product_ean13, p.reference as product_reference, p.supplier_reference as product_supplier_reference, p.id_product as product_id, p.price as product_price, p.price as product_price, p.ean13 as product_ean13, p.reference as product_reference, p.supplier_reference as product_supplier_reference,
p.weight as product_weight, pl.name as product_name_base, p.weight as product_weight, pl.name as product_name_base,
@ -297,9 +296,18 @@ class MakeStats {
ON pl.id_product = p.id_product ON pl.id_product = p.id_product
AND pl.id_lang = 2 AND pl.id_lang = 2
LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product` = p.`id_product`) LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product` = p.`id_product`)
WHERE p.id_product IN ("'.implode('","', $ids_no_od).'")'; WHERE p.id_product IN ("'.implode('","', $ids_products).'")';
$res2 = Db::getInstance()->ExecuteS($req2); $res2 = Db::getInstance()->ExecuteS($req2);
foreach ($res2 as $k => $value) {
if((int)$value['product_attribute_id']!=0
&& $key = array_search($value['product_attribute_id'], array_column($res, 'product_attribute_id'))
&& $key
) {
unset($res2[$k]);
}
}
$res = array_merge($res,$res2); $res = array_merge($res,$res2);
$id_lang = 2; $id_lang = 2;
foreach($res as $k => $r) foreach($res as $k => $r)
@ -330,6 +338,7 @@ class MakeStats {
} }
$r['product_name'] .= ' '.$attribute['group_name'] .' : '. $attribute['attribute_name']; $r['product_name'] .= ' '.$attribute['group_name'] .' : '. $attribute['attribute_name'];
$res[$k]['attribute_quantity'] = $attribute['quantity']; $res[$k]['attribute_quantity'] = $attribute['quantity'];
$res[$k]['product_ean13'] = $attribute['ean13'];
} }
} }