Question

I have to display some static block on product-detail-page according to currency selected from currency drop-down. ie If currency code is USD then i want to display text "abc" on product-detail-page and "efg" if currency is different.

Something same need to be done on checkout page.

It can be done by printing array and get that value but i want to do it in proper magento way. How can i achieve this?

Was it helpful?

Solution

I believe what you're looking for is something like this:

Mage::app()->getStore()->getCurrentCurrencyCode();

This should get the currently set currency code.

So if you'd like to activate some sort of special text when currency code is EUR, then maybe you might want to try:

$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();

if ($currentCurrencyCode == 'EUR') {
   echo 'Je sens un européen';
}
elseif ($currentCurrencyCode == 'GBP') {
   echo 'Rule Britannia!';
}

Or something to that extent...

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top