18
I am trying to make the freight calculation of various products using the Webservice of the post office, but I am having doubts/difficulty to perform the calculation when I have several products.
I am using the PHP code to call the webservice and receive the return in XML. This call is correct. I can call and receive values correctly. My question is more in the logic of how to calculate and process when I own a shopping cart with more than one product.
I know that I must pay attention to the calculation based on the dimensions (height, width, length and weight), I also know that in this case the calculation is based on cubic weight, as documented.
However, the parameters that I must fill in to perform the calculation do not provide a field to send more than one product. In this case, how should the calculation be made?
Do I sum the dimensions in a "raw" way? Ex.: 2 products of dimensions:
- A: 10cm, L: 15cm, C: 22cm
- A: 8cm, L: 31cm, C: 18cm
- Total: A: 18cm, L: 46cm, C: 40cm
And I send these sums?
When I do this I can even get the result, but it doesn’t seem right, being that sometimes the difference in freight is very big. Ex.:
- Shipping product A: R$18,00
- Shipping product B: R$21,00
- Freight sum A+B: R$88,00
Does anyone have experience with this kind of service that can help me?
In order to facilitate understanding, the data concerning the product(s) received by the postal service website are::
- nVlPeso: ex: 4 (for 4kg);
- nVlCompriment: ex: 10 (for 10cm);
- nVlAltura: ex: 15 (for 15cm);
- nVlLargura: ex: 20 (for 20cm);
- nVlDiametro: *non-compulsory
There is, for example, an option for more than one item, only this data.
The best is to try to assemble in 3D (or 2D for didactic purposes) as the product would look together. You will see that adding up in the three dimensions is having too much empty space
– Jefferson Quesado
Is using mail packaging or own?
– Randrade
@Randrade At first using only own packaging. Some products already have factory packaging.
– celsomtrindade
What happens when the product already has its own packaging? You would group it into a single package or send it in separate packages?
– Randrade
@Randrade is difficult to answer, because it depends a little. Some cases can only be "tied up", or, for example, wrapped with brown paper. Some, from what I’ve seen, don’t go by the post office rules, so it would have to be separate packages. Already others are small and you can put several in one box.
– celsomtrindade
@Randrade to put in context, are petshop products. From medicines, toys, feed bags (1,3,5,10kg), etc..
– celsomtrindade