If you are doing business ONLY in the UK, you can completely re-structure the countries and zones data to a customized list.
We needed to configure UK to comply with shipping rates for Royal Mail and Parcelforce24...
We did this by:
- deleting ALL default countries and zones (so the database is EMPTY of countries)
Then we set up a list of NEW "countries":
- England
- Wales
- Scotland
- Scottish Islands
- Scottish Highlands
- Isle of Man
- Isle of Wight
- Isles of Scilly
- Channel Islands
- Northern Ireland
- We "invented" the 2-digit and 3-digit ISO codes, as these do not exist in reality, but need to be in the ZC database.
England: EN - - - ENG
Wales: WS - - - WLS
Scotland: SD - - - SLD
Scottish Islands: SI - - - SIL
Scottish Highlands: SH - - - SHL
Isle of Man: IM - - - IMN
Isle of Wight: IW - - - IWT
Isles of Scilly: IS - - - ISC
Channel Islands: CH - - - CHI
Northern Ireland: NI - - - NIR
- We then applied the appropriate COUNTIES (zones) to the above "Countries", so,** for example:**
Wales has the following zones (Counties):
- Merthyr Tydfil
- Caerphilly
- Blaenau Gwent
- Torfaen
- Monmouthshire
- Newport
- Cardiff
- Vale of Glamorgan
- Bridgend
- Rhondda Cynon Taf
- Neath Port Talbot
- Swansea
- Carmarthenshire
- Ceredigion
- Powys
- Wrexham
- Flintshire
- Denbighshire
- Conwy
- Gwynedd
- Anglesey (Ynys Môn)
- Pembrokeshire
- Clwyd
- We then did the same for all the remaining "countries", remembering that (for example) the "country" Isle of Man, has justr ONE zone - also called "Isle of Man". Same for (countries) Scilly, Wight etc.
But (country) Scottish Islands has these zones:
- Orkney
- Shetland
- Hebrides
- Bute
... and (country) Channel Islands has these zones:
- Alderney
- Guernsey
- Jersey
- Sark
Do the same zone insertions for the remaining "countries",
England
Wales
Scotland
Northern Ireland
- Then you set the GEO ZONES - these are necessary to GROUP the countries and zones into shipping zones. For example, while ENGLAND, SCOTLAND and WALES are now all "countries" in their own right, they all form part of a larger group called UK MAINLAND (as these areas will all enjoy the same Royal Mail and Parcelforce24 rates)
We set up FOUR Geo Zones:
- UK MAINLAND
- UK OFFSHORE
- SCOTTISH HIGHLANDS
- CHANNEL ISLANDS
We now had the UK sorted into COUNTRIES, COUNTIES ZONES and SHIPPING ZONES.
Here is the SQL code we ran in phpMyAdmin to effect all the above changes in one swoop!
DO NOT RUN THIS QUERY ON A LIVE SHOP DATABASE. If you want to test it, then set up a TEST SHOP FIRST!
I take no responsibility for crashing your live database!
What you can do if phpMyAdmin scares you, is use this list (below) to see what COUNTIES apply to what COUNTRIES. Simply look at the Country ID (England for example is 244), then in the zones table, see what counties are listed against country code 244.
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Table structure for table `countries`
--
DROP TABLE IF EXISTS `countries`;
CREATE TABLE IF NOT EXISTS `countries` (
`countries_id` int(11) NOT NULL auto_increment,
`countries_name` varchar(64) NOT NULL default '',
`countries_iso_code_2` char(2) NOT NULL default '',
`countries_iso_code_3` char(3) NOT NULL default '',
`address_format_id` int(11) NOT NULL default '0',
PRIMARY KEY (`countries_id`),
KEY `idx_countries_name_zen` (`countries_name`),
KEY `idx_address_format_id_zen` (`address_format_id`),
KEY `idx_iso_2_zen` (`countries_iso_code_2`),
KEY `idx_iso_3_zen` (`countries_iso_code_3`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=254 ;
--
-- Dumping data for table `countries`
--
INSERT INTO `countries` (`countries_id`, `countries_name`, `countries_iso_code_2`, `countries_iso_code_3`, `address_format_id`) VALUES
(251, 'Scottish Islands', 'SI', 'SIL', 6),
(250, 'Scottish Highlands', 'SH', 'SHL', 6),
(241, 'Northern Ireland', 'NI', 'NIR', 6),
(242, 'Scotland', 'SD', 'SLD', 6),
(243, 'Wales', 'WS', 'WLS', 6),
(244, 'England', 'EN', 'ENG', 6),
(245, 'Isle Of Man', 'IM', 'IMN', 6),
(246, 'Channel Islands', 'CH', 'CHI', 6),
(253, 'Isle Of Wight', 'IW', 'IWT', 6),
(252, 'Isles Of Scilly', 'IS', 'ISC', 6);
--
-- Table structure for table `geo_zones`
--
DROP TABLE IF EXISTS `geo_zones`;
CREATE TABLE IF NOT EXISTS `geo_zones` (
`geo_zone_id` int(11) NOT NULL auto_increment,
`geo_zone_name` varchar(32) NOT NULL default '',
`geo_zone_description` varchar(255) NOT NULL default '',
`last_modified` datetime default NULL,
`date_added` datetime NOT NULL default '0001-01-01 00:00:00',
PRIMARY KEY (`geo_zone_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `geo_zones`
--
INSERT INTO `geo_zones` (`geo_zone_id`, `geo_zone_name`, `geo_zone_description`, `last_modified`, `date_added`) VALUES
(3, 'Channel Islands', 'Channel Islands', NULL, '0001-01-01 00:00:00'),
(2, 'UKMAIN', 'UK Mainland', 'NULL', '0001-01-01 00:00:00'),
(4, 'UKOFFSHORE', 'UK Off-shore', NULL, '0001-01-01 00:00:00'),
(6, 'Scottish Highlands', 'Scottish Highlands', NULL, '0001-01-01 00:00:00');
--
-- Table structure for table `zones`
--
DROP TABLE IF EXISTS `zones`;
CREATE TABLE IF NOT EXISTS `zones` (
`zone_id` int(11) NOT NULL auto_increment,
`zone_country_id` int(11) NOT NULL default '0',
`zone_code` varchar(32) NOT NULL default '',
`zone_name` varchar(32) NOT NULL default '',
PRIMARY KEY (`zone_id`),
KEY `idx_zone_country_id_zen` (`zone_country_id`),
KEY `idx_zone_code_zen` (`zone_code`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=497 ;
--
-- Dumping data for table `zones`
--
INSERT INTO `zones` (`zone_id`, `zone_country_id`, `zone_code`, `zone_name`) VALUES
(495, 252, 'Isles of Scilly', 'Isles of Scilly'),
(494, 253, 'Isle of Wight', 'Isle of Wight'),
(327, 241, 'Antrim', 'Antrim'),
(328, 241, 'Armagh', 'Armagh'),
(329, 241, 'Derry', 'Derry'),
(330, 241, 'Down', 'Down'),
(331, 241, 'Fermanagh', 'Fermanagh'),
(332, 241, 'Londonderry', 'Londonderry'),
(333, 241, 'Tyrone', 'Tyrone'),
(334, 242, 'Aberdeenshire', 'Aberdeenshire'),
(335, 242, 'Angus', 'Angus'),
(336, 242, 'Argyll', 'Argyll'),
(337, 242, 'Ayrshire', 'Ayrshire'),
(338, 242, 'Banffshire', 'Banffshire'),
(339, 242, 'Berwickshire', 'Berwickshire'),
(340, 242, 'Borders', 'Borders'),
(341, 251, 'Bute (islands of Arran and Bute)', 'Bute (islands of Arran and Bute)'),
(342, 242, 'Caithness', 'Caithness'),
(343, 242, 'Central', 'Central'),
(344, 242, 'Clackmannanshire', 'Clackmannanshire'),
(345, 242, 'Dumfriesshire', 'Dumfriesshire'),
(346, 242, 'Dumfries and Galloway', 'Dumfries and Galloway'),
(347, 242, 'Dunbartonshire', 'Dunbartonshire'),
(348, 242, 'East Lothian', 'East Lothian'),
(349, 242, 'Edinburgh', 'Edinburgh'),
(350, 242, 'Elgin', 'Elgin'),
(351, 242, 'Fife', 'Fife'),
(352, 242, 'Forfarshire (see Angus)', 'Forfarshire (see Angus)'),
(353, 242, 'Grampian', 'Grampian'),
(354, 242, 'Haddington', 'Haddington'),
(355, 250, 'Highland', 'Highland'),
(356, 250, 'Inverness-shire', 'Inverness-shire'),
(357, 242, 'Kincardineshire', 'Kincardineshire'),
(358, 242, 'Kinross-shire', 'Kinross-shire'),
(359, 242, 'Kirkcudbrightshire', 'Kirkcudbrightshire'),
(360, 242, 'Lanarkshire', 'Lanarkshire'),
(361, 242, 'Linlithgow', 'Linlithgow'),
(362, 242, 'Lotian', 'Lotian'),
(363, 242, 'Midlothian', 'Midlothian'),
(364, 242, 'Moray', 'Moray'),
(365, 242, 'Nairnshire', 'Nairnshire'),
(366, 251, 'Orkney', 'Orkney'),
(367, 242, 'Peeblesshire', 'Peeblesshire'),
(368, 242, 'Pembrokeshire', 'Pembrokeshire'),
(369, 242, 'Perth', 'Perth'),
(370, 242, 'Perthshire', 'Perthshire'),
(371, 242, 'Renfrewshire', 'Renfrewshire'),
(372, 242, 'Ross & Cromarty (inc part of Lew', 'Ross & Cromarty (inc part of Lew'),
(373, 242, 'Roxburghshire', 'Roxburghshire'),
(374, 242, 'Selkirkshire', 'Selkirkshire'),
(375, 251, 'Shetland', 'Shetland'),
(376, 242, 'Stirlingshire', 'Stirlingshire'),
(377, 242, 'Sutherland', 'Sutherland'),
(378, 242, 'Tayside', 'Tayside'),
(379, 242, 'West Lothian', 'West Lothian'),
(496, 251, 'Hebrides', 'Hebrides'),
(381, 242, 'Wigtownshire', 'Wigtownshire'),
(382, 242, 'Zetland', 'Zetland'),
(383, 243, 'Merthyr Tydfil ', 'Merthyr Tydfil '),
(384, 243, 'Caerphilly ', 'Caerphilly '),
(385, 243, 'Blaenau Gwent', 'Blaenau Gwent'),
(386, 243, 'Torfaen', 'Torfaen'),
(387, 243, 'Monmouthshire', 'Monmouthshire'),
(388, 243, 'Newport', 'Newport'),
(389, 243, 'Cardiff', 'Cardiff'),
(390, 243, 'Vale of Glamorgan', 'Vale of Glamorgan'),
(391, 243, 'Bridgend', 'Bridgend'),
(392, 243, 'Rhondda Cynon Taf', 'Rhondda Cynon Taf'),
(393, 243, 'Neath Port Talbot', 'Neath Port Talbot'),
(394, 243, 'Swansea', 'Swansea'),
(395, 243, 'Carmarthenshire', 'Carmarthenshire'),
(396, 243, 'Ceredigion', 'Ceredigion'),
(397, 243, 'Powys', 'Powys'),
(398, 243, 'Wrexham', 'Wrexham'),
(399, 243, 'Flintshire', 'Flintshire'),
(400, 243, 'Denbighshire', 'Denbighshire'),
(401, 243, 'Conwy', 'Conwy'),
(402, 243, 'Gwynedd', 'Gwynedd'),
(403, 243, 'Anglesey (Ynys Môn)', 'Anglesey (Ynys Môn)'),
(404, 243, 'Pembrokeshire', 'Pembrokeshire'),
(405, 243, 'Clwyd', 'Clwyd'),
(406, 244, 'Avon', 'Avon'),
(407, 244, 'Bedfordshire', 'Bedfordshire'),
(408, 244, 'Berkshire', 'Berkshire'),
(409, 244, 'Bristol', 'Bristol'),
(410, 244, 'Buckinghamshire', 'Buckinghamshire'),
(411, 244, 'Cambridgeshire', 'Cambridgeshire'),
(412, 244, 'Cheshire', 'Cheshire'),
(413, 244, 'Cleveland', 'Cleveland'),
(414, 244, 'Cornwall', 'Cornwall'),
(415, 244, 'Cumberland', 'Cumberland'),
(416, 244, 'Cumbria', 'Cumbria'),
(417, 244, 'Derbyshire', 'Derbyshire'),
(418, 244, 'Devon', 'Devon'),
(419, 244, 'Dorset', 'Dorset'),
(420, 244, 'Durham', 'Durham'),
(421, 244, 'Essex', 'Essex'),
(422, 244, 'East Sussex', 'East Sussex'),
(423, 244, 'East Yorkshire', 'East Yorkshire'),
(424, 244, 'Gloucestershire', 'Gloucestershire'),
(425, 244, 'Greater Manchester', 'Greater Manchester'),
(426, 244, 'Hampshire', 'Hampshire'),
(427, 244, 'Herefordshire', 'Herefordshire'),
(428, 244, 'Hertfordshire', 'Hertfordshire'),
(429, 244, 'Humberside', 'Humberside'),
(430, 244, 'Huntingdonshire', 'Huntingdonshire'),
(432, 244, 'Kent', 'Kent'),
(433, 244, 'Lancashire', 'Lancashire'),
(434, 244, 'Leicestershire', 'Leicestershire'),
(435, 244, 'Lincolnshire', 'Lincolnshire'),
(436, 244, 'London', 'London'),
(437, 244, 'Middlesex', 'Middlesex'),
(438, 244, 'Merseyside', 'Merseyside'),
(439, 244, 'Norfolk', 'Norfolk'),
(440, 244, 'Northamptonshire', 'Northamptonshire'),
(441, 244, 'Northumberland', 'Northumberland'),
(442, 244, 'North Yorkshire', 'North Yorkshire'),
(443, 244, 'Nottinghamshire', 'Nottinghamshire'),
(444, 244, 'Oxfordshire', 'Oxfordshire'),
(445, 244, 'Rutland', 'Rutland'),
(446, 244, 'Shropshire', 'Shropshire'),
(447, 244, 'Somerset', 'Somerset'),
(448, 244, 'South Yorkshire', 'South Yorkshire'),
(449, 244, 'Staffordshire', 'Staffordshire'),
(450, 244, 'Suffolk', 'Suffolk'),
(451, 244, 'Surrey', 'Surrey'),
(452, 244, 'Sussex', 'Sussex'),
(453, 244, 'Tyne and Wear', 'Tyne and Wear'),
(454, 244, 'Warwickshire', 'Warwickshire'),
(455, 244, 'Westmorland', 'Westmorland'),
(456, 244, 'West Midlands', 'West Midlands'),
(457, 244, 'West Sussex', 'West Sussex'),
(458, 244, 'West Yorkshire', 'West Yorkshire'),
(459, 244, 'Wiltshire', 'Wiltshire'),
(460, 244, 'Worcestershire', 'Worcestershire'),
(461, 244, 'Yorkshire', 'Yorkshire'),
(462, 246, 'Jersey', 'Jersey'),
(463, 246, 'Guernsey', 'Guernsey'),
(464, 246, 'Alderney', 'Alderney'),
(465, 246, 'Sark', 'Sark'),
(466, 246, 'Herm', 'Herm'),
(467, 245, 'Isle of Man', 'Isle of Man'),
--
-- Table structure for table `zones_to_geo_zones`
--
DROP TABLE IF EXISTS `zones_to_geo_zones`;
CREATE TABLE IF NOT EXISTS `zones_to_geo_zones` (
`association_id` int(11) NOT NULL auto_increment,
`zone_country_id` int(11) NOT NULL default '0',
`zone_id` int(11) default NULL,
`geo_zone_id` int(11) default NULL,
`last_modified` datetime default NULL,
`date_added` datetime NOT NULL default '0001-01-01 00:00:00',
PRIMARY KEY (`association_id`),
KEY `idx_zones_zen` (`geo_zone_id`,`zone_country_id`,`zone_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
--
-- Dumping data for table `zones_to_geo_zones`
--
INSERT INTO `zones_to_geo_zones` (`association_id`, `zone_country_id`, `zone_id`, `geo_zone_id`, `last_modified`, `date_added`) VALUES
(8, 246, 0, 3, NULL, '2009-01-01 10:50:00'),
(11, 252, 0, 4, NULL, '2009-01-01 10:50:00'),
(9, 245, 0, 4, NULL, '2009-01-01 10:50:00'),
(4, 242, 0, 2, NULL, '2009-01-01 10:50:00'),
(5, 243, 0, 2, NULL, '2009-01-01 10:50:00'),
(6, 244, 0, 2, NULL, '2009-01-01 10:50:00'),
(10, 253, 0, 4, NULL, '2009-01-01 10:50:00'),
(12, 251, 0, 4, NULL, '2009-01-01 10:50:00'),
(14, 250, 0, 6, NULL, '2009-01-01 10:50:00'),
(15, 241, 0, 4, NULL, '2009-01-01 10:50:00');
The next step was to create appropriate shipping modules to handle Royal Mail and / or Parcelforce24, so we CLONED the Table Rate module a few times so we could use it uniquely for each Geo Zone.
This was a bit more complicated, and is another story, as we put some WEIGHT conditionals into the code to display EITHER Royal Mail OR Parcelforce, depending on whether the cart weight was over or under 2kg!
To see the end result, visit
www. edutrade . co . uk and put a few items in the shopping cart
Then play around with quantities to add more weight (exceed 2kgs) to see how going over 2kgs disables royal mail and invokes parcelforce.
Also, play around with the shipping destination on the estimator to see how different rates will be applied, depending on the ZONE / GEO ZONE.