- Posts: 72
- Thank you received: 0
show payment method if certain product in basket
- daveturner101
-
Topic Author
- Offline
we've recently updated from 2.1.0 starter edition to 2.2.3 business edition.
the update has meant that some of our payment plugin customisations have been lost. this is fine, we knew it would happen.
i'm trying to add the small code customisations back into the plugins but the code looks to have changed quite a bit since we added them.
we had edited the paypal payment plugin files to only show certain payment methods if a certain product was in the basket. the code for hikashoppayment/paypal/paypal.php used to look like this: (just the first part of the file...)
and this is our custom code:
can someone tell me where to put that code in the latest hikashoppayment/paypal/paypal.php ??
is is possible to just add some customisations to the view checkout / payment.php instead?
the original code for this came from this topic: www.hikashop.com/forum/4-how-to/16141-co...sed-on-products.html
many thanks
Please Log in or Create an account to join the conversation.
The onPaymentDisplay function is now in the hikashopPaymentPlugin class so that not all the payment plugins need the same function copy/pasted in them.
If you want to personnalise it, simply copy that function from the file administrator/components/com_hikashop/helpers/helper.php where that class is defined and paste it in your plugin's class. Then, add again your custom code in there.
You can also customize the file "payment" of the view "checkout" via the menu Display>Views. That way, you won't have to reapply your modification each time you update. But the code will have to be adapted as you don't have the products loaded in there. You can use such code to get the full cart including the products array :
Please Log in or Create an account to join the conversation.
- daveturner101
-
Topic Author
- Offline
- Posts: 72
- Thank you received: 0
nicolas wrote: Hi,
The onPaymentDisplay function is now in the hikashopPaymentPlugin class so that not all the payment plugins need the same function copy/pasted in them.
If you want to personnalise it, simply copy that function from the file administrator/components/com_hikashop/helpers/helper.php where that class is defined and paste it in your plugin's class. Then, add again your custom code in there.
You can also customize the file "payment" of the view "checkout" via the menu Display>Views. That way, you won't have to reapply your modification each time you update. But the code will have to be adapted as you don't have the products loaded in there. You can use such code to get the full cart including the products array :Code:$class = hikashop_get('class.cart'); $cart = $class->loadFullCart();
thanks for the info. is it OK to remove the onPaymentDisplay function from helper.php completely and just put it into the payment plugins that i want to support?
will having different the function defined in two places cause conflict?
thanks again for the help
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- daveturner101
-
Topic Author
- Offline
- Posts: 72
- Thank you received: 0
nicolas wrote: There is no need to remove it in the helper. If you add it in your payment plugins, your function will automatically override the one of the helper.
thanks, does it matter if i have removed it? i guess not..?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.