Forums / Bug Reports / currency problem with GV during checkout

currency problem with GV during checkout

Locked

Views: 2,055

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
19 Nov 2006, 1:25 AM
#1
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

currency problem with GV during checkout

Please note, this is not a clean 1.3.6 install so please verify!

During checkout, if the customer has a balance and is checking out with a currency other than the store currency, an error is triggered if the customer doesn't input the default currency amount - even though it is displayed in their chosen currency.

That makes no sense, I know... so here's an example:

Default currency: USD
Selected currency: CAD (1 CAD = 0.85 USD)

GV balance: CAD$100

During checkout, customer tries to apply CAD$100 to the order, but is told they don't have that much. If the customer chooses exactly CAD$85 or less, it is ok. This leads me to belive that internally, it is comparing the USD value.

I'll try to investigate to see if I can find the solution... but could someone pleaes confirm?

As a customer, choose a currency worth less than the store/default currency, and order a gift cert.

Then order something else and try to apply the full amount to the order during checkout.

  • Steven
19 Nov 2006, 2:16 AM
#2
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: currency problem with GV during checkout

Yikes... from glancing at the code, it looks like currencies and credits aren't friends in the order_total.php routines.

I haven't tested thoroughly yet, but it seems that if you are operating in a currency other than the store currency, and you have total credits equal to the order total, that you will still be asked to finish payment, provided the user currency is worth less than store currency. This isn't supposed to be the case... payment should be bypassed if the credits cover it.

What's worse is if the currency is worth more than the store currency!!! In this case, a user could have less than enough to cover the order, but ZenCart will bypass payment assuming enough is there.

It seems like the entire credits system ignores currencies!!!

Please tell me I'm out to lunch on this.

  • Steven
19 Nov 2006, 2:45 AM
#3
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: currency problem with GV during checkout

I think I've fixed the GV problem... but similar issues may (and probably do) exist with other credits (coupons, for example). Also I have confirmed that the problems described above exist on a fresh 1.3.6 install so please take this seriously.

To fix GV:

open /includes/modules/order_total/ot_gv.php

find the function called "pre_confirmation_check" and change the lineglobal $order; to global $order, $currencies; and change the lineif ($_SESSION['cot_gv'] > $this->user_has_gv_account($_SESSION['customer_id'])) { to ```
if ($_SESSION['cot_gv'] > $currencies->value($this->user_has_gv_account($_SESSION['customer_id']))) {


Then find the function called "calculate_credit" and change the lines:```
    global $db, $order;
    $gv_payment_amount = $_SESSION['cot_gv'];
``` to ```
    global $db, $order, $currencies;
    $gv_payment_amount = $currencies->value($_SESSION['cot_gv'], true, DEFAULT_CURRENCY);
  • Steven
19 Nov 2006, 11:22 PM
#4
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: currency problem with GV during checkout

Looking into this further, it seems that coupons are handled correctly... its just the give voucher system that didn't do it properly. After a full day testing from every angle I could think of, my relatively simple fixes above work with no side effects. The only thing I think could be a problem is if a user is checking out with a GV at the same moment the admin updates the currency rates... a better fix might be to NOT allow customers to choose how much of a GV to use - just assume they want to use all of it against the price. This is because the problem (or potential one) is only introduced because of user input... the user is working in one currency, but the DB is handled in another.

This really should get fixed in short-order though, even though it only applies to multi-currency stores using GV... but considering those are two toted features of Zen, it would be nice if they played nice together.

I don't know if this bug existed pre-1.3.5... amazing nobody discovered it if it did.

  • Steven
20 Nov 2006, 9:57 PM
#5
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,927
Plugin Contributions:
3

Re: currency problem with GV during checkout

Hi,

Thanks for the bug report, and for posting a fix as well :)

It is suprisong that the bug has gone un-noticed for so long. Will make sure it gets into the next release.

20 Nov 2006, 10:50 PM
#6
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: currency problem with GV during checkout

Happy to be of service.