From 7842750f4e628ee51b576bc58d1593b9dcf29554 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Wed, 10 Oct 2012 16:49:51 +0000 Subject: [PATCH] // Improve performance on specific price rule when editing a product --- classes/SpecificPriceRule.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/classes/SpecificPriceRule.php b/classes/SpecificPriceRule.php index 45c6ebe54..c3ef68d03 100755 --- a/classes/SpecificPriceRule.php +++ b/classes/SpecificPriceRule.php @@ -182,11 +182,11 @@ class SpecificPriceRuleCore extends ObjectModel $categories = false; $features = false; $suppliers = false; - $where = false; + $where = '1'; if ($conditions_group) { - $where = '('; + $where .= ' AND ('; foreach ($conditions_group as $id_condition_group => $condition_group) { $fields = array( @@ -239,10 +239,9 @@ class SpecificPriceRuleCore extends ObjectModel $where = rtrim($where, ' AND ').') OR ('; } $where = rtrim($where, 'OR ('); - if ($products && count($products)) - $where .= ' AND p.id_product IN ('.implode(', ', array_map('intval', $products)).')'; } - + if ($products && count($products)) + $where .= ' AND p.id_product IN ('.implode(', ', array_map('intval', $products)).')'; if ($attributes) { $query->select('pa.id_product_attribute');