From d3db9d08080b06a1602144bf201fb3d9e52d8535 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Wed, 23 Nov 2011 16:49:15 +0000 Subject: [PATCH] // Fix bug in AdminProductsController --- admin-dev/themes/template/header.tpl | 4 +- controllers/admin/AdminProductsController.php | 65 ++++++++++--------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/admin-dev/themes/template/header.tpl b/admin-dev/themes/template/header.tpl index 6f2984474..c04ef9170 100644 --- a/admin-dev/themes/template/header.tpl +++ b/admin-dev/themes/template/header.tpl @@ -220,9 +220,9 @@ {if $display_header && $is_multishop && $shop_context != 'all'}
{if $shop_context == 'group'} - {l s='You are configuring your store for group shop'} {$group_shop->name} + {l s='You are configuring your store for group shop'} {$group_shop->name} {elseif $shop_context == 'shop'} - {l s='You are configuring your store for shop'} {$shop->name} + {l s='You are configuring your store for shop'} {$shop->name} {/if}
{/if} diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 4f3f3a0fe..a9f96f96d 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1649,39 +1649,42 @@ class AdminProductsControllerCore extends AdminController if ($id_category = (int)Tools::getValue('id_category')) 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)); - - $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 $k => $categ) + + if (!empty($this->_list)) { - $categ = new Category($categ['id_category'],$this->context->language->id); - $categ->selected = $this->_category->id_category == $categ->id; - $categ->dashes = str_repeat(' - ',$categ->level_depth); - $category_tree[] = $categ; + $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 $k => $categ) + { + $categ = new Category($categ['id_category'],$this->context->language->id); + $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; } - $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; } // @todo module free $this->tpl_form_vars['vat_number'] = file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php');