An Irish Module for Magento

I had been meaning to write a small “Ireland” module for Magento for a while but only got around to it last week.

It has 2 pieces of functionality:

  1. It adds the counties of Ireland (including Northern Ireland), into the ‘directory_country_region’ table of the Magento database so the list of Irish counties appears when you change the country to Ireland on any of the forms in Magento (checkout, cart, etc.)
  2. It adds a shipping method for An Post, the national postal carrier of Ireland.

There’s nothing much to say about part 1, but there’s a few points I’d like to mention about part 2:

  • The code is based on WebShopApps MatrixRate module (–the-original-multiple-table-rate-solution–certified-bug-free). It’s a really great module and would recommend it for anyone who needs to use tablerates as their shipping method.
  •  The main advantage of this module is that it provided partial postcode matching out of the box. So it was easy to setup an “all–Ireland” rate since all Northern Ireland postcodes start with “BT”. Just give all “GBR” shipping destinations with postcode starting with “BT” the same cost as the Irish rate.
  •  The next issue, which I’ve come across a number of times, is the concept of an EU rate and a non-EU European rate. Rather than having to put in the same rates 27 times to account for each EU country, and another 10 or 20 times for the non-EU countries, I decided to custom code things. I put the value of “EUR” and “!EU” into the database to denote EU and non-EU respectively. When retrieving rates, I check to see if the country code (e.g., ‘DE’ for Germany) is in an array which contains all the country codes for EU and non-EU countries respectively. If so, I return the EU/non-EU shipping rate. 5-10 lines of code saving thousands of lines in the database/CSV.
  •  Matrixrate is based on importing a CSV with the desired rates. So first I created a CSV for all the different zones (Ireland, UK, EU, Non-EU, Rest of the World) with all the different shipping options An Post offers (Standard Post, Registered Post, Express Post, Courier Post) and imported that. I then made a backup of the resulting database table and put the SQL for this table into the installer script for the module.
  •  Finally, I should point out that An Post has different rates based on what type of package is being sent (Envelope, Large Envelope, Packet, Package). Envelope and Large Envelope are ignored in this module. There is an assumption that Packets are used for the lightest shipments, and Packages are used thereafter. I think this is a reasonable assumption – take a look at the An Post rates on their website here –

Anyway, if you’re interested in using the module, you can find it here:

Alan Morkan
Alan Morkan |