Jump to content

price rounding depending on currency in tools.php


cilecek

Recommended Posts

hello,

need little help to modify tools.php for setting price rounding of specific currency.

what must be instead of CURRENCY_ID?

 

if ( CURRENCY_ID == 5) 
{
switch (Tools::$round_mode)
{
case PS_ROUND_UP:
return Tools::ceilf($value, $precision);
case PS_ROUND_DOWN:
return Tools::floorf($value, $precision);
case PS_ROUND_HALF_DOWN:
case PS_ROUND_HALF_EVEN:
case PS_ROUND_HALF_ODD:
return Tools::math_round($value, $precision, Tools::$round_mode);
case PS_ROUND_HALF_UP:
default:
return Tools::math_round($value, 0, PS_ROUND_HALF_UP);
}
 
 
Link to comment
Share on other sites

 

hello,

need little help to modify tools.php for setting price rounding of specific currency.

what must be instead of CURRENCY_ID?

 

if ( CURRENCY_ID == 5) 
{
switch (Tools::$round_mode)
{
case PS_ROUND_UP:
return Tools::ceilf($value, $precision);
case PS_ROUND_DOWN:
return Tools::floorf($value, $precision);
case PS_ROUND_HALF_DOWN:
case PS_ROUND_HALF_EVEN:
case PS_ROUND_HALF_ODD:
return Tools::math_round($value, $precision, Tools::$round_mode);
case PS_ROUND_HALF_UP:
default:
return Tools::math_round($value, 0, PS_ROUND_HALF_UP);
}

 

 

Try with "$this->context->cart->id_currency"

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