Jump to content

[SOLVED] Round price


Recommended Posts

Hello guys,

I got a page in my website were I call price of each product with this variable I created in FrontController :

 

"

public static function getProductPriceTI($id){
$product = new Product ($id,Context::getContext()->language->id);
return $product->getPrice();
} (for Taxes included price)
 
public static function getProductPriceTI($id){
$product = new Product ($id,Context::getContext()->language->id);
return $product->getPrice(false);
} (for Taxes excluded price)

"

 

I'd like to round the price with an INT, but I don't know where to put it

Edited by PsychoZzzorD (see edit history)
Link to comment
Share on other sites

Okay I got the answer x)

When you call the function in your .tpl like that 

 

"

{FrontController::getProductPriceTI(9)}

"

 

Just add "|intval" after the function like that

 

"

{FrontController::getProductPriceTI(9)|intval}

"

Edit : It's rounding down everything, bad method

Edited by PsychoZzzorD (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

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