Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Different shipping rates based on zone?

Different shipping rates based on zone?

Locked

Views: 11,073

Results 1 to 20 of 27
This thread is locked. New replies are disabled.
11 Jan 2009, 6:02 PM
#1
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Different shipping rates based on zone?

Hi,

We use the table rate system to calculate shipping cost based on weight.

We're based in the UK and would like to adjust the shipping cost depending upon a customer's location. We basically need one set of rates for shipping to mainland UK and another set for shipping to Scottish highlands and offshore islands.

I haven't quite got my head around zones but would it be possible to set up certain UK counties to fall into one zone and other counties to fall into another zone (i.e. mainland UK counties as one zone and Scottish highlands and offshore islands as another zone). Could I then apply a set of shipping rates to each zone?

I should add, the customer selects their country of residence and county from a drop down menu during registration. So can I use the data from these drop down menus to form the zone definitions?

If not, is there another way I could solve this problem?

If anyone could point me in the right direction it'd be much appreciated, thanks!

11 Jan 2009, 8:10 PM
#2
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

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:

  1. 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
  1. 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

  1. 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
  1. 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

  1. 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.

11 Jan 2009, 8:17 PM
#3
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Remember too, that you may have existing customers whose addresses are already in the database.

As the database tables for address data cross references the zones and countries tables, if you make radical changes to these, you may (probably will) affect the structure of existing customer addresses.

There's also your shop's zone ID to consider.

Proceed with Caution...

If you know your SQL, and your customer list is not that long, you can UPDATE the address tables to reflect the new ID's you are likely to apply when you change your countries and zones structure.

11 Jan 2009, 10:50 PM
#4
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

fairestcape,

Just had a read through your post, this looks like EXACTLY what we're after, although we need to ship to Republic of Ireland too, but I can't see any problem factoring this in.

I'll experiment with this when I get into the office tomorrow and let you know how it goes. Thanks for the info, very much appreciated :clap:

11 Jan 2009, 11:02 PM
#5
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

One question, how exactly do you clone the table rate module?

is it just a case of duplicating and renaming the table.php file within includes/modules/shipping/ ?

12 Jan 2009, 10:42 AM
#6
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

The standard ZONES module, and the standard TABLERATE module are not suitable for the format I suggested in my initial post. We used and cloned a module called ZONETABLES (a nifty combo of the ZONES and the TABLES modules). Zonetables is available here:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_51&products_id=695

For cloning shipping, look at this thread below (where the example is the FLAT RATE module.) The principle will apply to several other shipping modules (but not all of them.)

http://www.zen-cart.com/forum/showthread.php?t=115687

I will post (see below later), some clear instructions on cloning the ZONETABLES module.

Republic Of Ireland

If you also ship to Republic of Ireland, then just leave that country in your existing database. (I think it's given the dbase ID number of 103 in a standard install).

12 Jan 2009, 10:57 AM
#7
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Get a copy of ZONETABLES and unzip it into a folder on your hard drive.

Then, (as per the directions for FLAT RATE cloning in the above thread link), make ANOTHER COPY.

Here are the opening 80-odd lines of zonetable.php

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: zonetable.php 4184 2007-08-17 03:36:36Z surf7.net $
 */
/**
 * Enter description here...
 *
 */
class zonetable extends base {
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $code;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $title;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $description;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $icon;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $enabled;
  /**
   * Enter description here...
   *
   * @return zonetable
   */
  var $num_zones;
  /**
   * Enter description here...
   *
   * @return zonetable
   */
  var $dest_zone;
  /**
   * Enter description here...
   *
   * @return zonetable
   */
  function zonetable() {
    global $order, $db;

    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 6;

    $this->code = 'zonetable';
    $this->title = MODULE_SHIPPING_ZONETABLE_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_ZONETABLE_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_ZONETABLE_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_ZONETABLE_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_ZONETABLE_TAX_BASIS;
    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_ZONETABLE_STATUS == 'True') ? true : false);
    }

Now, change the second copy to zonetabletwo.php, and where you see:

lowercase zonetable in the code, change it to zonetabletwo

uppercase ZONETABLE_ , change to ZONETABLETWO_

