Magento News
How to change price format or locale options in Magento 1.5?
I’m going to write a common problem in magento and a solution, which best fit for me.
I’ve been searchin the net and reflecting magento code for hours to find solution to the above problem. I wanted Hungarian price format to be 1 000 Ft instead of 1 000,00 Ft
I have replaced the value 'precision' to 0 everywhere, but did not succeed.
Here is a list where I probed:
-
app/code/core/Mage/Core/Model/Store.php
function formatPrice(){ $option = array('precison' => 2 ); ... } -
app/code/core/Mage/Directory/Model/Currency.php
function format() {
$this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
}
After reflecting the code I realized that this all change does not matter at all because number format information is based on locale information which is provided by the Zend core API.
So here is the solution I found and hopefully price formatting will be standard for the entire application this way.
You find your YY.xml file in lib/Zend/Locale/Data/, where YY is your countries locale code. Mine is hu.xml
You find the part:
<currencyFormats>
<currencyFormatLength>
<currencyFormat>
<pattern>#,##0 ¤</pattern>
</currencyFormat>
</currencyFormatLength>
<unitPattern count="other">{0} {1}</unitPattern>
</currencyFormats>
About the format string you can find a not-at-all useful information at http://framework.zend.com/manual/en/zend.locale.parsing.html
Please vote up this question if you found it useful, thank you
How to change price format or locale options in Magento 1.5?
Possibly Related Posts:
- Database query different results
- Menu highlight in magento under admin
- magento disable a banner on certain category pages or have a banner with multiple links
- Magento, using ACL for frontend. Possible?
- Magento IE-7 Fix In Windows XP
RSS Feed