// Stock decrementation when order is shipped
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9486 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -265,7 +265,7 @@ class StockAvailableCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given id_product and id_product_attribute update quantity the quantity available
|
||||
* For a given id_product and id_product_attribute update the quantity available
|
||||
*/
|
||||
public static function updateQuantity($id_product, $id_product_attribute, $delta_quantity, $id_shop = null)
|
||||
{
|
||||
@@ -274,6 +274,17 @@ class StockAvailableCore extends ObjectModel
|
||||
if (!$id_stock)
|
||||
return false;
|
||||
|
||||
// Update quantity of the pack products
|
||||
if (Pack::isPack($id_product))
|
||||
{
|
||||
$products_pack = Pack::getItems((int)($product['id_product']), (int)(Configuration::get('PS_LANG_DEFAULT')));
|
||||
foreach ($products_pack as $product_pack)
|
||||
{
|
||||
$pack_id_product_attribute = Product::getDefaultAttribute($tab_product_pack['id_product'], 1);
|
||||
self::updateQuantity($product_pack->id, $pack_id_product_attribute, $product_pack->pack_quantity * $delta_quantity, $id_shop);
|
||||
}
|
||||
}
|
||||
|
||||
$stock_available = new StockAvailable($id_stock);
|
||||
$stock_available->quantity = $stock_available->quantity + $delta_quantity;
|
||||
$stock_available->save();
|
||||
|
||||
Reference in New Issue
Block a user