[-] 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 committed 2012-05-11 09:33:08 +00:00
1 parent 79b2993a8a
commit 0b93a04e5b
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -547,6 +547,7 @@ class CategoryCore extends ObjectModel
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' $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 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 FROM `'._DB_PREFIX_.'category` c
'.Shop::addSqlAssociation('category', 'c').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
ON (c.`id_category` = cl.`id_category` ON (c.`id_category` = cl.`id_category`
AND `id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').') AND `id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
@@ -556,7 +557,7 @@ class CategoryCore extends ObjectModel
'.($active ? 'AND `active` = 1' : '').' '.($active ? 'AND `active` = 1' : '').'
AND cg.`id_group` '.$sql_groups.' AND cg.`id_group` '.$sql_groups.'
GROUP BY c.`id_category` 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) foreach ($result as &$row)
@@ -103,7 +103,7 @@ class AdminCategoriesControllerCore extends AdminController
$this->_category = new Category(Configuration::get('PS_HOME_CATEGORY')); $this->_category = new Category(Configuration::get('PS_HOME_CATEGORY'));
// if we are not in a shop context, we remove the position column // 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']); unset($this->fields_list['position']);
// shop restriction : if category is not available for current shop, we redirect to the list from default category // shop restriction : if category is not available for current shop, we redirect to the list from default category
if (!Shop::isCategoryAvailable($this->_category->id)) if (!Shop::isCategoryAvailable($this->_category->id))