// Better products attributes list button handle

This commit is contained in:
Jerome Nadaud
2013-11-21 11:25:09 +01:00
parent fbe7f236cb
commit 2e16a1e5d4
@@ -323,6 +323,8 @@ class AdminAttributesGroupsControllerCore extends AdminController
'class' => 'button' 'class' => 'button'
); );
$this->fields_value['id_attribute_group'] = (int)Tools::getValue('id_attribute_group');
// Override var of Controller // Override var of Controller
$this->table = 'attribute'; $this->table = 'attribute';
$this->className = 'Attribute'; $this->className = 'Attribute';
@@ -464,18 +466,18 @@ class AdminAttributesGroupsControllerCore extends AdminController
public function initPageHeaderToolbar() public function initPageHeaderToolbar()
{ {
if (empty($this->display)) if (empty($this->display))
{
$this->page_header_toolbar_btn['new_attribute_group'] = array( $this->page_header_toolbar_btn['new_attribute_group'] = array(
'href' => self::$currentIndex.'&addattribute_group&token='.$this->token, 'href' => self::$currentIndex.'&addattribute_group&token='.$this->token,
'desc' => $this->l('Add new attribute'), 'desc' => $this->l('Add new attribute'),
'icon' => 'process-icon-new' 'icon' => 'process-icon-new'
); );
if ($this->display == 'view')
$this->page_header_toolbar_btn['new_value'] = array( $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'), 'desc' => $this->l('Add new value'),
'icon' => 'process-icon-new' 'icon' => 'process-icon-new'
); );
}
parent::initPageHeaderToolbar(); parent::initPageHeaderToolbar();
} }
@@ -508,6 +510,12 @@ class AdminAttributesGroupsControllerCore extends AdminController
); );
break; break;
case 'view': 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( $this->toolbar_btn['back'] = array(
'href' => self::$currentIndex.'&token='.$this->token, 'href' => self::$currentIndex.'&token='.$this->token,
'desc' => $this->l('Back to list') 'desc' => $this->l('Back to list')
@@ -518,11 +526,6 @@ class AdminAttributesGroupsControllerCore extends AdminController
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token, 'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add New Attributes') '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'
);
} }
} }