For ecommerce website design call 020 3544 8132


Magento table rates for UK delivery

Set up Magento table rates for UK Delivery

We had been working on a Magento ecommerce website this week which called for the use of Magento table rates for UK delivery.  The client wanted to be able to set different prices for the different postcode areas in the UK.  Our postcode area table is just 127 lines, covering the first 2 characters of the postcode (not the 3000 line table covering every possible postcode area).  Using this short version makes it easy for our client to handle and quick and easy for us to set-up.

The problem is, Magento table rates is set-up to check the postcode exactly against the table rates database. For example, our database has the “CM” postcode area listed, but if a customer enter theirs full UK postcode against this it will not match and therefore they will not be able to select the shipping option.

We have worked out a way around this, changing just one line of code in the Magento code folder.  What’s more, we are giving you our magento tablerates CSV file for free to help you get your magento table rates shipping set up for the UK postcode areas. I know, we are nice, feel free to send us gifts and flowers to the usual office address!Magento table rates for UK

Here is what you need to do:

1) Download our tablerates CSV file here

2) Using FTP locate this file in your magento install – app/code/core/Mage/shipping/Model/resource/carrier/tablerate.php

3) Open this file in your favorite editor and scroll down to line 123

4) Change this code - ‘:postcode’ =>$request->getDestPostcode() to this – ‘:postcode’ => (substr($request->getDestPostcode(),0,2))

5) Upload the updated file

6) Go to your admin panel,  Configuration / Shipping Methods / Table Rates

7) Enable Table Rates and select the file you have downloaded above in the Import box.

8) Press save and your good to go!!

We are using Magento 1.7 for this and it has worked perfectly, I have not tested this on older versions.
I hope this is of some help, so you are not all sat searching for hours trying to find a fix for this problem.
If you have a better way of doing this or improvement on our method, please let us know below….

Read more →