Page 1 of 2

How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 10:05 am
by munders
Hi all

I want to make my prices on my website show without the pence after it i.e. instead of £129.00 it needs to be £129.

I expect this requires some coding with the decimal places but I don't know how to do it.

Please help!

Thanks

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 10:52 am
by edmondscommerce
If you are only offering a single currency, I think the easiest would be to edit your template files accordingly

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 10:54 am
by munders
Thanks, but which template, and where? I'm not the best coder in the world :(

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 10:59 am
by edmondscommerce

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 11:57 am
by munders
Thanks but I couldn't make head or tail of that.

I am right in thinking that this change is not available in Admin and has to be done in the hard code?

Thanks

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 12:00 pm
by munders
The debug shows that the file i need is OrganicInternet_SimpleConfigurableProducts_Catalog_Block_Product_Price

Which folder is this in please?

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 12:23 pm
by edmondscommerce
to be honest I suggest you get a book or two on Magento development and maybe read the wiki pages etc

from the kinds of questions you are asking, it may be that you cause more harm than good if you start editing files

Re: How do I remove the pence from the prices?

PostPosted: Thu Jan 13, 2011 12:59 pm
by munders
I'm very careful and always backup files so no worries there.

Can anyone else on here help? Any other people viewing this?

Thanks

Re: How do I remove the pence from the prices?

PostPosted: Fri Aug 14, 2015 10:38 am
by chrissmith
Your question is very old, but it ranks number 1 for anyone searching for "magento don't show pence" so I thought I'd answer it!

The code for decimal precision is in /app/code/core/Mage/Directory/Model/Currency.php.

Don't edit this file!!!

To avoid it being overwritten whenever you update Magento, you need to copy it to:

/app/code/local/Mage/Directory/Model/Currency.php

Create the above directory structure if it doesn't already exist.

Then find this bit:

Code: Select all
    public function format($price, $options = array(), $includeContainer = true, $addBrackets = false)
    {
        return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
    }


It's located on lines 220->223 in Magento 1.9.2.0. Edit it to:

Code: Select all
    public function format($price, $options = array(), $includeContainer = true, $addBrackets = false)
    {
        return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
    }


Note that the only change is to replace the '2' with a '0' (zero), which in doing so sets the number of decimal places to display to none.

That's it!

Re: How do I remove the pence from the prices?

PostPosted: Fri Aug 14, 2015 10:41 am
by magentoforum_admin
Hi, I'm Hamza from Edmonds commerce, Thanks for the help :)