[Skip to main content](#vessel-content)

#   Add button after email/invoice/shipping invoice

##

- **[dzseti](/forum/user/42791-dzseti "View dzseti's Profile")**
- [![dzseti's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/42791-dzseti "View dzseti's Profile") Topic Author
- [ Offline](/forum/user/42791-dzseti)

Less More

- Posts: 5
- Thank you received: 0
-
-

10 years 4 months ago [\#244447](#244447) by [dzseti](/forum/user/42791-dzseti "View dzseti's Profile")  *[Add button after email/invoice/shipping invoice](/forum/35-orders-management/885356-add-button-after-email-invoice-shipping-invoice#244447 "-- 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?")* was created by *[dzseti](/forum/user/42791-dzseti "View dzseti's Profile")*

-- 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?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg4NTM1Ni1hZGQtYnV0dG9uLWFmdGVyLWVtYWlsLWludm9pY2Utc2hpcHBpbmctaW52b2ljZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

10 years 4 months ago [\#244461](#244461) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add button after email/invoice/shipping invoice](/forum/35-orders-management/885356-add-button-after-email-invoice-shipping-invoice#244461 "-- 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?")*

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: Code:

function onHikashopBeforeDisplayView(&amp;$view){ if($view-&gt;ctrl != 'product' &#124;&#124; $view-&gt;task != 'show') return; $this-&gt;toolbar[] = array('name' =&gt; 'Popup', 'icon' =&gt; 'send', 'id' =&gt; 'send', 'alt' =&gt; JText::_('HIKA_EMAIL'), 'url' =&gt; 'index.php?option=com_hikashop&amp;ctrl=order&amp;task=invoice&amp;tmpl=component&amp;type=full&amp;order_id='.$order_id.'&amp;custom=1', 'width' =&gt; 720); }

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&gt;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](/forum/user/42791-dzseti "View dzseti's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg4NTM1Ni1hZGQtYnV0dG9uLWFmdGVyLWVtYWlsLWludm9pY2Utc2hpcHBpbmctaW52b2ljZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[dzseti](/forum/user/42791-dzseti "View dzseti's Profile")**
- [![dzseti's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/42791-dzseti "View dzseti's Profile") Topic Author
- [ Offline](/forum/user/42791-dzseti)

Less More

- Posts: 5
- Thank you received: 0
-
-

10 years 4 months ago -  10 years 4 months ago [\#244606](#244606) by [dzseti](/forum/user/42791-dzseti "View dzseti's Profile")  Replied by *[dzseti](/forum/user/42791-dzseti "View dzseti's Profile")* on topic *[Add button after email/invoice/shipping invoice](/forum/35-orders-management/885356-add-button-after-email-invoice-shipping-invoice#244606 "-- 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?")*

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(&amp;$view) { if (get_class($view) != 'OrderViewOrder') return; if ($view-&gt;ctrl != 'order') return; // probably redundant $view-&gt;toolbar[] = array( 'name' =&gt; 'Popup', 'icon' =&gt; 'invoice', 'id' =&gt; 'invoice2', 'alt' =&gt; 'INVOICE2', 'url' =&gt; 'index.php?option=com_hikashop&amp;ctrl=order&amp;task=invoice&amp;tmpl=component&amp;type=full&amp;order_id=' . $view-&gt;order-&gt;order_id . '&amp;custom=1', 'width' =&gt; 720); }

Last edit: 10 years 4 months ago by [dzseti](/forum/user/42791-dzseti "View dzseti's Profile"). Reason: Tidying up

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg4NTM1Ni1hZGQtYnV0dG9uLWFmdGVyLWVtYWlsLWludm9pY2Utc2hpcHBpbmctaW52b2ljZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.041 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
