diff --git a/classes/Category.php b/classes/Category.php index 35cbdb0f4..a5fea0fbd 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -1390,8 +1390,7 @@ class CategoryCore extends ObjectModel SELECT DISTINCT c.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)Context::getContext()->language->id.') - WHERE `level_depth` = 1 - '); + WHERE `level_depth` = 1'); } public function isRootCategoryForAShop() diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index bfc0077dd..8cbab8b4c 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -173,13 +173,13 @@ class HelperListCore extends Helper public function displayListContent() { - if ($this->position_identifier) - $id_category = (int)Tools::getValue('id_'.($this->is_cms ? 'cms_' : '').'category', ($this->is_cms ? '1' : Category::getRootCategory()->id )); - else - $id_category = Category::getRootCategory()->id; - if (isset($this->fields_list['position'])) { + if ($this->position_identifier) + $id_category = (int)Tools::getValue('id_'.($this->is_cms ? 'cms_' : '').'category', ($this->is_cms ? '1' : Category::getRootCategory()->id )); + else + $id_category = Category::getRootCategory()->id; + $positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list); sort($positions); } @@ -307,7 +307,7 @@ class HelperListCore extends Helper 'table' => $this->table, 'token' => $this->token, 'color_on_bg' => $this->colorOnBackground, - 'id_category' => $id_category, + 'id_category' => isset($id_category) ? $id_category : false, 'bulk_actions' => $this->bulk_actions, 'positions' => isset($positions) ? $positions : null, 'order_by' => $this->orderBy,