diff --git a/modules/criteo_bbb/criteo_bbb.php b/modules/criteo_bbb/criteo_bbb.php index b1d6bdfc..a9a9d8a1 100644 --- a/modules/criteo_bbb/criteo_bbb.php +++ b/modules/criteo_bbb/criteo_bbb.php @@ -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);