I'm trying to work out a freight system for a company but I have a problem. Thus, it follows:
- The freight itself is calculated by the Post system that accesses through an API;
- I have already done everything on the Post Office website to perform the freight calculation queries;
For the Post Office API, height, width, weight, and length are required. These values, in turn, are obtained from the customer database according to the product to which the freight is to be calculated.
I need the system to get the largest value of length and width and add the height and weight of each produto($id)
contained in the cart. I need this calculation to be done, for example, to place one box on top of the other and not side by side because the smaller boxes will always be placed on the top of the larger ones. Prevents damage to customer and supplier.
I can not think of a way to solve this problem. Any ideas?