Reputation: 307
I need to make Opencart round the total weight of the cart up to the next whole kg and calculate shipping on that. So for example if my cart weights 4.3kg I need the cart to calculate shipping on 5kg. How can I do this?
Upvotes: 0
Views: 426
Reputation: 31
You should be able to achieve this using the ceil()
function in PHP.
The ceil()
function is used to round fractions up, thereby returning the next highest integer value by rounding up if necessary.
Usage example:
echo ceil(4.3); // 5
echo ceil(4.9); // 5
echo ceil(-4.5); // -3
If you are getting the value using MySQL statement then you will do something like
SELECT CEIL(4.3);
which will round the number up to 5.
Upvotes: 1