Back to Top

Prestashop Showing custom buttons in toolbar

Updated 16 July 2021

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

Searching for an experienced
Prestashop Company ?
Find out More
$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

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home