Jump to content

How to get 'currency iso_code'?


Rysio

Recommended Posts

Hi,

I'm trying get active currencie's iso_code, and I can't achieve that.

I know that it's easy to get currencie's id, like:

global $cookie;
$currency = $cookie->id_currency;

...but would prefer to have rather iso_code than id_currency.

How to do that?
Can someone help?

Link to comment
Share on other sites

You can access to the currency object like over smarty

{$currency->iso_code}

{$currency}    Currency Object (9)
->id = 1
->name = "Euro"
->iso_code = "EUR"
->sign = "€"
->blank = "1"
->conversion_rate = "1.000000"
->deleted = "0"
->format = "2"
->decimals = "1"



Or you can access with currency object in php

  • Like 5
Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

Prestashop 1.6.0.9

It was good for me but NOT ALWAYS (Class BankWire{} in my case):

global $currency;
$my_currency_iso_code = $currency->iso_code;

because $currency variable was sometimes NULL, but i make:

global $cookie;
$currency = new CurrencyCore($cookie->id_currency);
$my_currency_iso_code = $currency->iso_code;

and it's work well

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 2 years 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...