diff --git a/classes/Category.php b/classes/Category.php index e546a7bf2..24ce79766 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -648,9 +648,8 @@ class CategoryCore extends ObjectModel LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` WHERE product_shop.`id_shop` = '.(int)$context->shop->id.' - AND ((product_attribute_shop.id_product_attribute IS NOT NULL OR pa.id_product_attribute IS NULL) - OR (product_attribute_shop.id_product_attribute IS NULL AND pa.default_on=1)) - 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)) + AND (pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop='.(int)$context->shop->id.') + AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$context->shop->id.') AND cp.`id_category` = '.(int)$this->id .($active ? ' AND product_shop.`active` = 1' : '') .($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') diff --git a/classes/Product.php b/classes/Product.php index 9350bc286..0c80be501 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1944,7 +1944,7 @@ class ProductCore extends ObjectModel $sql->select('pa.id_product_attribute'); $sql->leftOuterJoin('product_attribute', 'pa', 'p.`id_product` = pa.`id_product`'); $sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on = 1')); - $sql->where('(pa.id_product_attribute IS NULL OR product_attribute_shop.id_product_attribute IS NOT NULL)'); + $sql->where('pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop='.(int)$context->shop->id.')'); } $sql->join(Product::sqlStock('p', Combination::isFeatureActive() ? 'product_attribute_shop' : 0)); @@ -2053,7 +2053,7 @@ class ProductCore extends ObjectModel LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) '.Product::sqlStock('p', 0).' WHERE p.id_product = '.(int)$id_product.' - 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)) + AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$context->shop->id.') '.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : ''); $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); if ($result['id_product_attribute'])