Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Spaces problem in bad coupon notification

Spaces problem in bad coupon notification

Locked

Views: 1,014

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
22 Jun 2010, 6:30 AM
#1
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

Spaces problem in bad coupon notification

Whenever I try to use a coupon not valid because of some restrictions previously set I receive this notification:

This%20coupon%20code%20is%20not%20valid%20for%20any%20product%20currently%20in%20your%20cart.

That comes from languages/CUSTOM_TEMPLATE/english.php:

define('TEXT_INVALID_COUPON_PRODUCT', 'This coupon code is not valid for any product currently in your cart.');

Other notifications, as the coupon success one, coming from same define file are correctly visualized with spaces, and not with "%20".

Is it a known bug? I cannot find any news about it.

22 Jun 2010, 7:12 AM
#2
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

Re: Spaces problem in bad coupon notification

I've just found in /includes/modules/order_total/ot_coupon.php:

if (!$foundvalid) zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'credit_class_error_code=' . $this->code . '&credit_class_error=' . urlencode(TEXT_INVALID_COUPON_PRODUCT . ' ' . $dc_check), 'SSL',true, false));

So I think it's the urlencode() function that changes spaces to %20
Every other notification use messageStack way....not this one....

So I found the "WHERE", can you please show me the "WHY"? :)

22 Jun 2010, 8:57 AM
#3
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

Re: Spaces problem in bad coupon notification

I actually patched /includes/modules/order_total/ot_coupon.php as below changing:

if (!$foundvalid) zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'credit_class_error_code=' . $this->code . '&credit_class_error=' . urlencode(TEXT_INVALID_COUPON_PRODUCT . ' ' . $dc_check), 'SSL',true, false));

to

if (!$foundvalid) {
         $messageStack->add_session('checkout_payment', TEXT_INVALID_COUPON_PRODUCT, 'error');
         $this->clear_posts();
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL',true, false));
       }

Anyway, I hope someone (ajeh? dr.byte? anyone else?) tell me if that's wrong, dangerous or simply stupid. (I followed other error messages convention :)

Thanks