From 2e16a1e5d4ef148d162edaaa0d3d1ae53bc7a2ca Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Thu, 21 Nov 2013 11:25:09 +0100 Subject: [PATCH] // Better products attributes list button handle --- .../admin/AdminAttributesGroupsController.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index c49b21642..c21d8af89 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -323,6 +323,8 @@ class AdminAttributesGroupsControllerCore extends AdminController 'class' => 'button' ); + $this->fields_value['id_attribute_group'] = (int)Tools::getValue('id_attribute_group'); + // Override var of Controller $this->table = 'attribute'; $this->className = 'Attribute'; @@ -464,18 +466,18 @@ class AdminAttributesGroupsControllerCore extends AdminController public function initPageHeaderToolbar() { if (empty($this->display)) - { $this->page_header_toolbar_btn['new_attribute_group'] = array( 'href' => self::$currentIndex.'&addattribute_group&token='.$this->token, 'desc' => $this->l('Add new attribute'), 'icon' => 'process-icon-new' ); + + if ($this->display == 'view') $this->page_header_toolbar_btn['new_value'] = array( - 'href' => self::$currentIndex.'&updateattribute&token='.$this->token, + 'href' => self::$currentIndex.'&updateattribute&id_attribute_group='.(int)Tools::getValue('id_attribute_group').'&token='.$this->token, 'desc' => $this->l('Add new value'), 'icon' => 'process-icon-new' ); - } parent::initPageHeaderToolbar(); } @@ -508,6 +510,12 @@ class AdminAttributesGroupsControllerCore extends AdminController ); break; case 'view': + $this->toolbar_btn['newAttributes'] = array( + 'href' => self::$currentIndex.'&updateattribute&id_attribute_group='.(int)Tools::getValue('id_attribute_group').'&token='.$this->token, + 'desc' => $this->l('Add New Values'), + 'class' => 'toolbar-new' + ); + $this->toolbar_btn['back'] = array( 'href' => self::$currentIndex.'&token='.$this->token, 'desc' => $this->l('Back to list') @@ -518,11 +526,6 @@ class AdminAttributesGroupsControllerCore extends AdminController 'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token, 'desc' => $this->l('Add New Attributes') ); - $this->toolbar_btn['newAttributes'] = array( - 'href' => self::$currentIndex.'&updateattribute&token='.$this->token, - 'desc' => $this->l('Add New Values'), - 'class' => 'toolbar-new' - ); } }