// 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:
mDeflotte
2011-10-18 15:43:28 +00:00
parent 243387c4e0
commit 886fcda18e
3 changed files with 25 additions and 19 deletions
+15
View File
@@ -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();
}
}