Jump to content

Little old decimal point removal in prices


magj

Recommended Posts

Hi

 

I've had this issue but no answer to it is found,

 

I want to remove decimal points from prices in all views like quote ....., I changed the format of default currency to 1,234 but I see the numbers come with .00 decimals. How can I remove them?

 

It seems not be possible, isn't it?? Even with tweaking the smart tags with something like: {$total|number_format:0} !

 

Any help would be greatly appreciated

Regards

Link to comment
Share on other sites

it won't work using number_format as some of these variables aren't just numbers (e.g they also include currency symbols etc)...

 

I can think of two ways to do this...

 

if you want to go down the Smarty route of editing the templates, you could use...

 

{$total|regex_replace:'/[.,][0-9]+/':''}

that should remove the two decimal places from the value...

 

the other way would be to modify the database table structures and change the decimal setting from '2' to '0' - similar to the procedure outlined below...

 

http://forum.whmcs.com/showthread.php?90090-More-demicals-in-configurable-options&p=379431#post379431

 

although if you are unfamiliar with modifying MySQL structures, then I wouldn't suggest trying this on a live whmcs site! quoting one of the whmcs support guys...

 

Shouldn't be any adverse effects from this work around but, as always, this has not been fully tested and cannot be supported by WHMCS. So be sure to test the changes before you apply them to a production install of WHMCS.

also, it's entirely possible that some of the values are coded to show to 2 decimal places regardless of the database setting, so changing the db structure to 0 decimal places might not always work.

 

I assume that you aren't adding tax to your prices as that would have to be calculated exactly and not rounded to 0 decimal places.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated