Author Topic: Removing coupons on specific payment  (Read 203 times)

noOob

  • Beginner
  • *
  • Posts: 8
  • A beginner
Removing coupons on specific payment
« on: December 19, 2018, 17:03:32 pm »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8678
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Removing coupons on specific payment
« Reply #1 on: December 19, 2018, 17:29:18 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27149
  • Always on vacation
    • Jenkin Hill Internet
Re: Removing coupons on specific payment
« Reply #2 on: December 19, 2018, 17:29:32 pm »
Awocoupon has an "Option to restrict coupon by payment method"
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.4.3.9989 on Joomla 3.9.1 PHP 7.0.32
Testing VM 3.4.3.9993 on Joomla 3.9.1

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8678
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Removing coupons on specific payment
« Reply #3 on: December 19, 2018, 18:11:14 pm »
ah!  perfect
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

noOob

  • Beginner
  • *
  • Posts: 8
  • A beginner
Re: Removing coupons on specific payment
« Reply #4 on: December 19, 2018, 18:43:07 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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1822
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Removing coupons on specific payment
« Reply #5 on: December 19, 2018, 19:41:12 pm »
Talk to awocoupon about this
Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)