Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
Change Price Format
 
weig
Jr. Member
 
Total Posts:  1
Joined:  2008-04-18
 

I’ve been trying to change the price format for CLP (chilean pesos), but i just can’t get it to work.

I changed the es_CL.xml file, specifically the CurrencyFormat element, but nothing happend, then i also changed de es.xml file and the same xml element, but still… nothing happened.

Example:

Magento shows Ch$2.000,00 and i just want Ch$2.000 (without the decimals).

If anyone could help with this i’d be very thankfull.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

Wew its hard bro… but If you wish you can try this code below :

add : $options[’precision’] = 0; line 374 at /lib/Zend/locale/Format.php

good luck

 
Magento Community Magento Community
Magento Community
Magento Community
 
Carlete
Jr. Member
 
Total Posts:  2
Joined:  2008-04-06
 

I tried that… but nothing happened… thanks anyways for the tip

 
Magento Community Magento Community
Magento Community
Magento Community
 
apaccy
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2008-04-03
 

Hello all,

May be this ‘modification’ of code can help you :
Step 1 : In file /app/design/frontend/~/~/template/catalog/product/price.phtml Nea line 34, 41, ...

Replace :

<?php echo Mage::helper('core')->currency($_price?>
By :
<?php echo Mage::helper('core')->currency($_price, array('precision' => -1) ) ?>

Up now it’s Too easy ! It will like we use wink

Step 2 : In file /app/code/core/Mage/Core/Model/Store.php Nea line 514

Replace :

if ($this->getCurrentCurrency() && $format{
            $value 
$this->formatPrice($value);
}
By :
if ($this->getCurrentCurrency() && $format{
            
if( is_array($format) ){
                $value 
$this->formatPrice($value$format);
            
}
            else{
                $value 
$this->formatPrice($value);
            
}
}

Step 3 : In file /app/code/core/Mage/Core/Model/Store.php Nea line 551

return $this->getCurrentCurrency()->format($price);
By :
return $this->getCurrentCurrency()->format($price$format);

For more information of $format array, see manual documentation page http://framework.zend.com/manual/en/zend.currency.usage.html - toCurrency($price, $format) -

I think is all ...
“NO WARRANTY has your risk and périle” ...

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

sorry bro, not at line 374 but before if (strpos($format,’0’)===false) {

so it would be like this :

$options[’precision’] = 0;
if (strpos($format, ‘0’) === false) {
require_once ‘Zend/Locale/Exception.php’;
throw new Zend_Locale_Exception(’Wrong format… missing 0’);
}

sorry, my mistake

 
Magento Community Magento Community
Magento Community
Magento Community
 
KrishKusuma
Jr. Member
 
Total Posts:  7
Joined:  2008-07-03
 
apaccy - 20 April 2008 06:44 PM

Hello all,

May be this ‘modification’ of code can help you :
Step 1 : In file /app/design/frontend/~/~/template/catalog/product/price.phtml Nea line 34, 41, ...

Replace :
<?php echo Mage::helper('core')->currency($_price?>
By :
<?php echo Mage::helper('core')->currency($_price, array('precision' => -1) ) ?>

Up now it’s Too easy ! It will like we use wink

Step 2 : In file /app/code/core/Mage/Core/Model/Store.php Nea line 514

Replace :

if ($this->getCurrentCurrency() && $format{
            $value 
$this->formatPrice($value);
}
By :
if ($this->getCurrentCurrency() && $format{
            
if( is_array($format) ){
                $value 
$this->formatPrice($value$format);
            
}
            else{
                $value 
$this->formatPrice($value);
            
}
}

Step 3 : In file /app/code/core/Mage/Core/Model/Store.php Nea line 551

return $this->getCurrentCurrency()->format($price);
By :
return $this->getCurrentCurrency()->format($price$format);

For more information of $format array, see manual documentation page http://framework.zend.com/manual/en/zend.currency.usage.html - toCurrency($price, $format) -

I think is all ...
“NO WARRANTY has your risk and périle” ...

I have followed your tip, the error message is:
====
Notice: Undefined variable: format in .................../app/code/core/Mage/Core/Model/Store.php on line 587

===

 
Magento Community Magento Community
Magento Community
Magento Community
 
KrishKusuma
Jr. Member
 
Total Posts:  7
Joined:  2008-07-03
 
alkarim - 20 April 2008 06:56 PM

sorry bro, not at line 374 but before if (strpos($format,’0’)===false) {


so it would be like this :


$options[’precision’] = 0;
if (strpos($format, ‘0’) === false) {
require_once ‘Zend/Locale/Exception.php’;
throw new Zend_Locale_Exception(’Wrong format… missing 0’);
}


sorry, my mistake

I’ve followed you like this:

$value Zend_Locale_Math::round($value0);
$options['precision'0;
if (
strpos($format‘0’) === false{
require_once 'Zend/Locale/Exception.php';
 throw new 
Zend_Locale_Exception('Wrong format... missing 0');

But it’s still error

Parse errorsyntax errorunexpected T_PUBLIC in /............../lib/Zend/Locale/Format.php on line 501

Any idea why ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
thetoine
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-06-04
Montreal, Canada
 

I have a similar problem. Can’t change Canadian dollars display from Can to CAD, which is the correct currency code.

Editing Zend’s local xml doesn’t work either for me.

Any update on this since ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
doctorlogos
Sr. Member
 
Avatar
Total Posts:  178
Joined:  2008-05-06
 

I want to know that too…

 
Magento Community Magento Community
Magento Community
Magento Community
 
pableu
Jr. Member
 
Total Posts:  29
Joined:  2008-09-19
 

I just changed the Symbol for Swiss Francs from “SFr.” to “CHF”, it was pretty easy in Magento 1.1.6.

1. Go to lib/Zend/Locale/Data and change the currency symbol(s) as you please in de XML files. This does not yet change anything since it’s still cached.

2. Delete the necessary files from the cache. I just did this like on the console as follows:

cd var/cache
grep SFr * -r
mage
--2/mage---Zend_LocaleC_de_CH_currencysymbol_CHF:s:4:"SFr.";
rm mage--2/mage---Zend_LocaleC_de_CH_currencysymbol_CHF
What happens here is this:
1st Line: Go to the Cache-directory.
2nd Line: Find any files here that contain the text SFr.
3rd Line Displays the result, showing that the file “mage--2/mage---Zend_LocaleC_de_CH_currencysymbol_CHF” contains the old currency symbol.
4th Line: Delete this file. It get’s rebuilt soon containing the new currency symbol.

I think the second step is easy to miss. You can probably also delete everything under var/cache, I <b>guess</b> it gets rebuilt automatically.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sailcomp
Member
 
Avatar
Total Posts:  37
Joined:  2008-10-02
 

How can I change the currency from german: “1.000,00” to Swiss: “1’000.00”?

This could be a start: http://framework.zend.com/manual/en/zend.currency.usage.html
but where to change in Magento?

 
Magento Community Magento Community
Magento Community
Magento Community
 
crazymagento
Jr. Member
 
Total Posts:  3
Joined:  2009-08-25
 

Its very easy bro............................

Just Open the lib\Zend\currency.php on line no 78

‘precision’ => 2,

to

‘precision’ => 0,

Problem solved .................................

just Enjoy

 
Magento Community Magento Community
Magento Community
Magento Community
 
mtness
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-12-15
 

Another way to display a custom formatted price in your .html file:

<span class="price"><?=round($_product->getFinalPrice(),0?> &euro;</span>
outputs: 10 €

You need the $_product variable somewhere, of course.

Kind regards, mtness.

 
Magento Community Magento Community
Magento Community
Magento Community
 
strelok
Member
 
Total Posts:  41
Joined:  2009-05-03
 

Hi,

I have a more complicated problem with price.

I would like, only for the price displayed in category list, and product view, to display my price as such :

<span class="price">99<span id="symbol">€</span><span id="cents">95</span></span>

I don’t know where to do that, can you help me ?

And when I do _product->getFinalPrice(), I get the price but not including VAT, and I can’t seem to get the price with VAT (or the VAT that I could add to the price).

 
Magento Community Magento Community
Magento Community
Magento Community
 
nasha
Sr. Member
 
Avatar
Total Posts:  138
Joined:  2009-04-15
 

I changed currency code in lib/Zend/Locale/Data/root.xml and it works for me

 
Magento Community Magento Community
Magento Community
Magento Community
 
justanother
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-10-14
Switzerland
 

To display eg. CHF 1’000.00 in italian

lib/Zend/Locale/Data/it_IT.xml

<ldml>
...
       <
numbers
        <
symbols>
            <
decimal>.</decimal>
            <
group>'</group>
        </symbols>
        <currencyFormats>
            <currencyFormatLength>
                <currencyFormat>
                    <pattern>¤ #,##0.00;¤-#,##0.00</pattern>
                </currencyFormat>
            </currencyFormatLength>
        </currencyFormats>    
    </numbers>
</ldml>

*should be a quotation mark in the group tag, duno how to get it displayed, sorry

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3