- Posts: 5
- Thank you received: 0
Add button after email/invoice/shipping invoice
10 years 3 months ago #244447
by dzseti
Add button after email/invoice/shipping invoice was created by dzseti
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6.22-0+deb8u1
-- Browser(s) name and version -- : Firefox
Is there an easy way to add a new button at the backend in toolbar after the default email/invoice/shipping invoice buttons on the order view page?
I would like to set up a third document for printing (in addition to invoice and shipping invoice).
Would the third document be customisable through the Views section?
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6.22-0+deb8u1
-- Browser(s) name and version -- : Firefox
Is there an easy way to add a new button at the backend in toolbar after the default email/invoice/shipping invoice buttons on the order view page?
I would like to set up a third document for printing (in addition to invoice and shipping invoice).
Would the third document be customisable through the Views section?
Please Log in or Create an account to join the conversation.
10 years 3 months ago #244461
by nicolas
Replied by nicolas on topic Add button after email/invoice/shipping invoice
Hi,
Adding a button in the toolbar can be done by creating a small plugin of the group HikaShop implementing the onHikashopBeforeDisplayView function trigger, with something like that:
This will also open a popup with the same content as the one when you click on "invoice" but with an extra parameter "custom" set to 1.
So then, you can edit the file "invoice" of the view "order" via the menu Display>Views and use such check in there to have your custom text for that new button:
Adding a button in the toolbar can be done by creating a small plugin of the group HikaShop implementing the onHikashopBeforeDisplayView function trigger, with something like that:
Code:
function onHikashopBeforeDisplayView(&$view){
if($view->ctrl != 'product' || $view->task != 'show') return;
$this->toolbar[] = array('name' => 'Popup', 'icon' => 'send', 'id' => 'send', 'alt' => JText::_('HIKA_EMAIL'), 'url' => 'index.php?option=com_hikashop&ctrl=order&task=invoice&tmpl=component&type=full&order_id='.$order_id.'&custom=1', 'width' => 720);
}
So then, you can edit the file "invoice" of the view "order" via the menu Display>Views and use such check in there to have your custom text for that new button:
Code:
if(@$_GET['custom']){
// echo my popup content
}else{
// echo when it's an invoice
}
The following user(s) said Thank You: dzseti
Please Log in or Create an account to join the conversation.
10 years 3 months ago - 10 years 3 months ago #244606
by dzseti
Replied by dzseti on topic Add button after email/invoice/shipping invoice
I had to make some changes to the code ($view is an object from two classes and in each context its properties are different):
Code:
function onHikashopBeforeDisplayView(&$view) {
if (get_class($view) != 'OrderViewOrder') return;
if ($view->ctrl != 'order') return; // probably redundant
$view->toolbar[] = array(
'name' => 'Popup',
'icon' => 'invoice',
'id' => 'invoice2',
'alt' => 'INVOICE2',
'url' => 'index.php?option=com_hikashop&ctrl=order&task=invoice&tmpl=component&type=full&order_id=' . $view->order->order_id . '&custom=1',
'width' => 720);
}
Last edit: 10 years 3 months ago by dzseti. Reason: Tidying up
Please Log in or Create an account to join the conversation.
Time to create page: 0.194 seconds