diff --git a/override/classes/Product.php b/override/classes/Product.php index 1bbc4f60..ea9a4283 100644 --- a/override/classes/Product.php +++ b/override/classes/Product.php @@ -159,7 +159,7 @@ class Product extends ProductCore if ($row['id_product_attribute']) { - $row['quantity_all_versions'] = $row['quantity']; + $row['quantity_all_versions'] = Product::getTotalAttributeQuantity((int)$row['id_product']); $row['quantity'] = Product::getQuantity((int)$row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : NULL); } $row['id_image'] = Product::defineProductImage($row, $id_lang); @@ -285,4 +285,15 @@ class Product extends ProductCore } return !$return ? false : $combinationImages; } + + public static function getTotalAttributeQuantity($id_product) + { + $quantity = Db::getInstance()->getValue(' + SELECT SUM(`quantity`) + FROM `'._DB_PREFIX_.'product_attribute` + WHERE `id_product` = '.(int)($id_product) + ); + + return $quantity; + } }