17 lines
422 B
PHP
Raw Permalink Normal View History

2015-10-14 11:18:23 +02:00
<?php
class Cart extends CartCore
{
public static function getQuantityByProduct($id_cart, $id_product, $id_product_attribute = 0)
{
return (int)Db::getInstance()->getValue('
SELECT SUM(`quantity`)
FROM `'._DB_PREFIX_.'cart_product`
WHERE `id_cart` = '.(int)$id_cart .'
AND `id_product` = '.(int)$id_product .'
AND `id_product_attribute` = '.(int)$id_product_attribute
);
}
}