Jump to content
thirty bees forum

Rounding


Havouza

Recommended Posts

Well, "Number of decimals" rounds to the given decimals, but also doesn't display additional ones. For example, rounding to full Euros works, but also displays it as € 123 rather than € 123.00.

I'm pretty sure one could add some CSS to always add .00 to prices.

Link to comment
Share on other sites

Well. In my shop this "Number of decimals" does exatly what asked. When I put this on 2 there is two places after dot. When I place this on 1 there is still two places after dot, but it is rounded. So there is 123.50 instead of 123.45 And if there is 0 then it is 123.00 instead of 123.45 (TB1.1-Bleeding ...., Niara)

Link to comment
Share on other sites

14 hours ago, Traumflug said:

Well, "Number of decimals" rounds to the given decimals, but also doesn't display additional ones.

This is not what a shop system should do. However, I guess you can use a Smarty statement In the product.tpl to format the price:

{$price|string_format:"%.2f"}

Or use number_format

{$price|number_format:2} will output 10,00 (EU standards)
{$price|number_format:2:",":"."} will output 10.00 (US standards)

 

Link to comment
Share on other sites

  • 4 months later...

Hmm, I'm actually a bit confused on this...

I'm just now switching over from PrestaShop. In my old shop, I've gone to Preferences -> Number of decimals and set it to 0, which made it so that $123 was shown, rather than $123.00

With Thirtybees, it does however show as $123.00 (which I don't like)

I see my template uses {convertPrice price=$productPrice|intval} which is the same that the default TB template uses.

Now sure, I could use smarty and do my own rounding and removing of decimals... But $productPrice doesn't contain the currency symbol! 

I see there's some improvements are in the works: https://github.com/thirtybees/thirtybees/issues/865

 

But in the meantime, I'm left unsure on what to do... How can I get rid of the decimals, if not by going to Preferences -> Number of decimals and setting it to 0 ?

Hardcoding this into my template seems like a bad solution.

What exactly is this setting supposed to do anyways?

Link to comment
Share on other sites

On 1/28/2020 at 4:45 AM, led24ee said:

Well. In my shop this "Number of decimals" does exatly what asked. When I put this on 2 there is two places after dot. When I place this on 1 there is still two places after dot, but it is rounded. So there is 123.50 instead of 123.45 And if there is 0 then it is 123.00 instead of 123.45 (TB1.1-Bleeding ...., Niara)

Well, what you describe is not what I personally expect, lol

Unless the behavior has changed since you wrote this.

I'm using TB 1.1.0

Link to comment
Share on other sites

There are (at least) two ways to format prices. One is the way you used.

The other way can be found in back office ->Localization -> Currencies -> (edit currency). There one can turn off 'auto format' to get additional options. And even the ability to show one currency with decimals and another one without.

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Traumflug said:

There are (at least) two ways to format prices. One is the way you used.

The other way can be found in back office ->Localization -> Currencies -> (edit currency). There one can turn off 'auto format' to get additional options. And even the ability to show one currency with decimals and another one without.

Woohoo! This worked, thank you! 🙂

I'm gonna have to do some research on how to get TB 1.1.x Bleeding edge ... Do you pull that directly from the repo?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...