// Decrement stock available on order
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9430 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -263,4 +263,19 @@ class StockAvailableCore extends ObjectModel
|
||||
WHERE id_stock_available = '.(int)$id_stock_available);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given id_product and id_product_attribute update quantity the quantity available
|
||||
*/
|
||||
public static function updateQuantity($id_product, $id_product_attribute, $delta_quantity, $id_shop = null)
|
||||
{
|
||||
$id_stock = self::getIdStockAvailable($id_product, $id_product_attribute, $id_shop);
|
||||
|
||||
if (!$id_stock)
|
||||
return false;
|
||||
|
||||
$stock_available = new StockAvailable($id_stock);
|
||||
$stock_available->quantity = $stock_available->quantity + $delta_quantity;
|
||||
$stock_available->save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user