// improvements on AdminProducts and leadin

This commit is contained in:
mMarinetti
2011-11-04 11:38:22 +00:00
parent 3345e745e3
commit f98f8b3249
2 changed files with 9 additions and 17 deletions
@@ -69,7 +69,7 @@
</div> </div>
</div> </div>
{/if} {/if}
{block name="leadin"}{/block} <div class="leadin">{block name="leadin"}{/block}</div>
<a name="{$table}">&nbsp;</a> <a name="{$table}">&nbsp;</a>
<form method="post" action="{$action}" class="form"> <form method="post" action="{$action}" class="form">
+8 -16
View File
@@ -1542,28 +1542,20 @@ if (false)
$id_category = Tools::getValue('id_category', 1); $id_category = Tools::getValue('id_category', 1);
if (!$id_category) if (!$id_category)
$id_category = 1; $id_category = 1;
$this->content .= '<h3>'.(!$this->_listTotal ? ($this->l('No products found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('products') : $this->l('product')))).'</h3>';
////////////////////////
// @todo lot of ergonomy works around here // @todo lot of ergonomy works around here
$this->content .= '<p>'.$this->l('Go to category');
$select_child = ' <select id="go_to_categ"><option value="1">Home<option>';
// @todo : move blockcategories select queries in class Category // @todo : move blockcategories select queries in class Category
$root_categ = Category::getRootCategory(); $root_categ = Category::getRootCategory();
$children = $root_categ->getAllChildren(); $children = $root_categ->getAllChildren();
$all_cats = array(); $category_tree = array();
foreach ($children as $categ) foreach ($children as $k => $categ)
{ {
// $all_cats[$categ['id_parent']] $categ = new Category($categ['id_category'],$this->context->language->id);
$categ = new Category($categ['id_category'],$this->context->language->id); $categ->selected = $this->_category->id_category == $categ->id;
$select_child .= '<option value="'.$categ->id.'" '.($this->_category->id_category == $categ->id $categ->dashes = str_repeat('&nbsp;-&nbsp;',$categ->level_depth);
? 'selected="selected" class="selected level-depth-'.$categ->level_depth.'"' $category_tree[] = $categ;
:'class="level-depth-'.$categ->level_depth.'"')
.'>' . str_repeat('&nbsp;-&nbsp;',$categ->level_depth). $categ->name .' ('.$categ->id.')</option>';
} }
$this->tpl_list_vars['category_tree'] = $category_tree;
$select_child .= '</select>'; $this->content .= '
$this->content .= $select_child;
$this->content .= '</p>
<script type="text/javascript"> <script type="text/javascript">
$("#go_to_categ").change(function(e){ $("#go_to_categ").change(function(e){
document.location.href = "'.$this->context->link->getAdminLink('AdminProducts').'&id_category="+$(this).val(); document.location.href = "'.$this->context->link->getAdminLink('AdminProducts').'&id_category="+$(this).val();