Prestashop Provide many buttons Like Save,Add,Back To list etc button in toolbar,
we also add some of your custome button to in toolbar
some step to create custom button in toolbar
1 . Create the function
public function initToolbar() { }
2. add this line
$this->toolbar_btn['button_name'] = array( 'desc' => $this->l('display button name'), 'href' =>'write your href where this link has been landed' ); public function initToolbar() { $this->toolbar_btn['button_name'] = array( 'desc' => $this->l('display button name'), 'href' =>'write your href where this link has been landed' ); }
3. add return $this->toolbar_btn; in last of the function
public function initToolbar() { $this->toolbar_btn['button_name'] = array( 'desc' => $this->l('display button name'), 'href' =>'write your href where this link has been landed' ); $this->toolbar_btn; }
4. we also add java-script function like “onclick,window.open()” for example prestashop provide help button on toolbar if you want to display help button then you need to add help button within the function initToolbar.
example : –
public function initToolbar() { $this->toolbar_btn['help'] = array( 'desc' => $this->l('Help'), 'js' => 'window.open(\''.self::$currentIndex.' &add'.$this->table.'&token='.$this->token.'\',\''.'popupwindow \''.', \''.'width=500\',\'height=500\',\'scrollbars\',\'resizable\');', ); return $this->toolbar_btn; }
where js help to create “onclick” event and window.open help to open file in popup window
Be the first to comment.