From 0c1b77b3da26829746a23242247b4d8bdc23deb5 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Wed, 6 Nov 2013 12:18:52 +0100 Subject: [PATCH] // Fix Combinations list actions button problem --- classes/helper/HelperList.php | 8 +++++--- controllers/admin/AdminProductsController.php | 1 + js/admin-products.js | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index b3e39de51..8c6266710 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -64,6 +64,8 @@ class HelperListCore extends Helper public $position_identifier; + public $table_id; + /** * @var string Customize list display * @@ -536,8 +538,8 @@ class HelperListCore extends Helper isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null ); - if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1)) - $table_id = substr($this->identifier, 3, strlen($this->identifier)); + if (!isset($this->table_id) && $this->position_identifier && (int)Tools::getValue($this->position_identifier, 1)) + $this->table_id = substr($this->identifier, 3, strlen($this->identifier)); if ($this->position_identifier && ($this->orderBy == 'position' && $this->orderWay != 'DESC')) $table_dnd = true; @@ -628,7 +630,7 @@ class HelperListCore extends Helper 'id_cat' => $id_cat, 'shop_link_type' => $this->shopLinkType, 'has_actions' => !empty($this->actions), - 'table_id' => isset($table_id) ? $table_id : null, + 'table_id' => isset($this->table_id) ? $this->table_id : null, 'table_dnd' => isset($table_dnd) ? $table_dnd : null, 'name' => isset($name) ? $name : null, 'name_id' => isset($name_id) ? $name_id : null, diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 4863909a6..3c5bdae86 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3883,6 +3883,7 @@ class AdminProductsControllerCore extends AdminController $helper = new HelperList(); $helper->identifier = 'id_product_attribute'; + $helper->table_id = 'combinations-list'; $helper->token = $this->token; $helper->currentIndex = self::$currentIndex; $helper->no_link = true; diff --git a/js/admin-products.js b/js/admin-products.js index c7c3c4ce4..d2bb9d835 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -35,7 +35,7 @@ product_tabs['Customization'] = new function(){ product_tabs['Combinations'] = new function(){ var self = this; this.bindEdit = function(){ - $('table[name=list_table]').delegate('a.edit', 'click', function(e){ + $('table[id=combinations-list]').delegate('a.edit', 'click', function(e){ e.preventDefault(); editProductAttribute(this.href, $(this).closest('tr')); }); @@ -143,7 +143,7 @@ product_tabs['Combinations'] = new function(){ }; this.bindDefault = function(){ - $('table[name=list_table]').delegate('a.default', 'click', function(e){ + $('table[id=combinations-list]').delegate('a.default', 'click', function(e){ e.preventDefault(); console.log('ok'); self.defaultProductAttribute(this.href, this); @@ -175,7 +175,7 @@ product_tabs['Combinations'] = new function(){ }; this.bindDelete = function() { - $('table[name=list_table]').delegate('a.delete', 'click', function(e){ + $('table[id=combinations-list]').delegate('a.delete', 'click', function(e){ e.preventDefault(); self.deleteProductAttribute(this.href, $(this).closest('tr')); });