Jump to content

wrong currency conversion


Tito

Recommended Posts

My shop has default currency is Euro.

Customer changes currency to Dollar.

User has a cart of 100 dollar.

If I use "$cart->getOrderTotal(true, 3)", I get the total amount in dollar. (100)

Now I want to convert the amount to Euro's, the shop default currency. (79)

If I use:
"Tools::convertPrice($amount, Currency::getCurrency(intval($cart->id_currency)));"
the price is REconverted to euro (127), from dollar to euro instead of euro to dollar (79)!

How can I reverse this conversion pls ?

I have been using the same code for over a year. I've recently updated from 1.1 to 1.3 and now a customer has paid to much! Pls help

Link to comment
Share on other sites

  • 2 months later...

Than you very much for the info link!
(And thx for keeping my old question alive!! none seemed to care)

I wasn't able to fix it until now.
I will test the solution in the coming days, tough it is a strange fix... assigning a new variable, then re-assigning the var to the old var... I'll try it anyway

Link to comment
Share on other sites


I will test the solution in the coming days, tough it is a strange fix… assigning a new variable, then re-assigning the var to the old var… I’ll try it anyway

Please note, the code explained at my blog only fix one of the two issues. It will not fix conversion issue. To fix conversion issue, more coding is required. But if you use "Agile Paypal" module, all issues will be fixed. Agile Paypal is an express checkout module with Paypal, customer does not need to registration or input anything manually, just 3 easy click will bring customer to Paypal payment page. You can have more info at this thread.

And the fix is not strange if you know the cause. Because inside the Paypal module, in order to do conversion, it will change currency to Paypal currency, but it does not change it back to customer selected currency when conversion is finished. The first line of my code is to save the customer selected currency to a variable before it is changed by the module. Then the 2nd line of my code it to restore customer selected currency after the conversion.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...