17 lines
422 B
PHP
17 lines
422 B
PHP
<?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
|
|
);
|
|
}
|
|
|
|
}
|