Sunday, February 26, 2012

magento shipping table rates import

Magento shipping method have to be set in 2 different environment.
One on config, and another on site.
To import or export the rates, you will need to select "site" / "Default sites" to have the options to import the rates.
Before setting up these rates, you will have to ensure that you have setup the regions / states on your targeted countries to market.
Its can be set manually in database table on table:
directory_country_region.
Once you have set it, you may run this script to insert the name to the translation table for region name:
directory_country_region_name
If you are lazy like me, i will just run this SQL script below to populate the name to the directory_country_region_name table:

INSERT INTO `directory_country_region_name` (`locale`, `region_id`, `name`) 
SELECT 'en_US', `region_id` , `default_name`
FROM `directory_country_region`
WHERE country_id='ID';

You will have to make sure that the directory_country_region.code field contain a unique code for your state / region. It's a norm to use countrycode-statename to ensure it is unique for every states you setup.
Example: ID-SUMUTR
which represent indonesia: sumatera utara.
In the import CSV, this will be the format of the csv (as of magento 1.6):
Country, Region/State, Zip/Postal Code, Order Subtotal (and above), Shipping Price
Notes:
Country should contain short 2 alphabet code of the country, such as ID = Indonesia
Region/state field will be the field to contain the region/state code.
Order subtotal is optional (0)
Zip / Postal code is optional (empty)
Shipping price will be the price in shop currency.





No comments: