How to change price format or locale options in Magento 1.5?

How to change price format or locale options in Magento 1.5?

August 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to change price format or locale options in Magento 1.5?

Solving Price Formatting Issues in Magento 1.5

The Problem: Changing Price Format or Locale Options

Price formatting is a common issue faced by many Magento users. You may want to display prices in a specific format, like 1 000 Ft instead of 1 000,00 Ft. This often involves changing the precision settings and digging through core files.

Investigation: Exploring Core Magento Files

I spent considerable time reflecting the Magento code base to find a solution. Here are some key locations I probed:

Mage/Core/Model/Store.php

function formatPrice() {
    $option = array('precision' => 2 );
    // Code snippet...
}

Mage/Directory/Model/Currency.php

function format() {
    $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
}

The Breakthrough: Understanding Zend Core API

After analyzing the code, I realized that changing the precision settings in Magento files isn’t enough. The number format is determined by the locale information provided by the Zend core API.

This led me to a crucial discovery about how Magento handles price formatting:

  • Magento uses the Zend Framework’s locale data for price formatting.
  • This data is stored in XML files located under lib/Zend/Locale/Data/.
  • The file name corresponds to the country’s locale code (e.g., hu.xml for Hungary).

The Solution: Modifying Locale Files

Finding Your Country’s XML File

Locate your country’s locale file. For example, if you’re using Hungarian, look for hu.xml.

Updating Currency Format Settings

Navigate to the <currencyFormats> section in the XML file.

<currencyFormats>
    <currencyFormatLength>
        <currencyFormat>
            <pattern>#,##0 ¤</pattern>
        </currencyFormat>
    </currencyFormatLength>
    <unitPattern count="other">{0} {1}</unitPattern>
</currencyFormats>

Understanding Currency Format Patterns

The pattern attribute defines how the currency is displayed. The documentation at Zend Locale Parsing provides some guidance on the format string syntax.

Conclusion: A Comprehensive Approach to Price Formatting

By understanding the underlying Zend core API and modifying the locale files directly, you can achieve consistent price formatting across your entire Magento application.

This approach ensures that the price display adheres to the locale settings defined in the Zend Framework for a specific country. It eliminates the need for manual adjustments in various Magento files.

Remember, changes made to these core files may be overwritten during upgrades. Consider using a child theme or overriding the relevant module’s XML files if you want a more robust solution with better upgrade compatibility.

For further reading on Magento development best practices and advanced customization techniques, I recommend exploring our guide at Laravel Company.

Magento 1 API Configuration Pricing

Our network