// Stock Available : Improve BackOffice interface + Update all SQL requests relative to StockAvailable + code refactoring on Product Class
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10843 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -171,11 +171,13 @@ class AttributeCore extends ObjectModel
|
||||
if (!$shop)
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$sql = 'SELECT quantity
|
||||
$result = StockAvailable::getQuantityAvailableByProduct(null, (int)$id_product_attribute, $shop->getID());
|
||||
|
||||
/*$sql = 'SELECT quantity
|
||||
FROM '._DB_PREFIX_.'stock_available
|
||||
WHERE id_product_attribute = '.(int)$id_product_attribute
|
||||
.$shop->addSqlRestriction();
|
||||
$result = (int)Db::getInstance()->getValue($sql);
|
||||
$result = (int)Db::getInstance()->getValue($sql);*/
|
||||
|
||||
return ($result && $qty <= $result);
|
||||
}
|
||||
@@ -191,6 +193,9 @@ class AttributeCore extends ObjectModel
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
return StockAvailable::getQuantityAvailableByProduct($id_product);
|
||||
|
||||
/*
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT SUM(quantity) as quantity
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
@@ -200,6 +205,7 @@ class AttributeCore extends ObjectModel
|
||||
if ($row['quantity'] !== null)
|
||||
return (int)$row['quantity'];
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user