The CSV file can seem confusing at first, but spend 5 minutes with it and you will understand how it works, and see the flexibility it offers.
A CSV file is best opened with a spreadsheet application. At WebShopApps we prefer OpenOffice as it will save correctly on a Mac without issue and uses UTF-8.
Some facts about CSV configuration:
- CSV tables are extensively used in our shipping extensions for creating rules
- CSV files basically define the rules under which a shipping rate will show. Each row is a rule
- If you don’t understand your shipping requirements you have little chance to make a CSV file that works. Get the requirements understood first
- A CSV configuration is only as good as the person that writes it. If you write a bad CSV file then expect bad results
- In order to set up the If you have no experience of spreadsheets/csv files then go look this up first, it will help
- If you are working on a Mac please ensure you save as Windows file type, else the csv will not upload
- The shipping extension works on a “best match” basis. This means it will look for the tightest match first, and then work backwards if none can be found. If you have two rows in the table, one with country code “US” and one with “*”, then a customer from the US will match on the US row, and a customer from UK will match on the “*” row.
With Shipping Extensions there is a need for our customers to translate business requirements into a configuration file and settings. This isnt like a standard plug and play extension, you are going to have to do some work to configure as you need.
WebShopApps can assist with configuration in many ways. For those of you looking at a cheaper solution checkout the examples, screencasts and documentation. For those in a hurry then take a look at our support packages, in terms of time saved they are definitely worth their money!
How to Upload a CSV File
- Navigate to your Extension Configuration panel under
System->Configuration, it will usually either be in
Current Configuration Scope to be Main Websiteor the WebSite you wish to upload to in the case of multiple stores
NB: If the import button is present on the default configuration scope, this will apply the CSV to all websites that have “Use Default” selected next to the import button.
- You should now see an import button box appear with a browse box
- Browse for your CSV file you have setup (or use an example)
- Save Config to import the table. Any errors in the CSV will be reported here
- You should then see the appropriate shipping rates appear on the front end upon checkout
How to Export a CSV File
Every time you upload a CSV file a backup of that file is saved to your file system. This can be found under
<Magento Install directory>/var/export/<your csv file name>.csv.
Unlike the import button, the export button is only present at the website configuration scope.
CSV files are also timestamped and have the extension name on them.
Therefore if you have misplaced your CSV file and need to edit your rates just take a copy of this file, edit it and re-upload it to your extension. No need to re-create your CSV file or look in the database.
If the CSV cannot be exported, a blank CSV file will be exported.
Exporting The CSV via phpMyAdmin
Alternatively, if the solution above is not appropriate, you can export the raw shipping data using phpMyAdmin. This data has been manipulated to get into the database so bear in mind that you will need to translate it back into a csv importable format.
- Find the table called
shipping_productmatrix and click on it
- Select the export tab at the top of the page
- Select the export as CSV option
- Export the csv
- Remove the columns “pk”, “website” and “cost” from the CSV file
- If applicable change the region codes back to region names
- If there is a “0” in the region column you need to delete this as Magento will see it as an invalid code when uploading
- Check the csv columns match the template csv for your extension
You should end up with a CSV file similar in layout to the screenshot below (ProductMatrix is shown):