// Fix #PSCFV-4512
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17751 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
|
||||
class AdminTrackingControllerCore extends AdminController
|
||||
{
|
||||
protected $_helper_list;
|
||||
|
||||
public function postprocess()
|
||||
{
|
||||
if (Tools::getValue('id_product') && Tools::isSubmit('statusproduct'))
|
||||
@@ -51,6 +53,8 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$this->_helper_list = new HelperList();
|
||||
|
||||
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
|
||||
$this->warnings[] = $this->l('List of products without available quantities for sale are not displayed because stock management is disabled.');
|
||||
|
||||
@@ -58,7 +62,12 @@ class AdminTrackingControllerCore extends AdminController
|
||||
$tpl_vars['arrayList'] = array();
|
||||
foreach ($methods as $method_name)
|
||||
if (preg_match('#getCustomList(.+)#', $method_name, $matches))
|
||||
{
|
||||
$this->clearListOptions();
|
||||
$this->content .= call_user_func(array($this,$matches[0]));
|
||||
}
|
||||
|
||||
$this->content .= $this->getCustomListProductsDisabled();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'content' => $this->content,
|
||||
@@ -68,14 +77,14 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
public function getCustomListCategoriesEmpty()
|
||||
{
|
||||
$this->clearListOptions();
|
||||
$this->table = 'category';
|
||||
$this->lang = true;
|
||||
$this->className = 'Category';
|
||||
$this->identifier = 'id_category';
|
||||
$this->_orderBy = 'id_category';
|
||||
$this->_orderWay = 'DESC';
|
||||
self::$currentIndex = 'index.php?controller=AdminCategories';
|
||||
$this->token = Tools::getAdminTokenLite('AdminCategories');
|
||||
$this->_list_index = 'index.php?controller=AdminCategories';
|
||||
$this->_list_token = Tools::getAdminTokenLite('AdminCategories');
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
@@ -85,7 +94,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
$this->fields_list = (array(
|
||||
'id_category' => array('title' => $this->l('ID'), 'width' => 50),
|
||||
'name' => array('title' => $this->l('Name')),
|
||||
'name' => array('title' => $this->l('Name'), 'filter_key' => 'b!name'),
|
||||
'description' => array('title' => $this->l('Description')),
|
||||
'active' => array('title' => $this->l('Status'), 'type' => 'bool', 'active' => 'status', 'width' => 50)
|
||||
));
|
||||
@@ -99,7 +108,9 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of empty categories:'));
|
||||
|
||||
return parent::renderList();
|
||||
$this->clearFilters();
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
public function getCustomListProductsAttributesNoStock()
|
||||
@@ -107,14 +118,14 @@ class AdminTrackingControllerCore extends AdminController
|
||||
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
|
||||
return;
|
||||
|
||||
$this->clearListOptions();
|
||||
$this->table = 'product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
$this->_orderWay = 'DESC';
|
||||
self::$currentIndex = 'index.php?controller=AdminProducts';
|
||||
$this->token = Tools::getAdminTokenLite('AdminProducts');
|
||||
$this->className = 'Product';
|
||||
$this->_list_index = 'index.php?controller=AdminProducts';
|
||||
$this->_list_token = Tools::getAdminTokenLite('AdminProducts');
|
||||
$this->show_toolbar = false;
|
||||
|
||||
$this->addRowAction('edit');
|
||||
@@ -123,7 +134,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
$this->fields_list = array(
|
||||
'id_product' => array('title' => $this->l('ID'), 'width' => 50),
|
||||
'reference' => array('title' => $this->l('Reference'), 'width' => 150),
|
||||
'name' => array('title' => $this->l('Name')),
|
||||
'name' => array('title' => $this->l('Name'), 'filter_key' => 'b!name'),
|
||||
'active' => array('title' => $this->l('Status'), 'type' => 'bool', 'active' => 'status', 'width' => 50)
|
||||
);
|
||||
$this->_join = Shop::addSqlAssociation('product', 'a');
|
||||
@@ -140,23 +151,25 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes and without available quantities for sale:'));
|
||||
|
||||
return parent::renderList();
|
||||
$this->clearFilters();
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
public function getCustomListProductsNoStock()
|
||||
{
|
||||
{
|
||||
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
|
||||
return;
|
||||
|
||||
$this->clearListOptions();
|
||||
$this->table = 'product';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->show_toolbar = false;
|
||||
self::$currentIndex = 'index.php?controller=AdminProducts';
|
||||
$this->token = Tools::getAdminTokenLite('AdminProducts');
|
||||
$this->_list_index = 'index.php?controller=AdminProducts';
|
||||
$this->_list_token = Tools::getAdminTokenLite('AdminProducts');
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
@@ -180,24 +193,26 @@ class AdminTrackingControllerCore extends AdminController
|
||||
)';
|
||||
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of products without attributes and without available quantities for sale:'));
|
||||
|
||||
return parent::renderList();
|
||||
|
||||
$this->clearFilters();
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
public function getCustomListProductsDisabled()
|
||||
{
|
||||
$this->clearListOptions();
|
||||
$this->table = 'product';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_filter = 'AND a.`active` = 0';
|
||||
$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;
|
||||
self::$currentIndex = 'index.php?controller=AdminProducts';
|
||||
$this->token = Tools::getAdminTokenLite('AdminProducts');
|
||||
$this->_list_index = 'index.php?controller=AdminProducts';
|
||||
$this->_list_token = Tools::getAdminTokenLite('AdminProducts');
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
@@ -205,11 +220,54 @@ class AdminTrackingControllerCore extends AdminController
|
||||
$this->fields_list = array(
|
||||
'id_product' => array('title' => $this->l('ID'), 'width' => 50),
|
||||
'reference' => array('title' => $this->l('Reference'), 'width' => 150),
|
||||
'name' => array('title' => $this->l('Name'))
|
||||
'name' => array('title' => $this->l('Name'), 'filter_key' => 'b!name')
|
||||
);
|
||||
|
||||
$this->clearFilters();
|
||||
|
||||
$this->_join = Shop::addSqlAssociation('product', 'a');
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->processFilter();
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null)
|
||||
{
|
||||
$this->_helper_list->currentIndex = $this->_list_index;
|
||||
$this->_helper_list->identifier = $this->identifier;
|
||||
$this->_helper_list->table = $this->table;
|
||||
|
||||
return $this->_helper_list->displayEnableLink($this->_list_token, $id, $value, $active, $id_category, $id_product);
|
||||
}
|
||||
|
||||
public function displayDeleteLink($token = null, $id, $name = null)
|
||||
{
|
||||
$this->_helper_list->currentIndex = $this->_list_index;
|
||||
$this->_helper_list->identifier = $this->identifier;
|
||||
$this->_helper_list->table = $this->table;
|
||||
|
||||
return $this->_helper_list->displayDeleteLink($this->_list_token, $id, $name);
|
||||
}
|
||||
|
||||
public function displayEditLink($token = null, $id, $name = null)
|
||||
{
|
||||
$this->_helper_list->currentIndex = $this->_list_index;
|
||||
$this->_helper_list->identifier = $this->identifier;
|
||||
$this->_helper_list->table = $this->table;
|
||||
|
||||
return $this->_helper_list->displayEditLink($this->_list_token, $id, $name);
|
||||
}
|
||||
|
||||
protected function clearFilters()
|
||||
{
|
||||
if ((Tools::isSubmit('submitResetcategory') && $this->table == 'category' ) || (Tools::isSubmit('submitResetproduct') && $this->table == 'product' ))
|
||||
$this->processResetFilters();
|
||||
}
|
||||
|
||||
public function clearListOptions()
|
||||
{
|
||||
@@ -221,8 +279,14 @@ class AdminTrackingControllerCore extends AdminController
|
||||
$this->_orderWay = '';
|
||||
$this->_filter = '';
|
||||
$this->_group = '';
|
||||
$this->_where = '';
|
||||
$this->list_no_filter = true;
|
||||
$this->list_title = $this->l('Product disabled');
|
||||
}
|
||||
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user