Magento 1.9 – Add Current Currency Symbol to CMS Block

cmscurrencymagento-1.9widgets

I would like to add a the currency symbol to a CMS block on a category page or in the category description.

It would be something like under €50 or under $50.

Is there a simple way to do this with a CMS directive? i.e.

{{store_currency}}

Perhaps it's possible with a widget?

Otherwise I was thinking of using a custom variable but this would only work on a store view level and not if the customer changes currency within the store view.

Another option I thought of was to add a CSS class to the tag depending on what currency is selected and use that to hide and display the right currency symbols.

But is there an more straight forward way of doing this? with a cms directive or widget?

Best Answer

You can do this by creating new widget. Check here : Creating Widget

Here you can place your code at Envato_WidgetLinks_Block_Links block's _toHtml() method, that returns current store's Currency symbol.

Otherwise, (a bit of Hack)

You can add some text to your static block, like [[CURRENCY_SYMBOL]] and replace it with currency symbol using PHP str_replace function, like:

$current_currency_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();

$cms_block_content = $this->getLayout()->createBlock('cms/block')->setBlockId('cms_block_identifier_here')->toHtml();

echo str_replace("[[CURRENCY_SYMBOL]]", $current_currency_symbol, $cms_block_content);