diff --git a/admin-dev/themes/default/template/controllers/products/list_header.tpl b/admin-dev/themes/default/template/controllers/products/list_header.tpl
index a78abd164..7e859966c 100644
--- a/admin-dev/themes/default/template/controllers/products/list_header.tpl
+++ b/admin-dev/themes/default/template/controllers/products/list_header.tpl
@@ -30,24 +30,41 @@
{if isset($category_tree)}
- {l s='Go to category:'}
-
+
+
+
+
+
+
+ {$category_tree}
+
+
{/if}
{/block}
diff --git a/classes/AdminController.php b/classes/AdminController.php
index 7b3ed30fe..9ee7a21ed 100644
--- a/classes/AdminController.php
+++ b/classes/AdminController.php
@@ -1431,10 +1431,8 @@ class AdminControllerCore extends Controller
$helper = new HelperList();
$this->setHelperDisplay($helper);
- $this->tpl_list_vars['img_dir'] = 'toto';
$helper->tpl_vars = $this->tpl_list_vars;
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
- // Check if list templates have been overriden
// For compatibility reasons, we have to check standard actions in class attributes
foreach ($this->actions_available as $action)
@@ -1538,7 +1536,6 @@ class AdminControllerCore extends Controller
// @todo : move that in Helper
$helper->title = $this->toolbar_title;
$helper->toolbar_btn = $this->toolbar_btn;
-
$helper->show_toolbar = $this->show_toolbar;
$helper->toolbar_fix = $this->toolbar_fix;
$helper->override_folder = $this->tpl_folder;
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index 236e58eb9..8a5894ff0 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -1884,40 +1884,31 @@ class AdminProductsControllerCore extends AdminController
self::$currentIndex .= '&id_category='.$id_category;
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->getID(true));
- if (!empty($this->_list))
+ $id_category = Tools::getValue('id_category', 1);
+
+ $root_category = Category::getRootCategory();
+ if (!$root_category->id_category)
{
- $id_category = Tools::getValue('id_category', 1);
- if (!$id_category)
- $id_category = 1;
- // @todo lot of ergonomy works around here
- // @todo : move blockcategories select queries in class Category
- $root_categ = Category::getRootCategory();
- $children = $root_categ->getAllChildren();
- $category_tree = array();
-
- // Add category "all products" to tree
- $all_categ = new Category();
- $all_categ->name = 'All products';
- $all_categ->selected = $this->_category->id_category == $all_categ->id;
- $all_categ->dashes = '';
- $category_tree[] = $all_categ;
-
- // Add root category to tree
- $root_categ->selected = $this->_category->id_category == $root_categ->id;
- $root_categ->dashes = str_repeat(' - ',$root_categ->level_depth);
- $category_tree[] = $root_categ;
-
- foreach ($children as $categ)
- {
- $categ->selected = $this->_category->id_category == $categ->id;
- $categ->dashes = str_repeat(' - ',$categ->level_depth);
- $category_tree[] = $categ;
- }
- $this->tpl_list_vars['category_tree'] = $category_tree;
-
- // used to build the new url when changing category
- $this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token;
+ $root_category->id_category = 0;
+ $root_category->name = $this->l('Root');
}
+ $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
+
+ $translations = array(
+ 'Root' => $root_category,
+ 'selected' => $this->l('selected'),
+ 'Collapse All' => $this->l('Collapse All'),
+ 'Expand All' => $this->l('Expand All'),
+ 'Check All' => $this->l('Check All'),
+ 'Uncheck All' => $this->l('Uncheck All'),
+ 'search' => $this->l('Search a category')
+ );
+
+ $this->tpl_list_vars['is_category_filter'] = Tools::getValue('id_category') ? true : false;
+ $this->tpl_list_vars['category_tree'] = Helper::renderAdminCategorieTree($translations, array($id_category), 'categoryBox', true, false);
+
+ // used to build the new url when changing category
+ $this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token;
}
// @todo module free
$this->tpl_form_vars['vat_number'] = file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php');
@@ -1932,6 +1923,7 @@ class AdminProductsControllerCore extends AdminController
if (!Tools::getValue('id_category'))
unset($this->fieldsDisplay['position']);
+
return parent::renderList();
}
diff --git a/css/admin.css b/css/admin.css
index 4fe6eb4ba..ab7503627 100644
--- a/css/admin.css
+++ b/css/admin.css
@@ -2243,4 +2243,18 @@ margin-bottom:7px;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
width: 300px;
+}
+
+#container_category_tree {
+ border: 1px solid #ccc;
+ border-radius: 3px;
+ padding: 5px;
+}
+
+#container_category_tree a{
+ font-weight: bold;
+}
+
+#container_category_tree a input{
+ margin-right: 3px;
}
\ No newline at end of file