I am looking to add table rates for shipping within Australia in Magento 1.8.
The store is based in Australia and only ships to Australia. When I attempt to import the following CSV, Magento spits out an error stating that the "File has not been imported" and the codes are "invalid".
"Country","Region/State","Zip/Postal Code","Order Subtotal (and above)","Shipping Price"
"AU","*","*","250","0"
"AUS","VIC","*","0","11"
"AUS","NSW","*","0","12"
"AUS","QLD","*","0","13"
"AUS","ACT","*","0","14"
"AUS","NT","*","0","15"
"AUS","WA","*","0","16"
"AUS","SA","*","0","17"
"AUS","TAS","*","0","18"
I know of and have used the fontis extension in the past but don't like how bloated it is with the extra features i have no use for.
After some poking around in the tables i found the following solution.
Firstly you need to add the states you require to the directory_country_region
table. Make sure this is auto incrementing and use AU
for the country_id
.
I ran the following query:
INSERT
INTO `your-database-name`.`directory_country_region`
(`region_id`, `country_id`, `code`, `default_name`)
VALUES
(NULL, 'AU', 'VIC', 'Victoria'),
(NULL, 'AU', 'NSW', 'New South Wales'),
(NULL, 'AU', 'QLD', 'Queensland'),
(NULL, 'AU', 'ACT', 'Australian Captial Territory'),
(NULL, 'AU', 'NT', 'Northern Territory'),
(NULL, 'AU', 'WA', 'Western Australia'),
(NULL, 'AU', 'SA', 'South Australia'),
(NULL, 'AU', 'TAS', 'Tasmania');
After these rows have been inserted take a note of their respective region_id
for use in the directory_country_region_name
table.
I ran the following query line by line. Make sure you update the region_id
to match the id created in the last query.
INSERT
INTO `your-database-name`.`directory_country_region_name`
(`locale`, `region_id`, `name`)
VALUES
('en_AU', '485', 'Victoria'),
('en_AU', '486', 'South Australia'),
('en_AU', '487', 'Western Australia'),
('en_AU', '488', 'Northern Territory'),
('en_AU', '489', 'Queensland'),
('en_AU', '490', 'New South Wales'),
('en_AU', '491', 'Australian Capital Territory'),
('en_AU', '492', 'Tasmania');
Now create a new account using an Australian address and notice that we now get a drop down with these values populated! Huzzah!
I can now import my CSV inside table rates in Magento without issue.
"Country","Region/State","Zip/Postal Code","Order Subtotal (and above)","Shipping Price"
"AUS","*","*","250","0"
"AUS","VIC","*","0","11"
"AUS","NSW","*","0","12"
"AUS","QLD","*","0","13"
"AUS","ACT","*","0","14"
"AUS","NT","*","0","15"
"AUS","WA","*","0","16"
"AUS","SA","*","0","17"
"AUS","TAS","*","0","18"
I would love to make this query automatically use the region_id
from the directory_country_region_name
table, if anyone has any hints on how this can be improved I would greatly appreciate it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.