From ba62ff6581ef0d9390fcfc158fade48dd576a08d Mon Sep 17 00:00:00 2001 From: vChabot Date: Fri, 27 Apr 2012 13:54:49 +0000 Subject: [PATCH] [-] BO : BugFix #PSCFV-2110 #PSCFV-2117 Category association in product page (back-office) is now saved when you have only one shop git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14952 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Product.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index 248c7ad6a..211697d20 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -757,15 +757,19 @@ class ProductCore extends ObjectModel // take the first selected category to get the category tree (nleft and nright) $category = new Category($categories[0]); // get max position in each categories + $and = ''; + if (Shop::isFeatureActive()) + $and = ' + AND (c.`nleft` < '.(int)$category->nleft.' + AND c.`nright` > '.(int)$category->nright.' + AND c.`level_depth` = 1)'; $result = Db::getInstance()->executeS(' SELECT c.`id_category` FROM `'._DB_PREFIX_.'category_product` cp LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`) WHERE cp.`id_category` NOT IN('.implode(',', array_map('intval', $categories)).') - AND (c.`nleft` < '.(int)$category->nleft.' - AND c.`nright` > '.(int)$category->nright.' - AND c.`level_depth` = 1) + '.$and.' AND cp.id_product = '.$this->id ); foreach ($result as $categ_to_delete)