[-] Core: Fix the listings in multishop context when you have at least a combination on one shop and not on the others and the same for the images

This commit is contained in:
Rémi Gaillard
2013-03-20 20:12:28 +01:00
parent 68be65e60f
commit 5f181c8e4c
8 changed files with 42 additions and 49 deletions
+3 -4
View File
@@ -325,9 +325,9 @@ class ManufacturerCore extends ObjectModel
$alias = 'stock.';
else
$alias = 'p.';
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
pl.`meta_title`, pl.`name`, image_shop.`id_image`, il.`legend`, m.`name` AS manufacturer_name,
pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name,
DATEDIFF(
product_shop.`date_add`,
DATE_SUB(
@@ -353,7 +353,6 @@ class ManufacturerCore extends ObjectModel
WHERE p.`id_manufacturer` = '.(int)$id_manufacturer.'
'.($active ? ' AND product_shop.`active` = 1' : '').'
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
AND (product_attribute_shop.default_on = 1 OR product_attribute_shop.default_on IS NULL)
AND p.`id_product` IN (
SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
@@ -362,7 +361,7 @@ class ManufacturerCore extends ObjectModel
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
WHERE cg.`id_group` '.$sql_groups.'
)
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
GROUP BY product_shop.id_product
ORDER BY '.$alias.'`'.bqSQL($order_by).'` '.pSQL($order_way).'
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;