(I show just the opening 80 lines. You MUST change ALL instances of the above...)

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: zonetabletwo.php 4184 2007-08-17 03:36:36Z surf7.net $
 */
/**
 * Enter description here...
 *
 */
class zonetabletwo extends base {
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $code;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $title;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $description;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $icon;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $enabled;
  /**
   * Enter description here...
   *
   * @return zonetabletwo
   */
  var $num_zones;
  /**
   * Enter description here...
   *
   * @return zonetabletwo
   */
  var $dest_zone;
  /**
   * Enter description here...
   *
   * @return zonetabletwo
   */
  function zonetabletwo() {
    global $order, $db;

    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 6;

    $this->code = 'zonetabletwo';
    $this->title = MODULE_SHIPPING_ZONETABLETWO_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_ZONETABLETWO_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_ZONETABLETWO_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_ZONETABLETWO_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_ZONETABLETWO_TAX_BASIS;
    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_ZONETABLETWO_STATUS == 'True') ? true : false);
    }

NOTE ALSO that in line(s) 64 - 68, I have increased the number of zones from the default 3, to 6. You will need these extra zones, so change it to 6 in your copies as well.

    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 6;

To install the modules, see that thread on the FLAT RATE cloning.

16 Jan 2009, 4:45 PM
#8
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Hi again,

Thanks for all your help, I wouldn't have a clue where to start without this. I'm just sat in the office working through all your instructions now. Not run into any problems yet but noticed something you may want to correct in your own code if you haven't already spotted it!

Your sql query is placing pembrokeshire in scotland, not wales!

(368, 242, 'Pembrokeshire', 'Pembrokeshire'),

16 Jan 2009, 5:04 PM
#9
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

another one...

(382, 242, 'Zetland', 'Zetland'),

Old name for the Shetland isles I believe? Don't think it's classed as Scottish Lowlands.

16 Jan 2009, 5:25 PM
#10
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Probably are a couple of errors.

These are not my lists (ie: I did not compile them) but gleaned from various other sources.

If you see errors, then by all means correct them.

The BIG problem with UK counties is that there is an "official" list, and then a whole load of "unofficial" lists.

This has come about because of the inherent stubbornness and dogmatism of the British public. (Not a criticism - just an observation :D ) Officialdom will join counties together, split counties up, etc, over the course of time, but local people will INSIST on keeping the traditional or locally popular name.

EG: there is NO SUCH COUNTY as "South Gloucestershire", but some customers call up and say "I live in South Gloucestershire, but you don't have it on your Counties List... WHY NOT!!! ?"

17 Jan 2009, 10:17 AM
#11
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

fairestcape:

EG: there is NO SUCH COUNTY as "South Gloucestershire", but some customers call up and say "I live in South Gloucestershire, but you don't have it on your Counties List... WHY NOT!!! ?"

Yep, I'm certain we'll come up against this kind of thing. Can't wait for that :wacko:

Alright, it's DONE! And it's working (almost) perfectly! I'm sure I've said it before but thanks a million, without your help I'm not sure where we'd be right now!

One last minor problem. As instructed, I've set up all the tax rates and zone definitions.
Problem is, if you're not signed in, all prices on the store are now displaying EX VAT instead of inc. When signed in these are INC VAT.

Also, when I set up new products and enter their price, the same value is calculated in both the gross & net boxes, even if "taxable goods" is selected from the tax class dropdown.

The logical next step is to go to tax rates in the admin and ensure that each zone is assigned the 15% tax class I set up, which they are... so... I'm a little confused at to what the problem could be?

EDIT: hmm, thinking out aloud here, but since a first time visitor without an account doesn't have an assigned zone definition based on their address zen can't apply a tax rate? Do I need to set up some kind of universal zone? Not sure if that explains the problem with gross and net product prices when setting up a new product though.

17 Jan 2009, 12:03 PM
#12
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

In the UK, if you sell retail (to the public), your displayed prices MUST be inclusive of VAT. (Price Marking Order 2004 - Trade Descriptions Act).

Secondly, if you are selling ONLY in the UK, then you only need to display your prices inclusive of VAT.

