// Context part 15

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7658 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-19 16:17:14 +00:00
parent 3baf0f02a5
commit 4ae81d8acd
39 changed files with 231 additions and 198 deletions
+6 -3
View File
@@ -118,12 +118,15 @@ class AttributeCore extends ObjectModel
* @param integer $qty Quantity needed
* @return boolean Quantity is available or not
*/
static public function checkAttributeQty($id_product_attribute, $qty)
{
static public function checkAttributeQty($id_product_attribute, $qty, Context $context = null)
{
if (!$context)
$context = Context::getContext();
$sql = 'SELECT quantity
FROM '._DB_PREFIX_.'stock
WHERE id_product_attribute = '.(int)$id_product_attribute
.Shop::sqlSharedStock();
.$context->shop->sqlSharedStock();
$result = (int)Db::getInstance()->getValue($sql);
return ($result AND $qty <= $result);