From 0b93a04e5b9b35deec886604e7aee91d311796d1 Mon Sep 17 00:00:00 2001 From: vChabot Date: Fri, 11 May 2012 09:33:08 +0000 Subject: [PATCH] [-] BO : BugFix : #PSCFV-2300 : Bug on categories position // When multishop is not enabled in the BO, you can't change the position of your categories // When multishop is enabled in the BO, you can change the positions of your categories in the BO, but the positions of the categories on the front do not change. --- classes/Category.php | 3 ++- controllers/admin/AdminCategoriesController.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/Category.php b/classes/Category.php index b129ed194..17168eb11 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -547,6 +547,7 @@ class CategoryCore extends ObjectModel $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description FROM `'._DB_PREFIX_.'category` c + '.Shop::addSqlAssociation('category', 'c').' LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').') @@ -556,7 +557,7 @@ class CategoryCore extends ObjectModel '.($active ? 'AND `active` = 1' : '').' AND cg.`id_group` '.$sql_groups.' GROUP BY c.`id_category` - ORDER BY `level_depth` ASC, c.`position` ASC + ORDER BY `level_depth` ASC, category_shop.`position` ASC '); foreach ($result as &$row) diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index 25321fffb..1d34370a8 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -103,7 +103,7 @@ class AdminCategoriesControllerCore extends AdminController $this->_category = new Category(Configuration::get('PS_HOME_CATEGORY')); // if we are not in a shop context, we remove the position column - if (Shop::getContext() != Shop::CONTEXT_SHOP) + if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) unset($this->fields_list['position']); // shop restriction : if category is not available for current shop, we redirect to the list from default category if (!Shop::isCategoryAvailable($this->_category->id))