So, it's technically not necessary to concern yourself with setting tax areas, because your prices already include vat.

On our UK stores, we set the tax class to " --none-- " and just make sure that the price displayed is inclusive of VAT.

You come up against a (minor) problem with Channel Islands and Isle of Man (who don't pay vat), but unless you get 100 customers a day from those zones, don't bother with this. You can deal with the odd order manually, and as long as you maintain accurate vat records elsewhere you will not fall foul of HMRC.

17 Jan 2009, 12:43 PM
#13
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Hmm ok... but we sell 70% to business, 30% to the public.
It's pretty important that we're able to identify how much VAT is being applied to an order during the checkout process and on the invoice.

If I understand what you're saying, I should remove all tax rates and then adjust each product and attribute price in our zen catalogue so it's inclusive of VAT?
Is there another way around this that retains the tax rates? It seems like I'm almost there, VAT is calculated and applied if you're a registered customer but not if you're a first time visitor. Is there something I can tweak so the visitors see the same rate?

17 Jan 2009, 12:52 PM
#14
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Re: Different shipping rates based on zone?

I think I've done it. Added an "All Zones" tax rate which seems to have included the VAT in the prices shown to none registered visitors so they're all in line with those prices shown to registered users. :clap:

17 Jan 2009, 2:27 PM
#15
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Dunk:

Hmm ok... but we sell 70% to business, 30% to the public.

Then you can quite legitimately display your products EXCL vat, as long as you make it quite clear that prices are excl vat.

You can consider installing:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=848

This module will display the two prices on the product info pages.

Note: any advertising of your products WITH prices (such as on GoogleBase) in a public domain, must show them as INCL vat. Naturally, if you advertise specifically to businesses, this advertising can legitimately display your excl vat prices.

23 Jan 2009, 11:13 AM
#16
beep avatar

beep

New Zenner

Join Date:
Nov 2008
Location:
London
Posts:
94
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Hello all,

I'm having a little trouble with my shipping calculator not displaying Jersey or Guernsey.
I have placed the ISO codes JE, GG and CH into my zone 2 countries but that doesnt seem to be working. I need this destimation to be charged at the same rate as other euroean countries.

The page is http://www.queenib.com/boutiquez/index.php?main_page=product_info&cPath=74&products_id=255

Does anyone know what might be wrong?


fairly confused beep :huh:

23 Jan 2009, 7:36 PM
#17
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

If you look at page one of this thread, you may get a better idea of how we resolved this...

We set up CHANNEL ISLANDS as a "country".

Then we added:

Sark
Guernsey
Aldernay
Jersey

... as ZONES.

Because it is now a separate COUNTRY, it's much easier to configure it as part of an international shipping zone, in an appropriate shipping module.

(Please note that we use a rather complex array of shipping modules, and I can't go into that in this thread).

26 Jan 2009, 10:48 AM
#18
beep avatar

beep

New Zenner

Join Date:
Nov 2008
Location:
London
Posts:
94
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Thank you fairestcape,
Having re-read your original post several times, I don't understand it any further. I am not a programmer, it's all a bit too confusing to a beginner.
To what file is the 'country' applied?

still utterly bewildered beep :huh:

26 Jan 2009, 4:25 PM
#19
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Your need to ADD the country, then its zones, to the database:

ADMIN>>>LOCATIONS / TAXES>>>COUNTRIES;

Then click new country button and insert:

Country Name: Channel Islands
ISO 2-Digit: CS
ISO 3-Digit: CSL

Then, once the country is added:

ADMIN>>>LOCATIONS / TAXES>>>ZONES

Then click new zone button and insert:

Zones Name: Aldernay
Zones Code: Aldernay

From dropdown, select: Channel Islands

Add the following as zones too - as you did for Aldernay:

Guernsey
Jersey
Sark

27 Jan 2009, 9:36 AM
#20
beep avatar

beep

New Zenner

Join Date:
Nov 2008
Location:
London
Posts:
94
Plugin Contributions:
0

Re: Different shipping rates based on zone?

Thank you!! That was exactly what I was looking for!
It's all sorted now :clap: