Merge pull request #134 from PrestaEdit/patch-2

[-] FO: need id_product_attribute to know quantity
This commit is contained in:
Vincent Augagneur committed 2013-02-05 00:52:50 -08:00
commit 288c3e1323
1 file changed
+2 -1
+2 -1
View File
@@ -2439,12 +2439,13 @@ class ProductCore extends ObjectModel
if ((int)$id_cart) if ((int)$id_cart)
{ {
$condition = ''; $condition = '';
$cache_name = (int)$id_cart.'_'.(int)$id_product; $cache_name = (int)$id_cart.'_'.(int)$id_product.'_'.(int)$id_product_attribute;
if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity) if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity)
self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT SUM(`quantity`) SELECT SUM(`quantity`)
FROM `'._DB_PREFIX_.'cart_product` FROM `'._DB_PREFIX_.'cart_product`
WHERE `id_product` = '.(int)$id_product.' WHERE `id_product` = '.(int)$id_product.'
AND `id_product_attribute` = '.(int)$id_product_attribute.'
AND `id_cart` = '.(int)$id_cart); AND `id_cart` = '.(int)$id_cart);
$cart_quantity = self::$_cart_quantity[$cache_name]; $cart_quantity = self::$_cart_quantity[$cache_name];
} }