Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Havouza

Rounding

Recommended Posts

Is there a possible setting to make all prices 00 in the end, like 123.00 instead of 123.45

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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)

Share this post


Link to post
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)

 

Share this post


Link to post
Share on other sites
21 hours ago, led24ee said:

When I place this on 1 there is still two places after dot, but it is rounded.

That's not intended, there are currencies which actually want no digits after the decimal. Still glad to see this "misbehavior" matches what you want.

  • Like 1

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

What version of TB is in use ? In my shop this works exactly what You expect.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Looks like it is changed. I just checked and now it removes decimals.

There is also possibility to make changes for every currency. Try this too. Maybe this will help.

Share this post


Link to post
Share on other sites
11 hours ago, oliver said:

I'm using TB 1.1.0

1.1.x Bleeding edge is the way to go, as its way more updated.

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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...