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

#   Displaying html/js at checkout end using plugin

##

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

Less More

- Posts: 42
- Thank you received: 1
-
-

11 years 3 months ago -  11 years 3 months ago [\#208972](#208972) by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")  *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#208972 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")* was created by *[Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")*

-- url of the page with the problem -- : localhost
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.5.12
-- Browser(s) name and version -- : Firefox 37.0.2

Hello,

I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).

I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group="hikashop" and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:

defined('_JEXEC') or die('Restricted access');
class plgHikashopMyPlugin extends JPlugin {
function plgHikashopMyPlugin(&amp;$subject, $config){
parent::__construct($subject, $config);
}
function onAfterOrderCreate(&amp;$order, &amp;$send_email) {
$document = JFactory::getDocument();
$document-&gt;addScriptDeclaration('SOME_DUMMY_CODE = 1');
}
}

However no matter what, SOME_DUMMY_CODE doesn't appear on my after checkout (confirmation) page.
Could you please suggest why? Maybe it's not possible to "echo" anything through triggers?

I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method_id), didn't work.

Best regards,
Chris

Last edit: 11 years 3 months ago by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODI4Ny1kaXNwbGF5aW5nLWh0bWwtanMtYXQtY2hlY2tvdXQtZW5kLXVzaW5nLXBsdWdpbj90bXBsPW1hcmtkb3du) 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
-
-

11 years 3 months ago [\#208978](#208978) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#208978 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")*

Hi,

The triggers onAfterOrderCreate and onAfterOrderConfirm are called at the end of the checkout before the redirection to the payment gateway.
I suppose that what you want to do is to display your javascript after the payment on the payment gateway, when the user comes back on the website and in that case, none of these triggers will help.
The simplest would be to edit the file "after_end" of the view "checkout" via the menu Display&gt;Views and add your code directly in there.
It will be added on the end page, when the customer is returning on the website and see the "thank you for your purchase" message.

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

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

Less More

- Posts: 42
- Thank you received: 1
-
-

11 years 3 months ago -  11 years 3 months ago [\#209045](#209045) by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")  Replied by *[Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")* on topic *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#209045 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")*

Hi Nicolas,

no, it's not payment gateway, I'm using "HikaShop bank transfer payment plugin", it just displays some info at the end.

The purpose for this javascript (or any other simple code I want to display) is as follows:

Client must fill some order custom field and at the end of checkout javascript will appear or not (I'll do some simple if statement), however I can't display anything using above triggers, that's why I'm asking if everything is ok with these triggers.

Best regards,
Chris

Last edit: 11 years 3 months ago by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile").

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

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

Less More

- Posts: 42
- Thank you received: 1
-
-

11 years 3 months ago -  11 years 3 months ago [\#209052](#209052) by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")  Replied by *[Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")* on topic *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#209052 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")*

sorry, wrong topic

Last edit: 11 years 3 months ago by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODI4Ny1kaXNwbGF5aW5nLWh0bWwtanMtYXQtY2hlY2tvdXQtZW5kLXVzaW5nLXBsdWdpbj90bXBsPW1hcmtkb3du) 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
-
-

11 years 3 months ago [\#209066](#209066) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#209066 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")*

For the onAfterOrderConfirm trigger it's normal that you don't get anything as it is called only in the payment plugin which was selected. So your custom plugin onAfterOrderConfirm function will never be called.
For the onAfterOrderCreate trigger, it is called at the end of the checkout with the bank transfer payment method selected and if you add javascript in that function you'll see it in the headers of the page.
If you don't get anything, check that this function is called at the end of the checkout (add an exit; in it)
If it's not called, then either the plugin is in the correct group, or not published, or the file name or class name are not correct, etc.
If it's called, then I don't see why you wouldn't see your javascript in the header of the page.

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

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

Less More

- Posts: 42
- Thank you received: 1
-
-

11 years 3 months ago [\#209373](#209373) by [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")  Replied by *[Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")* on topic *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#209373 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")*

I'm out of ideas :dry: Would you kindly check by your side if plugin from attachment is working or not? Thanks in advance.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODI4Ny1kaXNwbGF5aW5nLWh0bWwtanMtYXQtY2hlY2tvdXQtZW5kLXVzaW5nLXBsdWdpbj90bXBsPW1hcmtkb3du) 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
-
-

11 years 3 months ago [\#209375](#209375) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Displaying html/js at checkout end using plugin](/forum/31-development/878287-displaying-html-js-at-checkout-end-using-plugin#209375 "-- url of the page with the problem -- : localhost -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5.12 -- Browser(s) name and version -- : Firefox 37.0.2  Hello,  I'm trying to display some javascript code at the end of checkout (on last checkout page - after customer confirms order).  I found in your API docs some very useful info, for now I made some simple plugin. It has one parameter, under Extensions-&gt;Plugins-&gt;myplugin I can enter this param and everything is saving fine (plugin is group=&quot;hikashop&quot; and it's published etc., I checked all things twice). Now in my php file I'm trying simple things like:  defined('&#95;JEXEC') or die('Restricted access'); class plgHikashopMyPlugin extends JPlugin { function plgHikashopMyPlugin(&amp;$subject, $config){ parent::&#95;&#95;construct($subject, $config); } function onAfterOrderCreate(&amp;$order, &amp;$send&#95;email) { $document = JFactory::getDocument(); $document-&gt;addScriptDeclaration('SOME&#95;DUMMY&#95;CODE = 1'); } }  However no matter what, SOME&#95;DUMMY&#95;CODE doesn't appear on my after checkout (confirmation) page. Could you please suggest why? Maybe it's not possible to &quot;echo&quot; anything through triggers?  I was trying also: onAfterOrderConfirm(&amp;$order,&amp;$methods,$method&#95;id), didn't work.  Best regards, Chris")*

Hi,

The solution is in my previous message:

> If it's not called, then either the plugin is in the correct group, or not published, or the file name or class name are not correct, etc.

The class name of your plugin is wrong. Based on your XML it should be plgHikashopCeneo_zaufane_hikashop and not plgHikashopCeneoZaufaneOpinie

The following user(s) said Thank You: [Gnsbud](/forum/user/37991-gnsbud "View Gnsbud's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODI4Ny1kaXNwbGF5aW5nLWh0bWwtanMtYXQtY2hlY2tvdXQtZW5kLXVzaW5nLXBsdWdpbj90bXBsPW1hcmtkb3du) 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.058 seconds

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