// Fix #PSCFV-4549
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17637 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+7
-3
@@ -2020,7 +2020,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$ids_product = ' AND (';
|
$ids_product = ' AND (';
|
||||||
foreach ($product_reductions as $product_reduction)
|
foreach ($product_reductions as $product_reduction)
|
||||||
$ids_product .= '( p.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND pa.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
$ids_product .= '( product_shop.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND product_attribute_shop.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
||||||
$ids_product = rtrim($ids_product, 'OR').')';
|
$ids_product = rtrim($ids_product, 'OR').')';
|
||||||
|
|
||||||
$groups = FrontController::getCurrentCustomerGroups();
|
$groups = FrontController::getCurrentCustomerGroups();
|
||||||
@@ -2041,7 +2041,8 @@ class ProductCore extends ObjectModel
|
|||||||
WHERE cg.`id_group` '.$sql_groups.'
|
WHERE cg.`id_group` '.$sql_groups.'
|
||||||
)
|
)
|
||||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||||
GROUP BY p.id_product
|
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.default_on = 1)
|
||||||
|
GROUP BY product_shop.id_product
|
||||||
ORDER BY RAND()';
|
ORDER BY RAND()';
|
||||||
|
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
@@ -2147,7 +2148,7 @@ class ProductCore extends ObjectModel
|
|||||||
$order_by = explode('.', $order_by);
|
$order_by = explode('.', $order_by);
|
||||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||||
}
|
}
|
||||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`,
|
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, product_attribute_shop.id_product_attribute,
|
||||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
||||||
pl.`name`, image_shop.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
pl.`name`, image_shop.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
@@ -2159,6 +2160,8 @@ class ProductCore extends ObjectModel
|
|||||||
) > 0 AS new
|
) > 0 AS new
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.Shop::addSqlAssociation('product', 'p').'
|
'.Shop::addSqlAssociation('product', 'p').'
|
||||||
|
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product = p.id_product)
|
||||||
|
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on=1').'
|
||||||
'.Product::sqlStock('p', 0, false, $context->shop).'
|
'.Product::sqlStock('p', 0, false, $context->shop).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||||
p.`id_product` = pl.`id_product`
|
p.`id_product` = pl.`id_product`
|
||||||
@@ -2183,6 +2186,7 @@ class ProductCore extends ObjectModel
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||||
WHERE cg.`id_group` '.$sql_groups.'
|
WHERE cg.`id_group` '.$sql_groups.'
|
||||||
)
|
)
|
||||||
|
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.default_on = 1)
|
||||||
ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').pSQL($order_by).' '.pSQL($order_way).'
|
ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').pSQL($order_by).' '.pSQL($order_way).'
|
||||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user