Magento Forum - UK Magento Forum (Unofficial)

An unofficial but dedicated Magento Forum for Magento Users, Designers and Developers

How do I remove the pence from the prices?

A forum for web designers working with the Magento system.

How do I remove the pence from the prices?

Postby munders » Thu Jan 13, 2011 10:05 am

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
munders
 
Posts: 16
Joined: Thu Dec 02, 2010 1:43 pm

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

Postby edmondscommerce » Thu Jan 13, 2011 10:52 am

If you are only offering a single currency, I think the easiest would be to edit your template files accordingly
User avatar
edmondscommerce
 
Posts: 1157
Joined: Fri Sep 11, 2009 8:55 am
Location: UK

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

Postby munders » Thu Jan 13, 2011 10:54 am

Thanks, but which template, and where? I'm not the best coder in the world :(
munders
 
Posts: 16
Joined: Thu Dec 02, 2010 1:43 pm


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

Postby munders » Thu Jan 13, 2011 11:57 am

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
munders
 
Posts: 16
Joined: Thu Dec 02, 2010 1:43 pm

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

Postby munders » Thu Jan 13, 2011 12:00 pm

The debug shows that the file i need is OrganicInternet_SimpleConfigurableProducts_Catalog_Block_Product_Price

Which folder is this in please?
munders
 
Posts: 16
Joined: Thu Dec 02, 2010 1:43 pm

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

Postby edmondscommerce » Thu Jan 13, 2011 12:23 pm

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
User avatar
edmondscommerce
 
Posts: 1157
Joined: Fri Sep 11, 2009 8:55 am
Location: UK

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

Postby munders » Thu Jan 13, 2011 12:59 pm

I'm very careful and always backup files so no worries there.

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

Thanks
munders
 
Posts: 16
Joined: Thu Dec 02, 2010 1:43 pm

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

Postby chrissmith » Fri Aug 14, 2015 10:38 am

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!
chrissmith
 
Posts: 2
Joined: Fri Aug 14, 2015 10:32 am

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

Postby magentoforum_admin » Fri Aug 14, 2015 10:41 am

Hi, I'm Hamza from Edmonds commerce, Thanks for the help :)
magentoforum_admin
Site Admin
 
Posts: 23
Joined: Sat Sep 05, 2009 1:30 pm

Next

Return to Magento Designers

cron