[-] 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.
This commit is contained in:
vChabot
2012-05-11 09:33:08 +00:00
parent 68199f0037
commit e6e7792a61
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -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)
@@ -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))