Jump to content

Recommended Posts

Hello Everyone,

 

In excel, i have =ROUNDUP(cell,2) which rounds up the number differently than prestashop, example:

 

if in the cell i have 0.6108838 will equal to 0.62... where as in prestashop it shows up as 0.61

 

how can i fix this issue? what do i have to do to roundup the same way that excel does it?

 

 

 

 

I also came across this:

 

Excel-like ROUNDUP function:

public static function round_up($value, $places) 
{
    $mult = pow(10, abs($places)); 
     return $places < 0 ?
    ceil($value / $mult) * $mult :
        ceil($value * $mult) / $mult;
}

echo round_up(12345.23, 1); // 12345.3
echo round_up(12345.23, 0); // 12346 
echo round_up(12345.23, -1); // 12350 
echo round_up(12345.23, -2); // 12400 
echo round_up(12345.23, -3); // 13000 
echo round_up(12345.23, -4); // 20000

 

 

but how can i implemennt this in prestashop ?

Thannk you so much

Edited by televi (see edit history)

Share this post


Link to post
Share on other sites

In  the Preferences > General tab in the Back Office, could you check the value in the "Number of decimals" field? This should be two, for the behaviour you described.

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More