This commit is contained in:
Michael RICOIS 2018-03-12 12:58:54 +01:00
parent 197f4161d1
commit 305234f74f

View File

@ -174,19 +174,25 @@ class PackCore extends Product
} }
/** /**
* Add an item to the pack * Add an item to the pack
* * @param integer $id_product
* @param integer $id_product * @param integer $id_item
* @param integer $id_item * @param integer $qty
* @param integer $qty * @return boolean true if everything was fine
* @return boolean true if everything was fine */
*/
public static function addItem($id_product, $id_item, $qty) public static function addItem($id_product, $id_item, $qty)
{ {
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)($id_product).' LIMIT 1'); Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)($id_product).' LIMIT 1');
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('id_product_pack' => (int)($id_product), 'id_product_item' => (int)($id_item), 'quantity' => (int)($qty)), 'INSERT'); return Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('id_product_pack' => (int)($id_product), 'id_product_item' => (int)($id_item), 'quantity' => (int)($qty)), 'INSERT');
} }
/**
* Update item and his pack association
* @param integer $id_product
* @param integer $id_item
* @param integer $qty
* @return boolean true if everything was fine
*/
public static function updateItem($id_product, $id_item, $qty) public static function updateItem($id_product, $id_item, $qty)
{ {
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('quantity' => (int)($qty)), return Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('quantity' => (int)($qty)),