Most e-commerce sites that sell physical goods that may be dispatched to many different places, usually have solve the problem of calculating the shipping costs, so the clients may know how much the products will cost before closing a sale.
The problem is that shipping costs may vary according to many factors like the origin and destination of the shipping, weight of the packaged products, size of the packages, etc..
This class provides a solution for calculating the cost of shipping products in Brazil either by using information obtained from locally stored files or connecting to local post office company site.
While this is a country specific solution it may serve as base of inspiration for solutions specific to other countries.
This class is meant to calculate the postage cost of a deliverying a package in Brazil given the package weight and the postal codes of the origin and destination cities.
It can be used to calculate total shipping costs of deliverying products sold by e-commerce sites.
The postage cost is calculates automatically by the class by accessing the site of the Correios post company or by looking up on CSV files.
The code and the comments are in Portuguese.
In Portuguese:
Esta classe serve para calcular o frete para enviar uma encomenda no Brasil dado o seu peso e o CEP das cidades de origem e destino do envio.
A classe pode ser usada para calcular o custo total do envio de produtos vendidos por sites de comércio eletrônico.
O cálculo do frete pode ser feito automaticamente pela classe acessando o site dos Correios ou usando arquivos locais em formato CSV.