News:

Support the VirtueMart project and become a member

Main Menu

Removing coupons on specific payment

Started by noOob, December 19, 2018, 17:03:32 PM

Previous topic - Next topic

noOob

Hi,
As i mentioned in the subject i need a way to remove all the coupons on a specific payment. Like there are no coupon usable for "pay with cash".  I tried to implement it using javascript, in the way that when user change payment method and if it is "pay with cash" i try to call all the remove button links and then remove the coupon area preventing more coupon input. but there are many bugs this way, first it does not work for more than one coupons and i know why, second it is client area checking which is not very reliable and more.

The reason behind first bug is (as i know) coupon data like any other cart data are in joomla session and if we imagine it as a resource there happens race condition on this resource and that's the exact reason the virtuemart is made like everything are updating through Ajax but Coupon removal.

I need a way to remove them or alternatively if it's possible don't accept it on order submission or sth like these.

GJC Web Design

I guess ajax is the way to go .. when forbidden payment it sends an ajax call to remove the coupon from the session and trigger a recalc?

of use JS to remove the field value and resubmit the cart to force a recalc?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

Awocoupon has an "Option to restrict coupon by payment method"
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

noOob

#4
Quote from: jenkinhill on December 19, 2018, 17:29:32 PM
Awocoupon has an "Option to restrict coupon by payment method"

nice, I'm using awocoupon, but a poor translation made it hard for me, it was mistranslated so i couldn't find payment method restriction option.

now there is only one problem, it's per coupon, i want to do it for all coupons :D if it had a configuration or sth so that applied on all coupons it was way better for me.

Jörgen

Talk to awocoupon about this
Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.