Jump to content

Rounding quantities


eporedieis
 Share

Recommended Posts

Hi, I'm new in Prestashop. I'm creating a new template for a little shop but I have a big problem.

I have to sell products that are in boxes, so I need to round the user wishes quantities to boxes.

 

I think I need two values to do this: the input quantity and a variable with the quantity-per-box of each product (defined in the backoffice). If the first is 10 (square meters) and the second 1.5 (square meters / box), I need to do 10:1,5 and round the result to the unit (6,67 become 7). Multiplying 7 (boxes) for 1,5 (square meters / box) I have 10,5 (sq.m), that I can now show in a label.

 

But... I don't know how to do this :( and I've found no topics about this!

 

Anyone could help me please? Thanks!

Edited by eporedieis (see edit history)

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
 Share

×
×
  • Create New...

Important Information

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