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' - ); } }