// Added toolbar to AdminModulesPositions and added full products list on AdminProducts
This commit is contained in:
@@ -29,7 +29,20 @@
|
||||
var come_from = 'AdminModulesPositions';
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/admin-dnd.js"></script>
|
||||
<a href="{$url_transplant}"><img src="../img/admin/add.gif" border="0" /> <b>{l s='Transplant a module'}</b></a><br /><br />
|
||||
|
||||
{if $show_toolbar}
|
||||
<div class="toolbar-placeholder">
|
||||
<div class="toolbarBox {if $toolbar_fix}toolbarHead{/if}">
|
||||
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
|
||||
<div class="pageTitle">
|
||||
<h3>{block name=pageTitle}
|
||||
<span id="current_obj" style="font-weight: normal;">{$title|default:' '}</span>
|
||||
{/block}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<form>
|
||||
{l s='Show'} :
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
{extends file="helper/list/list_header.tpl"}
|
||||
{block name=leadin}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#go_to_categ').bind('change', function(){
|
||||
var base_url = '{$base_url}';
|
||||
if (this.value !== "")
|
||||
location.href = base_url + '&id_category=' + parseInt(this.value);
|
||||
else
|
||||
location.href = base_url;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{l s='Go to category:'}
|
||||
<select id="go_to_categ" name="go_to_categ">
|
||||
{foreach from=$category_tree item=categ}
|
||||
<option value="{$categ->id}" {if $categ->selected}selected="selected"{/if} >
|
||||
{$categ->dashes}{$categ->name} ({$categ->id})
|
||||
{$categ->dashes}{$categ->name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @author PrestaShop SA <contact@prestashop.com>o
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7466 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
@@ -224,11 +224,16 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
else
|
||||
$this->content .= $this->initMain();
|
||||
|
||||
$this->context->smarty->assign(array('content' => $this->content));
|
||||
$this->context->smarty->assign(array(
|
||||
'content' => $this->content
|
||||
));
|
||||
}
|
||||
|
||||
public function initMain()
|
||||
{
|
||||
// Init toolbar
|
||||
$this->initToolbarTitle();
|
||||
|
||||
$admin_dir = basename(_PS_ADMIN_DIR_);
|
||||
$modules = Module::getModulesInstalled();
|
||||
|
||||
@@ -256,8 +261,16 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
|
||||
$this->addJqueryPlugin("tablednd");
|
||||
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'href' => self::$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token,
|
||||
'desc' => $this->l('Transplant a module')
|
||||
);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'url_transplant' => self::$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token,
|
||||
'show_toolbar' => true,
|
||||
'toolbar_btn' => $this->toolbar_btn,
|
||||
'title' => $this->toolbar_title,
|
||||
'toolbar_fix' => 'false',
|
||||
'token' => $this->token,
|
||||
'url_show_modules' => self::$currentIndex.'&token='.$this->token.'&show_modules=',
|
||||
'modules' => $module_instances,
|
||||
@@ -276,6 +289,8 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
// Init toolbar
|
||||
$this->initToolbarTitle();
|
||||
// toolbar (save, cancel, new, ..)
|
||||
$this->initToolbar();
|
||||
$id_module = (int)(Tools::getValue('id_module'));
|
||||
@@ -343,6 +358,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
'modules' => $modules,
|
||||
'show_toolbar' => true,
|
||||
'toolbar_btn' => $this->toolbar_btn,
|
||||
'title' => $this->toolbar_title,
|
||||
'table' => 'hook_module',
|
||||
));
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($id_category = Tools::getvalue('id_category'))
|
||||
$this->_category = new Category($id_category);
|
||||
else
|
||||
$this->_category = new Category(1);
|
||||
$this->_category = new Category();
|
||||
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang`)
|
||||
@@ -91,7 +91,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
|
||||
$this->_filter = 'AND cp.`id_category` = '.(int)$this->_category->id;
|
||||
|
||||
// if no category selected, display all products
|
||||
if (Validate::isLoadedObject($this->_category))
|
||||
$this->_filter = 'AND cp.`id_category` = '.(int)$this->_category->id;
|
||||
|
||||
$this->_select = 'cl.name `name_category`, cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final';
|
||||
|
||||
parent::__construct();
|
||||
@@ -1606,7 +1610,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$this->display = 'list';
|
||||
if ($id_category = (int)Tools::getValue('id_category'))
|
||||
AdminController::$currentIndex .= '&id_category='.$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);
|
||||
@@ -1617,6 +1621,19 @@ class AdminProductsControllerCore extends AdminController
|
||||
$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);
|
||||
@@ -1625,12 +1642,22 @@ class AdminProductsControllerCore extends AdminController
|
||||
$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;
|
||||
}
|
||||
// @todo module free
|
||||
$this->tpl_form_vars['vat_number'] = file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php');
|
||||
parent::initContent();
|
||||
}
|
||||
|
||||
public function initList()
|
||||
{
|
||||
if (!Tools::getValue('id_category'))
|
||||
unset($this->fieldsDisplay['position']);
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function ajaxProcessProductManufacturers()
|
||||
{
|
||||
$manufacturers = Manufacturer::getManufacturers();
|
||||
@@ -1643,26 +1670,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* displayList show ordered list of current category
|
||||
*
|
||||
* @param mixed $token
|
||||
* @return void
|
||||
*/
|
||||
public function displayList($token = null)
|
||||
{
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
// $this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
|
||||
|
||||
/* Show the content of the table */
|
||||
$this->displayListContent($token);
|
||||
|
||||
/* Close list table and submit button */
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a categories tree
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user