// Cookies subdomain & bug fix on stocks

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16110 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-06-21 16:11:30 +00:00
parent 5db490c0e2
commit b37c0dc297
4 changed files with 43 additions and 9 deletions
+4 -2
View File
@@ -343,15 +343,17 @@ class StockAvailableCore extends ObjectModel
if ($this->id_product_attribute == 0)
return true;
$id_shop = (Shop::getContext() != Shop::CONTEXT_GROUP ? $this->id_shop : null);
$total_quantity = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT SUM(quantity) as quantity
FROM '._DB_PREFIX_.'stock_available
WHERE id_product = '.(int)$this->id_product.'
AND id_product_attribute <> 0 '.
StockAvailable::addSqlShopRestriction(null, $this->id_shop)
StockAvailable::addSqlShopRestriction(null, $id_shop)
);
$this->setQuantity($this->id_product, 0, $total_quantity, $this->id_shop);
$this->setQuantity($this->id_product, 0, $total_quantity, $id_shop);
return true;
}