Zen Cart Logo
Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Error message on checkout step 2 when using a coupon

Error message on checkout step 2 when using a coupon

Views: 3,180

Results 1 to 5 of 5
23 Feb 2023, 12:55 AM
#1
pelicannm avatar

pelicannm

New Zenner

Join Date:
Dec 2009
Posts:
14
Plugin Contributions:
0

Error message on checkout step 2 when using a coupon

I'm getting a fatal error trying to go from step 2 to 3 of checkout when using a coupon that has restrictions. If the coupon has no restrictions, checkout goes fine.

This is the debug message: Uncaught TypeError: validate_for_category(): Argument #1 ($product_id) must be of type int, string given, called in /includes/functions/functions_gvcoupons.php on line 182 and defined in /includes/functions/functions_gvcoupons.php:210

Don't know how to fix that or where to look for whatever's throwing the error. Help is appreciated. Thanks.

23 Feb 2023, 10:58 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Error message on checkout step 2 when using a coupon

You've discovered a big in the software.
Change line 182 from:

    $allow_for_product = validate_for_product($product_id, $coupon_id);

To:

    $allow_for_product = validate_for_product((int)$product_id, $coupon_id);

Please report back the result which may include a similar statement about the coupon_id.

Then take credit for the discovery in the bus section of the forum.

23 Feb 2023, 1:42 PM
#3
pelicannm avatar

pelicannm

New Zenner

Join Date:
Dec 2009
Posts:
14
Plugin Contributions:
0

Re: Error message on checkout step 2 when using a coupon

This fixed it. No further errors came up, and the checkout process completed. Thank you!

23 Feb 2023, 2:13 PM
#4
pelicannm avatar

pelicannm

New Zenner

Join Date:
Dec 2009
Posts:
14
Plugin Contributions:
0

Re: Error message on checkout step 2 when using a coupon

Spoke too soon. The change also had to be made on line 183. Then there were no further errors. Thanks for your help.

23 Feb 2023, 10:23 PM
#5
lat9 avatar

lat9

Administrator

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

Re: Error message on checkout step 2 when using a coupon

I'll note that this currently occurs if-and-only-if a product with attributes (i.e. there's a string uprid as opposed to a simple products_id) is present in the cart.