Skip to content

Instantly share code, notes, and snippets.

@SchumacherFM
Created January 24, 2013 12:31
Show Gist options
  • Save SchumacherFM/4620982 to your computer and use it in GitHub Desktop.
Save SchumacherFM/4620982 to your computer and use it in GitHub Desktop.
Magento: reformat the price system wide for any locale to a consistent format width the event currency_display_options_forming
<global>
<events>
<currency_display_options_forming>
<observers>
<namespace_module_format_price>
<type>singleton</type>
<class>Namespace_Module_Model_Observer_FormatPrice</class>
<method>formatPrice</method>
</namespace_module_format_price>
</observers>
</currency_display_options_forming>
</events>
</global>
<?php
class Namespace_Module_Model_Observer_FormatPrice
{
public function formatPrice(Varien_Event_Observer $observer)
{
$event = $observer->getEvent();
$options = $event->getCurrencyOptions();
/**
* Options array
*
* The following options are available
* 'position' => Position for the currency sign
* 'script' => Script for the output
* 'format' => Locale for numeric output
* 'display' => Currency detail to show
* 'precision' => Precision for the currency
* 'name' => Name for this currency
* 'currency' => 3 lettered international abbreviation
* 'symbol' => Currency symbol
* 'locale' => Locale for this currency
* 'value' => Money value
* 'service' => Exchange service to use
*
* @var array
* @see Zend_Locale
*/
$options->setData(array(
'position' => Zend_Currency::LEFT,
'display' => Zend_Currency::USE_SHORTNAME,
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment