// Fix bug in AdminProductsController

This commit is contained in:
lLefevre
2011-11-23 16:49:15 +00:00
parent 69ac10f7df
commit d3db9d0808
2 changed files with 36 additions and 33 deletions
+2 -2
View File
@@ -220,9 +220,9 @@
{if $display_header && $is_multishop && $shop_context != 'all'}
<div class="multishop_info">
{if $shop_context == 'group'}
{l s='You are configuring your store for group shop'} <b>{$group_shop->name}</b>
{l s='You are configuring your store for group shop'} <b> {$group_shop->name}</b>
{elseif $shop_context == 'shop'}
{l s='You are configuring your store for shop'} <b>{$shop->name}</b>
{l s='You are configuring your store for shop'} <b> {$shop->name}</b>
{/if}
</div>
{/if}
+34 -31
View File
@@ -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('&nbsp;-&nbsp;',$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('&nbsp;-&nbsp;',$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('&nbsp;-&nbsp;',$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('&nbsp;-&nbsp;',$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');