Post by stendec » Wed Mar 30, 2011 8:03 pm

Hi

Haw can I remove decimal zeros in Dimensions from product.tpl

v1.4.9.3

Newbie

Posts

Joined
Wed Mar 30, 2011 7:53 pm

Post by sans » Wed Mar 30, 2011 10:23 pm

Try this guide:
1. Open your database using phpmyadmin
2. Open tabel product
3. Edit field length, width and height by set (5,2) to (5,0) and set (0.00) to (0).

Active Member

Posts

Joined
Tue Dec 07, 2010 9:18 am

Post by stendec » Thu Mar 31, 2011 2:57 am

Perfect! snx

Newbie

Posts

Joined
Wed Mar 30, 2011 7:53 pm

Post by michal777 » Thu Jul 07, 2011 9:37 pm

Thank you!
It works!

Newbie

Posts

Joined
Sun Jun 05, 2011 2:42 am

Post by ddowdall » Wed Sep 07, 2011 7:23 am

Thank you!

Also if you want to remove the extra zero's from the price of products or specials, go to product or product_specials table in database and change the decimal format for the price field.

New member

Posts

Joined
Tue Dec 07, 2010 2:06 am

Post by tgulley » Tue Jan 29, 2013 9:12 pm

ddowdall wrote:Thank you!

Also if you want to remove the extra zero's from the price of products or specials, go to product or product_specials table in database and change the decimal format for the price field.
If I adjust the decimal format of the 'product' or 'product_specials' tables, they just automatically go back to the way they were (OC v1.5.4.1). I know I can change the currency decimal options, but I don't want to globally remove cents since I like offering $4.99 flat rate shipping instead of $5 flat rate shipping (although i suppose that's not so bad). Any advice?

Newbie

Posts

Joined
Tue Sep 25, 2012 2:56 am

Post by tgulley » Tue Jan 29, 2013 9:20 pm

tgulley wrote:
ddowdall wrote:Thank you!

Also if you want to remove the extra zero's from the price of products or specials, go to product or product_specials table in database and change the decimal format for the price field.
If I adjust the decimal format of the 'product' or 'product_specials' tables, they just automatically go back to the way they were (OC v1.5.4.1). I know I can change the currency decimal options, but I don't want to globally remove cents since I like offering $4.99 flat rate shipping instead of $5 flat rate shipping (although i suppose that's not so bad). Any advice?
Never mind, found it!

Edit: system/library/currency.php

Replace: return $string;

With: return str_replace('.00','',$string);

Works like a charm!

Newbie

Posts

Joined
Tue Sep 25, 2012 2:56 am

Post by unseenmagik » Tue Apr 30, 2013 7:27 pm

Hi All,

Sorry to revive and old thread. I have done the above suggested modification in the database but im still not getting the length to change or reduce the decimal place's.

Can someone advise please.

Please see screenshots attached to help.

Attachments

Capture.PNG

Capture.PNG (81.17 KiB) Viewed 10192 times

Capture2.PNG

Capture2.PNG (175.03 KiB) Viewed 10192 times


New member

Posts

Joined
Tue Jul 17, 2012 5:27 pm

Post by IP_CAM » Wed Mar 19, 2014 12:35 pm

Image

after installing the Weight on my OpenShop 1.6 (V1.5.6.1 OpenCart), I want to remove the extra zero's from the Weight as well as from Product Dimension, wich is planned also to get visible on the Product Page.

I have tried all kinds of stuff using the built-in SQL-Manager as well as trying to redo the Product-Detail , but I was unable to get rid of those nasty .000000000

I need some kind of REGEX in order to supress those numbers, but for PHP, I don't know where to place something in order to get it done.

Any Help or advise??

Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by JeffB » Sun Dec 13, 2015 1:36 am

For anyone trying to remove those extra .0000000 I hope this is helpful.

Go to your PHPMyAdmin and find oc_product. Click on the "Columns" tab. Find weight, price, dimensions, etc... that have the extra 0's. Press "change." Change the value from "15.8" to 15.0" or "15.1". The number after "15" is the number of 0's. Press "Save".

This answer was found at: http://forum.opencart.com/viewtopic.php?t=65366

"Example, open your database and open coupon table structure, as you can see discount and total has Type decimal(15,4), that means it will add four zeros after digit like 10.0000. If you don't want any zero's than simple change Type to decimal(15,0) it will automatically remove all decimal places." Thanks opcrat!

Newbie

Posts

Joined
Wed Sep 23, 2015 1:30 am

Post by kkozakewich » Tue Feb 28, 2017 4:03 am

It took me a while to figure this out, but if you modify this line, it will remove the decimals from any prices that end in zeros.
Ex. $9.99 -> $9.99, $9.00 -> $9, $10.00 -> $10

This is perfect for sites that use zero decimal places, but need to calculate taxes to the penny and include them in the final total at the end.

Edit: system/library/currency.php
Replace: return $string;
With: return strcmp(substr($string, -3),'.00') ? str_replace('.00','',$string) : $string;

I used it for this website here: http://TrendBuffs.com, and will also be using it for http://ModernTrackers.com

Newbie

Posts

Joined
Tue Feb 28, 2017 3:58 am

Post by elsa » Mon Aug 14, 2023 1:18 am

This is not removing the decimals from the frontend in OC 3.0.3.7. It only removes the decimals on the backend.

Newbie

Posts

Joined
Sun Mar 19, 2023 6:40 pm
Who is online

Users browsing this forum: Google [Bot] and 21 guests