Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
@@ -27,8 +27,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('table.{$table} .filter').keypress(function(event){
|
||||
formSubmit(event, 'submitFilterButton{$table}')
|
||||
$('table.{$list_id} .filter').keypress(function(event){
|
||||
formSubmit(event, 'submitFilterButton{$list_id}')
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@@ -37,7 +37,7 @@
|
||||
<script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script>
|
||||
<script type="text/javascript">
|
||||
var token = '{$token}';
|
||||
var come_from = '{$table}';
|
||||
var come_from = '{$list_id}';
|
||||
var alternate = {if $order_way == 'DESC'}'1'{else}'0'{/if};
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/admin-dnd.js"></script>
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
if ($("table.{$table} .datepicker").length > 0)
|
||||
$("table.{$table} .datepicker").datepicker({
|
||||
if ($("table.{$list_id} .datepicker").length > 0)
|
||||
$("table.{$list_id} .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd'
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
{block name="override_form_extra"}{/block}
|
||||
|
||||
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
|
||||
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/>
|
||||
{/if}
|
||||
<table class="table_grid" name="list_table">
|
||||
{if !$simple_header}
|
||||
@@ -91,16 +91,16 @@
|
||||
<td style="vertical-align: bottom;">
|
||||
<span style="float: left;">
|
||||
{if $page > 1}
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$table}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$table}').value={$page - 1}"/>
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$list_id}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$list_id}').value={$page - 1}"/>
|
||||
{/if}
|
||||
{l s='Page'} <b>{$page}</b> / {$total_pages}
|
||||
{if $page < $total_pages}
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$table}').value={$page + 1}"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$table}').value={$total_pages}"/>
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$list_id}').value={$page + 1}"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$list_id}').value={$total_pages}"/>
|
||||
{/if}
|
||||
| {l s='Display'}
|
||||
<select name="pagination" onchange="submit()">
|
||||
<select name="{$list_id}_pagination" onchange="submit()">
|
||||
{* Choose number of results per page *}
|
||||
{foreach $pagination AS $value}
|
||||
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
|
||||
@@ -109,8 +109,8 @@
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
</span>
|
||||
<span style="float: right;">
|
||||
<input type="submit" name="submitReset{$table}" value="{l s='Reset'}" class="button" />
|
||||
<input type="submit" id="submitFilterButton{$table}" name="submitFilter" value="{l s='Filter'}" class="button" />
|
||||
<input type="submit" name="submitReset{$list_id}" value="{l s='Reset'}" class="button" />
|
||||
<input type="submit" id="submitFilterButton{$list_id}" name="submitFilter" value="{l s='Filter'}" class="button" />
|
||||
</span>
|
||||
<span class="clear"></span>
|
||||
</td>
|
||||
@@ -120,7 +120,7 @@
|
||||
<td{if $simple_header} style="border:none;"{/if}>
|
||||
<table
|
||||
{if $table_id} id={$table_id}{/if}
|
||||
class="table {if $table_dnd}tableDnD{/if} {$table}"
|
||||
class="table {if $table_dnd}tableDnD{/if} {$list_id}"
|
||||
cellpadding="0" cellspacing="0"
|
||||
style="width: 100%; margin-bottom:10px;">
|
||||
<col width="10px" />
|
||||
@@ -137,7 +137,7 @@
|
||||
<tr class="nodrag nodrop" style="height: 40px">
|
||||
<th class="center">
|
||||
{if $has_bulk_actions}
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$list_id}Box[]', this.checked)" />
|
||||
{/if}
|
||||
</th>
|
||||
{foreach $fields_display AS $key => $params}
|
||||
@@ -148,9 +148,9 @@
|
||||
</span>
|
||||
{if (!isset($params.orderby) || $params.orderby) && !$simple_header}
|
||||
<br />
|
||||
<a href="{$currentIndex}&{$table}Orderby={$key|urlencode}&{$table}Orderway=desc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<a href="{$currentIndex}&{$list_id}Orderby={$key|urlencode}&{$list_id}Orderway=desc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<img border="0" src="../img/admin/down{if isset($order_by) && ($key == $order_by) && ($order_way == 'DESC')}_d{/if}.gif" /></a>
|
||||
<a href="{$currentIndex}&{$table}Orderby={$key|urlencode}&{$table}Orderway=asc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<a href="{$currentIndex}&{$list_id}Orderby={$key|urlencode}&{$list_id}Orderway=asc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<img border="0" src="../img/admin/up{if isset($order_by) && ($key == $order_by) && ($order_way == 'ASC')}_d{/if}.gif" /></a>
|
||||
{elseif !$simple_header}
|
||||
<br />
|
||||
@@ -186,7 +186,7 @@
|
||||
--
|
||||
{else}
|
||||
{if $params.type == 'bool'}
|
||||
<select onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$key}">
|
||||
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$key}">
|
||||
<option value="">--</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
@@ -196,7 +196,7 @@
|
||||
{l s='To'} <input type="text" class="filter datepicker" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}"{if isset($params.width)} style="width:70px"{/if}/>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>--</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
@@ -206,7 +206,7 @@
|
||||
</select>
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" class="filter" name="{$table}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'htmlall':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{else}style="width:95%"{/if} />
|
||||
<input type="text" class="filter" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'htmlall':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{else}style="width:95%"{/if} />
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
+8
-8
@@ -134,6 +134,7 @@ class CartCore extends ObjectModel
|
||||
'cart_rows' => array('resource' => 'cart_row', 'virtual_entity' => true, 'fields' => array(
|
||||
'id_product' => array('required' => true, 'xlink_resource' => 'products'),
|
||||
'id_product_attribute' => array('required' => true, 'xlink_resource' => 'combinations'),
|
||||
'id_address_delivery' => array('required' => true, 'xlink_resource' => 'addresses'),
|
||||
'quantity' => array('required' => true),
|
||||
)
|
||||
),
|
||||
@@ -3212,25 +3213,24 @@ class CartCore extends ObjectModel
|
||||
|
||||
public function getWsCartRows()
|
||||
{
|
||||
$query = '
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT id_product, id_product_attribute, quantity
|
||||
FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE id_cart = '.(int)$this->id.'
|
||||
AND id_shop = '.(int)Context::getContext()->shop->id;
|
||||
|
||||
$result = Db::getInstance()->executeS($query);
|
||||
return $result;
|
||||
WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id
|
||||
);
|
||||
}
|
||||
|
||||
public function setWsCartRows($values)
|
||||
{
|
||||
if ($this->deleteAssociations())
|
||||
{
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `quantity`, `date_add`, `id_shop`) VALUES ';
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `id_address_delivery`, `quantity`, `date_add`, `id_shop`) VALUES ';
|
||||
|
||||
foreach ($values as $value)
|
||||
$query .= '('.(int)$this->id.', '.(int)$value['id_product'].', '.
|
||||
(isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '.(int)$value['quantity'].', NOW(), '.(int)Context::getContext()->shop->id.'),';
|
||||
(isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '.
|
||||
(isset($value['id_address_delivery']) ? (int)$value['id_address_delivery'] : 0).', '.
|
||||
(int)$value['quantity'].', NOW(), '.(int)Context::getContext()->shop->id.'),';
|
||||
|
||||
Db::getInstance()->execute(rtrim($query, ','));
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ class AdminControllerCore extends Controller
|
||||
/** @var string Associated table name */
|
||||
public $table;
|
||||
|
||||
public $list_id;
|
||||
|
||||
/** @var string Object identifier inside the associated table */
|
||||
protected $identifier = false;
|
||||
|
||||
@@ -462,29 +464,33 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function processFilter()
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
|
||||
// Filter memorization
|
||||
if (isset($_POST) && !empty($_POST) && isset($this->table))
|
||||
if (isset($_POST) && !empty($_POST) && isset($this->list_id))
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if (stripos($key, $this->table.'Filter_') === 0)
|
||||
if (stripos($key, $this->list_id.'Filter_') === 0)
|
||||
$this->context->cookie->{$prefix.$key} = !is_array($value) ? $value : serialize($value);
|
||||
elseif(stripos($key, 'submitFilter') === 0)
|
||||
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
|
||||
if (isset($_GET) && !empty($_GET) && isset($this->table))
|
||||
if (isset($_GET) && !empty($_GET) && isset($this->list_id))
|
||||
foreach ($_GET as $key => $value)
|
||||
if (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
|
||||
if (stripos($key, $this->list_id.'OrderBy') === 0 || stripos($key, $this->list_id.'Orderway') === 0)
|
||||
$this->context->cookie->{$prefix.$key} = $value;
|
||||
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->list_id.'Filter_');
|
||||
|
||||
foreach ($filters as $key => $value)
|
||||
{
|
||||
/* Extracting filters from $_POST on key filter_ */
|
||||
if ($value != null && !strncmp($key, $prefix.$this->table.'Filter_', 7 + Tools::strlen($prefix.$this->table)))
|
||||
if ($value != null && !strncmp($key, $prefix.$this->list_id.'Filter_', 7 + Tools::strlen($prefix.$this->list_id)))
|
||||
{
|
||||
$key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->table));
|
||||
$key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->list_id));
|
||||
/* Table alias could be specified using a ! eg. alias!field */
|
||||
$tmp_tab = explode('!', $key);
|
||||
$filter = count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0];
|
||||
@@ -920,30 +926,32 @@ class AdminControllerCore extends Controller
|
||||
/**
|
||||
* Cancel all filters for this tab
|
||||
*/
|
||||
public function processResetFilters()
|
||||
public function processResetFilters($list_id = null)
|
||||
{
|
||||
if (!isset($list_id))
|
||||
$list_id = isset($this->list_id) ? $this->list_id : $this->table;
|
||||
|
||||
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
|
||||
$filters = $this->context->cookie->getFamily($prefix.$list_id.'Filter_');
|
||||
|
||||
foreach ($filters as $cookie_key => $filter)
|
||||
if (strncmp($cookie_key, $prefix.$this->table.'Filter_', 7 + Tools::strlen($prefix.$this->table)) == 0)
|
||||
if (strncmp($cookie_key, $prefix.$list_id.'Filter_', 7 + Tools::strlen($prefix.$list_id)) == 0)
|
||||
{
|
||||
$key = substr($cookie_key, 7 + Tools::strlen($prefix.$this->table));
|
||||
/* Table alias could be specified using a ! eg. alias!field */
|
||||
$tmp_tab = explode('!', $key);
|
||||
$key = (count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0]);
|
||||
$key = substr($cookie_key, 7 + Tools::strlen($prefix.$list_id));
|
||||
|
||||
if (is_array($this->fields_list) && array_key_exists($key, $this->fields_list))
|
||||
$this->context->cookie->$cookie_key = null;
|
||||
unset($this->context->cookie->$cookie_key);
|
||||
}
|
||||
|
||||
if (isset($this->context->cookie->{'submitFilter'.$this->table}))
|
||||
unset($this->context->cookie->{'submitFilter'.$this->table});
|
||||
if (isset($this->context->cookie->{'submitFilter'.$list_id}))
|
||||
unset($this->context->cookie->{'submitFilter'.$list_id});
|
||||
|
||||
if (isset($this->context->cookie->{$prefix.$this->table.'Orderby'}))
|
||||
unset($this->context->cookie->{$prefix.$this->table.'Orderby'});
|
||||
if (isset($this->context->cookie->{$prefix.$list_id.'Orderby'}))
|
||||
unset($this->context->cookie->{$prefix.$list_id.'Orderby'});
|
||||
|
||||
if (isset($this->context->cookie->{$prefix.$this->table.'Orderway'}))
|
||||
unset($this->context->cookie->{$prefix.$this->table.'Orderway'});
|
||||
if (isset($this->context->cookie->{$prefix.$list_id.'Orderway'}))
|
||||
unset($this->context->cookie->{$prefix.$list_id.'Orderway'});
|
||||
|
||||
unset($_POST);
|
||||
$this->_filter = false;
|
||||
@@ -1721,6 +1729,7 @@ class AdminControllerCore extends Controller
|
||||
$helper->row_hover = $this->row_hover;
|
||||
$helper->position_identifier = $this->position_identifier;
|
||||
$helper->controller_name = $this->controller_name;
|
||||
$helper->list_id = isset($this->list_id) ? $this->list_id : $this->table;
|
||||
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->list_skip_actions = $this->list_skip_actions;
|
||||
@@ -1915,11 +1924,14 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
// Manage list filtering
|
||||
if (Tools::isSubmit('submitFilter'.$this->table)
|
||||
|| $this->context->cookie->{'submitFilter'.$this->table} !== false
|
||||
|| Tools::getValue($this->table.'Orderby')
|
||||
|| Tools::getValue($this->table.'Orderway'))
|
||||
if (Tools::isSubmit('submitFilter'.$this->list_id)
|
||||
|| $this->context->cookie->{'submitFilter'.$this->list_id} !== false
|
||||
|| Tools::getValue($this->list_id.'Orderby')
|
||||
|| Tools::getValue($this->list_id.'Orderway'))
|
||||
$this->filter = true;
|
||||
|
||||
$this->id_object = (int)Tools::getValue($this->identifier);
|
||||
@@ -2021,7 +2033,7 @@ class AdminControllerCore extends Controller
|
||||
$this->action = 'export';
|
||||
}
|
||||
/* Cancel all filters for this tab */
|
||||
elseif (isset($_POST['submitReset'.$this->table]))
|
||||
elseif (isset($_POST['submitReset'.$this->list_id]))
|
||||
$this->action = 'reset_filters';
|
||||
/* Submit options list */
|
||||
elseif (Tools::getValue('submitOptions'.$this->table) || Tools::getValue('submitOptions'))
|
||||
@@ -2075,14 +2087,17 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
/* Manage default params values */
|
||||
$use_limit = true;
|
||||
if ($limit === false)
|
||||
$use_limit = false;
|
||||
elseif (empty($limit))
|
||||
{
|
||||
if (isset($this->context->cookie->{$this->table.'_pagination'}) && $this->context->cookie->{$this->table.'_pagination'})
|
||||
$limit = $this->context->cookie->{$this->table.'_pagination'};
|
||||
if (isset($this->context->cookie->{$this->list_id.'_pagination'}) && $this->context->cookie->{$this->list_id.'_pagination'})
|
||||
$limit = $this->context->cookie->{$this->list_id.'_pagination'};
|
||||
else
|
||||
$limit = $this->_pagination[1];
|
||||
}
|
||||
@@ -2092,8 +2107,8 @@ class AdminControllerCore extends Controller
|
||||
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
|
||||
if (empty($order_by))
|
||||
{
|
||||
if ($this->context->cookie->{$prefix.$this->table.'Orderby'})
|
||||
$order_by = $this->context->cookie->{$prefix.$this->table.'Orderby'};
|
||||
if ($this->context->cookie->{$prefix.$this->list_id.'Orderby'})
|
||||
$order_by = $this->context->cookie->{$prefix.$this->list_id.'Orderby'};
|
||||
elseif ($this->_orderBy)
|
||||
$order_by = $this->_orderBy;
|
||||
else
|
||||
@@ -2102,16 +2117,16 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if (empty($order_way))
|
||||
{
|
||||
if ($this->context->cookie->{$prefix.$this->table.'Orderway'})
|
||||
$order_way = $this->context->cookie->{$prefix.$this->table.'Orderway'};
|
||||
if ($this->context->cookie->{$prefix.$this->list_id.'Orderway'})
|
||||
$order_way = $this->context->cookie->{$prefix.$this->list_id.'Orderway'};
|
||||
elseif ($this->_orderWay)
|
||||
$order_way = $this->_orderWay;
|
||||
else
|
||||
$order_way = $this->_defaultOrderWay;
|
||||
}
|
||||
|
||||
$limit = (int)Tools::getValue('pagination', $limit);
|
||||
$this->context->cookie->{$this->table.'_pagination'} = $limit;
|
||||
$limit = (int)Tools::getValue($this->list_id.'_pagination', $limit);
|
||||
$this->context->cookie->{$this->list_id.'_pagination'} = $limit;
|
||||
|
||||
/* Check params validity */
|
||||
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)
|
||||
@@ -2123,12 +2138,12 @@ class AdminControllerCore extends Controller
|
||||
$order_by = $this->fields_list[$order_by]['filter_key'];
|
||||
|
||||
/* Determine offset from current page */
|
||||
if ((isset($_POST['submitFilter'.$this->table]) ||
|
||||
isset($_POST['submitFilter'.$this->table.'_x']) ||
|
||||
isset($_POST['submitFilter'.$this->table.'_y'])) &&
|
||||
!empty($_POST['submitFilter'.$this->table]) &&
|
||||
is_numeric($_POST['submitFilter'.$this->table]))
|
||||
$start = ((int)$_POST['submitFilter'.$this->table] - 1) * $limit;
|
||||
if ((isset($_POST['submitFilter'.$this->list_id]) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_x']) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_y'])) &&
|
||||
!empty($_POST['submitFilter'.$this->list_id]) &&
|
||||
is_numeric($_POST['submitFilter'.$this->list_id]))
|
||||
$start = ((int)$_POST['submitFilter'.$this->list_id] - 1) * $limit;
|
||||
|
||||
/* Cache */
|
||||
$this->_lang = (int)$id_lang;
|
||||
|
||||
@@ -486,18 +486,21 @@ class HelperListCore extends Helper
|
||||
*/
|
||||
public function displayListHeader()
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
$id_cat = (int)Tools::getValue('id_'.($this->is_cms ? 'cms_' : '').'category');
|
||||
|
||||
if (!isset($token) || empty($token))
|
||||
$token = $this->token;
|
||||
|
||||
/* Determine total page number */
|
||||
if (isset($this->context->cookie->{$this->table.'_pagination'}) && $this->context->cookie->{$this->table.'_pagination'})
|
||||
$default_pagination = $this->context->cookie->{$this->table.'_pagination'};
|
||||
if (isset($this->context->cookie->{$this->list_id.'_pagination'}) && $this->context->cookie->{$this->list_id.'_pagination'})
|
||||
$default_pagination = $this->context->cookie->{$this->list_id.'_pagination'};
|
||||
else
|
||||
$default_pagination = $this->_pagination[0];
|
||||
|
||||
$total_pages = ceil($this->listTotal / Tools::getValue('pagination', ($default_pagination)));
|
||||
$total_pages = ceil($this->listTotal / Tools::getValue($this->list_id.'_pagination', ($default_pagination)));
|
||||
|
||||
if (!$total_pages)
|
||||
$total_pages = 1;
|
||||
@@ -510,14 +513,13 @@ class HelperListCore extends Helper
|
||||
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table;
|
||||
|
||||
/* Determine current page number */
|
||||
$page = (int)Tools::getValue('submitFilter'.$this->table);
|
||||
$page = (int)Tools::getValue('submitFilter'.$this->list_id);
|
||||
if (!$page)
|
||||
$page = 1;
|
||||
|
||||
/* Choose number of results per page */
|
||||
$selected_pagination = Tools::getValue(
|
||||
'pagination',
|
||||
isset($this->context->cookie->{$this->table.'_pagination'}) ? $this->context->cookie->{$this->table.'_pagination'} : null
|
||||
$selected_pagination = Tools::getValue($this->list_id.'_pagination',
|
||||
isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null
|
||||
);
|
||||
|
||||
// Cleaning links
|
||||
@@ -535,7 +537,7 @@ class HelperListCore extends Helper
|
||||
{
|
||||
if (!isset($params['type']))
|
||||
$params['type'] = 'text';
|
||||
$value = Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.(array_key_exists('filter_key', $params) && $key != 'active' ? $params['filter_key'] : $key)};
|
||||
$value = Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.(array_key_exists('filter_key', $params) && $key != 'active' ? $params['filter_key'] : $key)};
|
||||
switch ($params['type'])
|
||||
{
|
||||
case 'bool':
|
||||
@@ -547,7 +549,7 @@ class HelperListCore extends Helper
|
||||
$value = Tools::unSerialize($value);
|
||||
if (!Validate::isCleanHtml($value[0]) || !Validate::isCleanHtml($value[1]))
|
||||
$value = '';
|
||||
$name = $this->table.'Filter_'.(isset($params['filter_key']) ? $params['filter_key'] : $key);
|
||||
$name = $this->list_id.'Filter_'.(isset($params['filter_key']) ? $params['filter_key'] : $key);
|
||||
$name_id = str_replace('!', '__', $name);
|
||||
|
||||
$params['id_date'] = $name_id;
|
||||
@@ -559,9 +561,9 @@ class HelperListCore extends Helper
|
||||
case 'select':
|
||||
foreach ($params['list'] as $option_value => $option_display)
|
||||
{
|
||||
if (isset(Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.$params['filter_key']})
|
||||
&& Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.$params['filter_key']} == $option_value
|
||||
&& Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.$params['filter_key']} != '')
|
||||
if (isset(Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']})
|
||||
&& Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']} == $option_value
|
||||
&& Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']} != '')
|
||||
$this->fields_list[$key]['select'][$option_value]['selected'] = 'selected';
|
||||
}
|
||||
break;
|
||||
@@ -605,6 +607,7 @@ class HelperListCore extends Helper
|
||||
'name' => isset($name) ? $name : null,
|
||||
'name_id' => isset($name_id) ? $name_id : null,
|
||||
'row_hover' => $this->row_hover,
|
||||
'list_id' => isset($this->list_id) ? $this->list_id : $this->table
|
||||
)));
|
||||
|
||||
return $this->header_tpl->fetch();
|
||||
|
||||
@@ -77,6 +77,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
public function getCustomListCategoriesEmpty()
|
||||
{
|
||||
$this->table = 'category';
|
||||
$this->list_id = 'empty_categories';
|
||||
$this->lang = true;
|
||||
$this->className = 'Category';
|
||||
$this->identifier = 'id_category';
|
||||
@@ -119,6 +120,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
return;
|
||||
|
||||
$this->table = 'product';
|
||||
$this->list_id = 'no_stock_products_attributes';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
@@ -163,6 +165,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
return;
|
||||
|
||||
$this->table = 'product';
|
||||
$this->list_id = 'no_stock_products';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
@@ -203,13 +206,13 @@ class AdminTrackingControllerCore extends AdminController
|
||||
public function getCustomListProductsDisabled()
|
||||
{
|
||||
$this->table = 'product';
|
||||
$this->list_id = 'disabled_products';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_filter = 'AND product_shop.`active` = 0';
|
||||
$this->list_no_filter = true;
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of disabled products:'));
|
||||
$this->show_toolbar = false;
|
||||
$this->_list_index = 'index.php?controller=AdminProducts';
|
||||
@@ -266,8 +269,17 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
protected function clearFilters()
|
||||
{
|
||||
if ((Tools::isSubmit('submitResetcategory') && $this->table == 'category' ) || (Tools::isSubmit('submitResetproduct') && $this->table == 'product' ))
|
||||
$this->processResetFilters();
|
||||
if (Tools::isSubmit('submitResetcategory'))
|
||||
$this->processResetFilters('empty_categories');
|
||||
|
||||
if (Tools::isSubmit('submitResetproduct'))
|
||||
$this->processResetFilters('no_stock_products_attributes');
|
||||
|
||||
if (Tools::isSubmit('submitResetno_stock_products'))
|
||||
$this->processResetFilters('no_stock_products');
|
||||
|
||||
if (Tools::isSubmit('submitResetdisabled_products'))
|
||||
$this->processResetFilters('disabled_products');
|
||||
}
|
||||
|
||||
public function clearListOptions()
|
||||
@@ -281,7 +293,6 @@ class AdminTrackingControllerCore extends AdminController
|
||||
$this->_filter = '';
|
||||
$this->_group = '';
|
||||
$this->_where = '';
|
||||
$this->list_no_filter = true;
|
||||
$this->list_title = $this->l('Product disabled');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user