Merge branch 'ticket-criteo' into develop

This commit is contained in:
Marion Muszynski 2016-07-28 12:06:42 +02:00
commit 4b20be7481

View File

@ -381,18 +381,20 @@ class Criteo_bbb extends Module
foreach ($delay['products'] as $product) {
if(isset($products_sales[(int) $product['id_product']])) {
if(!isset($product_result[$products_sales[(int) $product['id_product']]])) {
$product_result[$products_sales[(int) $product['id_product']]] = 0;
$product_result[$products_sales[(int) $product['id_product']]]['price'] = 0;
$product_result[$products_sales[(int) $product['id_product']]]['quantity'] = 0;
}
$product_obj = new Product((int)$product['id_product']);
$price = $product_obj->getPrice(true, ($product['id_product_attribute'] ? $product['id_product_attribute'] : (int)Product::getDefaultAttribute($product_obj->id)), 2);
$product_result[$products_sales[(int) $product['id_product']]] += $price * (int) $product['quantity'];
$product_result[$products_sales[(int) $product['id_product']]]['price'] += $price * (int) $product['quantity'];
$product_result[$products_sales[(int) $product['id_product']]]['quantity'] += (int) $product['quantity'];
unset($product_obj);
}
}
}
foreach($product_result as $id_product => $value) {
$strproducts .= '{ id: '.$id_product.', price: '.$value.', quantity: 1 },';
$strproducts .= '{ id: '.$id_product.', price: '.$value['price'].', quantity: '.$value['quantity'].' },';
}
$strproducts = Tools::substr($strproducts, 0, -1);