Jump to content

HELP - Way to get the order price in default currency if you have changed to another currency


cian1991ferrari

Recommended Posts

Hi,

I have developed a payment module and one bit that i'm putting into version 1.1 is that no matter what currency you checkout in, you only pay in the shop default currency. This is needed in order to successfully complete the transaction through the merchant account. I have implented it so that the amount changes.

My problem is this:
I make the amount sent to the merchant to be the same as the default currency amount by dividing or multiplying it by the conversion rate from the default currency and then rounding it to 2 decimal places. In MOST cases this works, BUT in some cases it rounds to 1 cent wrong. Although it is only 1 cent, the order does not process as successful in PrestaShop unless it is the EXACT same.

What I need to know is, is there a way of getting the cart total but IN THE DEFAULT CURRENCY??

For example:

$originalamount = floatval($cart->getOrderTotal(true, 3));
This gets the total of the cart in decimal format (i.e 474.50) BUT it only gets it in whatever currency you have selected. If it was £474.50 but was €572.03 in euros I need to have something like the code above to get the amount in the default currency no matter what currency is selected.

Can someone please tell me a way to do this???

Link to comment
Share on other sites

  • 1 year later...

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...