If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / checkout payment - use a valid coupon code - msg coupon already used

checkout payment - use a valid coupon code - msg coupon already used

Started by oldngrey on 19 Feb 2023, 9:34 PM · Views: 3,654

Results 1 to 9 of 9
19 Feb 2023, 9:34 PM
#1
oldngrey avatar

oldngrey

Zen Follower

Join Date:
Apr 2008
Location:
Qld, Australia
Posts:
433
Plugin Contributions:
0

checkout payment - use a valid coupon code - msg coupon already used

zc158, php7.4, list of plugins, payment modules: direct bank deposit, securepay xml,

Customer enters valid unused coupon code at checkout-payment screen and receives message "Coupon "CouponCode" has already been used the maximum permitted times (1)."
Admin | Discounts | Coupon Admin| Discount Coupons | report for coupon Redemptions In total=0; For this customer = 0;

Repeatable in a vanilla install of zc158.

Coupon settings:
Uses per coupon = 1
Uses per customer =1
Date range valid for next 11mths

Coupon code is not listed in coupon_redeem_track table

OldNGrey
ZC222 PHP 8.4.27
MySQL 11.8.5-MariaDB

21 Feb 2023, 5:33 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: checkout payment - use a valid coupon code - msg coupon already used

While the coupon code may not be listed in the coupon_redeem_track table, as far as the code is concerned it is the coupon_id that is used for comparison/search. Would need to review the coupons table to determine the coupon_id for the coupon in question and then see how many times that coupon_id is in the coupon_redeem_track table. Assuming it is 1 or more, then to determine how that particular coupon identifier was reused with the new coupon code.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

21 Feb 2023, 9:53 PM
#3
oldngrey avatar

oldngrey

Zen Follower

Join Date:
Apr 2008
Location:
Qld, Australia
Posts:
433
Plugin Contributions:
0

Re: checkout payment - use a valid coupon code - msg coupon already used

mc12345678:

While the coupon code may not be listed in the coupon_redeem_track table, as far as the code is concerned it is the coupon_id that is used for comparison/search. Would need to review the coupons table to determine the coupon_id for the coupon in question and then see how many times that coupon_id is in the coupon_redeem_track table. Assuming it is 1 or more, then to determine how that particular coupon identifier was reused with the new coupon code.

Sorry, I wasn't clear. The coupon_id, as listed in the coupons table for the coupon_code, is not listed in the coupon_redeem_track table.
This can be reproduced in a vanilla install of zc158.

OldNGrey
ZC222 PHP 8.4.27
MySQL 11.8.5-MariaDB

22 Feb 2023, 2:27 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: checkout payment - use a valid coupon code - msg coupon already used

Bug verified using the current zc158 GitHub repository files. GitHub tracking issue: https://github.com/zencart/zencart/issues/5619

22 Feb 2023, 9:48 PM
#6
oldngrey avatar

oldngrey

Zen Follower

Join Date:
Apr 2008
Location:
Qld, Australia
Posts:
433
Plugin Contributions:
0

Re: checkout payment - use a valid coupon code - msg coupon already used

Thanks
Your correction works as expected.

The fix seems so simple but I lost a day trying to resolve this one.

OldNGrey
ZC222 PHP 8.4.27
MySQL 11.8.5-MariaDB

22 Feb 2023, 9:52 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: checkout payment - use a valid coupon code - msg coupon already used

Thanks for writing up and reporting; it's the only way we can find and fix bugs like this.
The change has been merged and will be in Zen Cart 1.5.8a.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

8 Nov 2024, 1:08 AM
#8
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: checkout payment - use a valid coupon code - msg coupon already used

Getting same error for guest checkout on 1.5.8a.
Uses per Customer: 1
Uses per Coupon: Unlimited

Guest users get same error "You have used Coupon ... maximum time" but they have not before.

8 Nov 2024, 12:54 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: checkout payment - use a valid coupon code - msg coupon already used

jsarwar:

Getting same error for guest checkout on 1.5.8a.
Uses per Customer: 1
Uses per Coupon: Unlimited

Guest users get same error "You have used Coupon ... maximum time" but they have not before.
Have you applied the patch that I posted: https://github.com/zencart/zencart/pull/5621/files