// 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:
dSevere
2011-12-01 19:09:27 +00:00
parent 8e2102c8ce
commit 8b618652bb
13 changed files with 1241 additions and 619 deletions
+4 -3
View File
@@ -74,11 +74,11 @@ class ProductSaleCore
if ($nbProducts < 1) $nbProducts = 10;
if (empty($orderBy) || $orderBy == 'position') $orderBy = 'sales';
if (empty($orderWay)) $orderWay = 'DESC';
$groups = FrontController::getCurrentCustomerGroups();
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
$sql = 'SELECT p.*, sa.out_of_stock,
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity,
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
i.`id_image`, il.`legend`,
ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
@@ -94,7 +94,7 @@ class ProductSaleCore
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
AND tr.`id_state` = 0
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product` = p.`id_product` AND sa.id_product_attribute = 0)
'.Product::sqlStock('p').'
WHERE p.`active` = 1
AND p.`id_product` IN (
SELECT cp.`id_product`
@@ -104,6 +104,7 @@ class ProductSaleCore
)
ORDER BY `'.pSQL($orderBy).'` '.pSQL($orderWay).'
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)$nbProducts;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
if ($orderBy == 'price')