Merge branch 'master' of gitlab.antadis.net:dev-antadis/bebeboutik

This commit is contained in:
root 2016-08-31 11:56:52 +02:00
commit 857c4a6f78

View File

@ -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;
}
}