// Context part 15

This commit is contained in:
rMalie
2011-07-19 16:17:14 +00:00
parent 1fdf4400b7
commit 02a738dce1
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);