Hello Everyone,
Today I’m going to tell you how to remove decimal price in magento.In simple words, This tutorial will tell to change the price from Rs. 121.00 to Rs . 121 for example.
For this, you need to edit code/core/Mage/Directory/Model/Currency.php
- Open code/core/Mage/Directory/Model/Currency.php
- Find the following :-
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
}
on line no 194
on line no 194
change this code to:-
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
}
0 - Denotes the precision point for price..
But wait, you are still not done. The most important thing is still left.
- Clear the Cache.
- Go to System –> Cache Management
- Refreh Cache.
- If you have not enabled the Cache OR if it didn’t work even after refreshing the cache, then
- delete the cache folder present inside var (var/cache)
You can also refer to the video showing how it actually works
You can also refer to the video showing how it actually works
For any magento customization contact :
Company : Parsys Media
Mumbai Office :
Mobile No : +91-8123481528(Ashish Khadpe)
Thanks! However, does this also remove the decimal from the shopping cart? I need the decimal in the shopping cart due to taxes. This needs to apply on the front & back end.
ReplyDeleteModgirl
ReplyDeleteThen you have to make changes in files like view,new,list.phtml
Which is against the concept of CMS
I followed the procedure. in most products the decimals are disappierd. But with some products the decimals are still there. If products have customer options the decimals stay. I think the prices of the options are still with decimals?
ReplyDeleteI've gone through the whole procedure
Hey Bruno
ReplyDeleteWe are not changing the price of products just while displaying we are trimming the floating numbers present in the price so floating numbers are still associated with products. If you can provide me the link where you are still getting decimal we can suggest you some solution.
Hi Magento Coders,
ReplyDeleteI am facing the same issue, decimals are still there if product has product option.
Can you please help us.
ReplyDeleteThanks
Hi, I am using Community 1.6.1.0 and have simple products with custom options/prices. Prices need to be displayed in JPY Yen. The above solution appears to work on simple products with no options, but the products with options still display the .00 when the option is chosen. Ironically the drop down for the option displays the additional cost of the option without the decimels, but the main price with the option selected still shows the decimels. Could this be in a js file? I'm lost... Thanks in advance.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteIs it more difficult or easier than change locale setting in http://xme.im/format-magento-currency-or-number-base-on-locale
ReplyDeleteIs there any extension can do this?
is it changing the core files?
ReplyDeleteCan you help me remove decimals in magento go version? info@babyshop.cl
ReplyDeleteHi Magento Coders,
ReplyDeleteI have Removed it from my website RS 2600.00 to RS 2600 Successfully thank you so much for shareing great idea here...
Hi Magento Coders,
ReplyDeleteWhen i add custom option in my product than Price get .00
How i can solve this problem... please help me
HI Chhatrapal, I am having the same problem... Were you able to figure it out?
Deleteyou need to also update In js/varien/js.js
DeleteI changed
var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision;
var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;
to
var precision = 0;
var requiredPrecision = 0;
Hi Magento Codes
ReplyDeleteHow can edit RS0.0 to Rs 0.0?
How i can solve this problem...Please help me.
thank you very much
ReplyDeletei am getting four decimal when i minify my js and css ...all setting for 2 ,can you help me?
ReplyDeletedon't work with magento 1.7.0.2
ReplyDeleteThank you so much, very helpful
ReplyDeleteFor people in trouble with this, I found what I guess it's a better solution since it doesn't touch Magento core source:
ReplyDeletehttp://stackoverflow.com/questions/20900966/magento-price-formatting-2-or-3-decimal-places
Hi I want to change weight decimal precision in admin catalog/product in general tab.
ReplyDeletesee the link.
http://dev-demo.info/weight.jpg
please suggest
thanks
HOW TO INSTALL MAGENTO EXTENSION ???
ReplyDeleteMagento Hide Price
This comment has been removed by the author.
ReplyDeleteIt has changed only frontend, but not the backend .Please let me know , how can I change to admin also.
ReplyDeleteGreat Read! I am impressed on how you make your article easy to understand. I'll come back for more :D
ReplyDeleteFor more tutorial and tips about web design and web development you can follow me here -> http://alwaysopencommerce.com/http://alwaysopencommerce.com/
Nice blog and Thank you for sharing. Visit our magento development company India
ReplyDeletePrice calculation total problem
ReplyDeleteEx:
Grand Total Excl. Tax $34.95
Tax $4.54
Grand Total Incl. Tax $39.49
--------------
Subtotal $34.95
------------
changed the price to 0 but Subtotal value not correctly added
Ex:
Grand Total Excl. Tax $35
Tax $5
-------------
Grand Total Incl. Tax $39
--------------
Please Help to solve
schick quattro titanium - stainless steel & chrome - TiNanium Arts
ReplyDeleteStainless steel & chrome are titanium dioxide sunscreen solid steel. titanium 4000 We are chrome tungsten titanium based titanium dioxide and have seen stiletto titanium hammer excellent performance in the wet bar, wet bar, and powder.