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

#  Profile for alan\_adrian

##

[![alan&#95;adrian's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/49010-alan-adrian "View alan&#95;adrian's Profile")

**[ Offline](/forum/user/49010-alan-adrian)**

- **User Type:** User

- **Register Date:** 24 Mar 2017
- **Last login:** 2 months 1 week ago
- **Time Zone:**  UTC +0:00
- **Local Time:** 07:18

- **Posts:** 1
- **Profile views:** 51

- **Gender:** Unknown
- **Birthdate:** Unknown

- Posts

#  alan\_adrian's recent posts  (1 messages )

All Since last visit 4 Hours 8 Hours 12 Hours 24 Hours 48 Hours Week Month Year     All Since last visit 4 Hours 8 Hours 12 Hours 24 Hours 48 Hours Week Month Year

| <a id="forumtop"> </a> [  ](#forumbottom) | Subject | Replies / Views | Last Post | <a id="forumbottom"> </a> [   ](#forumtop) |
|---|---|---|---|---|
| [](/forum/29-payment-methods/889519-issues-geting-vars-from-cart-to-javascript-custom-payment-gateway-hosted-chk#265782) | [Issues geting vars from cart to javascript, custom payment gateway (hosted chk)](/forum/29-payment-methods/889519-issues-geting-vars-from-cart-to-javascript-custom-payment-gateway-hosted-chk#265782 "Hello, First of all, I introduce myself, my name is Alan and I live in Los Cabos, Mexico, I'm studying Systems Engineer degree and for the moment im struggling creating a basic e-shop for a project of...")         Category: [Payment Methods](/forum/29-payment-methods "Discussions about the different payment methods for Hikashop")     Topic started 9 years 8 months ago, by [alan\_adrian](/forum/user/49010-alan-adrian "View alan&#95;adrian's Profile")       [Last Post](/forum/29-payment-methods/889519-issues-geting-vars-from-cart-to-javascript-custom-payment-gateway-hosted-chk#265784 "Hi,  You've quite a bit of problems in the plugin.  1. The function getPaymentDefaultValues is defined inside the function onAfterOrderConfirm. First, that means that this getPaymentDefaultValues function won't be found by HikaShop. And second, having functions inside functions, while allowed by PHP is not a good practice.  2. In the function onAfterOrderConfirm, you initialize the $vars array with the data you need in your end file, however, you don't pass the $vars variable to end. If you look at the example payment plugin we provide in the developer documentation, you can see that we do this:  just before calling:  so that $this-&gt;vars is then available in the end file. That way, in your end file, you can replace for example:  by:  and you'll get your data in your javascript.  3. You use addScript in both the onAfterOrderConfirm and the end file to add two different JS files. If you need only one, I would recommend having it only in the end file, and if you need both, then put both in the end file.  4. The code:  in the function onAfterOrderConfirm might not work as, depending on how you configure your HikaShop settings, the cart already be cleared from the user session. But you already have all the data of the order in $order anyway, so you don't need that.  5. All the code after the closing of the class plgHikashoppaymentevopayment should be removed as it doesn't do anything good. All the code you put outside of the class definition in a Joomla plugin will run each time the plugins of that group are loaded by Joomla. So you'll end having that code run in the backend, when the plugin is being configured, during the checkout, when the payment methods list is being displayed, or when the cart is being loaded, etc. And you don't want that.") 9 years 8 months ago     by [nicolas](/forum/user/63-nicolas "View nicolas's Profile") | Replies:1  Views:840 | [Last Post](/forum/29-payment-methods/889519-issues-geting-vars-from-cart-to-javascript-custom-payment-gateway-hosted-chk#265784 "Hi,  You've quite a bit of problems in the plugin.  1. The function getPaymentDefaultValues is defined inside the function onAfterOrderConfirm. First, that means that this getPaymentDefaultValues function won't be found by HikaShop. And second, having functions inside functions, while allowed by PHP is not a good practice.  2. In the function onAfterOrderConfirm, you initialize the $vars array with the data you need in your end file, however, you don't pass the $vars variable to end. If you look at the example payment plugin we provide in the developer documentation, you can see that we do this:  just before calling:  so that $this-&gt;vars is then available in the end file. That way, in your end file, you can replace for example:  by:  and you'll get your data in your javascript.  3. You use addScript in both the onAfterOrderConfirm and the end file to add two different JS files. If you need only one, I would recommend having it only in the end file, and if you need both, then put both in the end file.  4. The code:  in the function onAfterOrderConfirm might not work as, depending on how you configure your HikaShop settings, the cart already be cleared from the user session. But you already have all the data of the order in $order anyway, so you don't need that.  5. All the code after the closing of the class plgHikashoppaymentevopayment should be removed as it doesn't do anything good. All the code you put outside of the class definition in a Joomla plugin will run each time the plugins of that group are loaded by Joomla. So you'll end having that code run in the backend, when the plugin is being configured, during the checkout, when the payment methods list is being displayed, or when the cart is being loaded, etc. And you don't want that.") by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")      9 years 8 months ago |

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

Time to create page: 0.054 seconds

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