// Optimizations and clean ajax.php

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16087 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-06-19 16:47:04 +00:00
parent 5cefe6f822
commit 7f38dfdb1f
3 changed files with 2 additions and 87 deletions
+2 -4
View File
@@ -2698,9 +2698,7 @@ class ProductCore extends ObjectModel
*/
public static function sqlStock($product_alias, $product_attribute = 0, $inner_join = false, Shop $shop = null)
{
if (!$shop)
$shop = Context::getContext()->shop;
$id_shop = ($shop !== null ? (int)$shop->id : null);
$sql = (($inner_join) ? ' INNER ' : ' LEFT ').'
JOIN '._DB_PREFIX_.'stock_available stock
ON (stock.id_product = '.pSQL($product_alias).'.id_product';
@@ -2715,7 +2713,7 @@ class ProductCore extends ObjectModel
$sql .= ' AND stock.id_product_attribute = IFNULL('.pSQL($product_attribute).'.id_product_attribute, 0)';
}
$sql .= StockAvailable::addSqlShopRestriction(null, $shop->id, 'stock').' )';
$sql .= StockAvailable::addSqlShopRestriction(null, $id_shop, 'stock').' )';
return $sql;
}