// When removing a product, its stock available is now properly removed
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10111 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -291,4 +291,20 @@ class StockAvailableCore extends ObjectModel
|
||||
$stock_available->quantity = $stock_available->quantity + $delta_quantity;
|
||||
$stock_available->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a given product from the stock available
|
||||
*
|
||||
* @param int $id_product
|
||||
* @param int $id_product_attribute Optional
|
||||
* @param int $id_shop Optional
|
||||
*/
|
||||
public static function removeProductFromStockAvailable($id_product, $id_product_attribute = null, $id_shop = null)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'stock_available
|
||||
WHERE id_product = '.(int)$id_product.
|
||||
($id_product_attribute ? ' AND id_product_attribute = '.(int)$id_product_attribute : '').
|
||||
($id_shop ? ' AND id_shop = '.(int)$id_shop : ''));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user