Hi,
After searching in vane for a UK postcode based shipping solution for virtuemart and finding this thread which looks like the work stalled I created my own UK postcode shipping module for a client of my company and my boss says that we will release it to the virtuemart community.
With this in mind and the earlier comments in this thread, I added more options than our client actually needs but I've had to restrict the bulk of my testing to the clients setup so please treat it as beta code and thoroughly test before deploying to a production enviornment. We don't offer any guarantee of fitness for purpose or any official support yet.
I'll accept bug reports here but as we aren't officially supporting it at the moment I don't know when I'll be able to do bug fixes.
----------- Details -----------
Installation
------------
Download the attached postcode_shipping_module.zip, unzip and upload the 3 files to /administrator/components/com_virtuemart/classes/shipping/
Configuration
-------------
Go to Components->VirtueMart.
Click on the Admin tab and click Configuration then the Shipping tab.
Tick the check box for "UK Postcode Zones. Shipping rates by zones defined by UK postcodes" to enable the module.
Click on the Store tab and click Shipping module List.
Find the Postcode Zones entry and click Configure Ship Method.
Options
-------
Carrier Name: This is the name shown in the shipping information on the order screen and also the start of the name in the checkout ship methods stage.
Tax Rate: set the tax rate for shipping.
Enable default zone: you can enable a default zone to catch any postcodes that don't match any zones you've set up, you can give teh default a name and base rate just like normal zones.
No zone match message: text to display if the default zone is disabled and the postcode doesn't match any normal zones (can be left blank to display no message).
Rate type: you can choose from 4 rate types - flat rate, by weight, by price or by items, see below for more info.
Shipping options: you can create shipping options that will present extra choices to the user and modify the zone rate (eg 9am delivery, Saturday delivery etc - see below for more details).
Maximum shipping rate: you can set a maximum shipping rate to cap the amount of shipping charged (can be used to give free shipping for a period without changing the zones or max £50 shipping etc).
Total order price for free shipping: you can set an amount to trigger free shipping.
Check address is in GB: if enabled the module will check if the address country is GB and immediately exit if not. If enabled you can enter a message to show if country is not in GB.
Zones
-----
Each zone has the following settings.
Zone name: the name of the zone (this does not have to be unique so you can create several different zones with different matching criteria but the same name to give the illusion of one zone).
Postcodes in zone: a comma seperated list of postcodes or parts of postcodes as controlled by the match type setting (see below).
Base rate: the base amount to charge for the zone, this will be modified depending on the rate type settings (see below) and the shipping option choosen (if any).
Match type: each zone can be set to match either the "area" or "outward" part of the postcode or the full postcode. The "area" part is the first letter(s) (eg TR for Cornwall where I live), the "outward" part is the letter(s) and number(s) upto the space (eg TR18 for Penzance), the full postcode is, of course the full postcode.
If a zone is set to "outward" match type you can enter postcode ranges like "TR15-18" as an equivenlant of writing "TR15,Tr16,Tr17,TR18". There are no ranges for area or full match zones.
A postcode will be tried against all "full" match zones first then against "outward" match zones and finally "area" match zones.
This allows you to setup a full match zone for a handfull of postcodes around your business (eg "TR181AB,TR182BC,TR183ED"), then an outward match zone for your postcode district (eg "TR18") and finally area match zones for the 'standard' zones for your carrier (eg "TR,PL,TQ"). this way the postcode TR18 1AB will match the full match zone, while TR18 9ZZ will match the outward match zone and TR19 4FG will match the area match zone.
Rate Type
---------
As stated above there are 4 rate types to choose from.
Flat rate
---------
The zone's base rate will be charged no matter what the order contains.
By weight
---------
You set a weight amount (in kg's) for the base rate and any extra weight will be charged in multiples of the base rate. So an order with a total weight of upto the amount set will be charged the zone's base rate, an order with up to twice the amount will be charged twice the zone's base rate etc.
You can also configure whether to show info of the weight on the shipping method choice list eihter nothing, show the number of "units" of weight or show the total weight. If you set the show option you can set a display label and whether to pluralise the lable.
As an aside I've done this because our client sells large items and they needed to be able to charge shipping per pallet with each item taking one or more pallets. So I've set the rate type to "By weight" and set the amount to 1 and to display the number of units of weight with a display label "pallet" with pluralise lable enabled. This means that I can set the weight of each item 1 kg for each pallet and the shipping method will charge 3 times the base rate for an item taking 3 pallets and will show "3 pallets" on the choose shipping method choice.
By price
--------
You can set up price bands with a minimum price to trigger the band and a modifier to apply to the zone's base rate. The modifier can be either a multiplication (*x), a division (/x), an addition (+x), a subtraction (-x) or a setter (=x) and it will be applied to the zone's base rate.
So if you set a band with a minimum of £10 and a modifier of +5 and a second band with a minimum of £100 and a modifier of =0 then an order of less than £10
will cost the zone's base rate, while orders between £10.01 and £100 will add 5 to the zone's base rate while orders of £100.01+ will be charge 0.
By Items
--------
Works similar to By price above except that the bands affect the number of items that fall within that band.
So if you set up a band with a minimum of 3 and a modifier of /2 and a second band with a minimum of 10 and a modifier of =0 then the first and second item would be charged the zone's base rate each, the third until the ninth item would be charged 1/2 the zone's base rate each and the tenth item upwards would not be charged.
Shipping Options
----------------
These have a name and a modifier (as above the modifier can be +,-,/,* or =).
When the module ouputs it's radio button on the shipping method choice stage of the checkout it will show an additional radio button choice for each option set.
So if you set an option with name equals "9am delivery" and modifier equals +15 and another option with name equals "Saturday delivery" and modifier equals +25 on the shipping methods stage of the checkout you will get 3 radio buttons from this module:
( ) STD, Zone 1: £10
( ) STD, Zone 1 [9am delivery]: £25
( ) STD, Zone 1 [Saturday delivery]: £35
Multiple carriers
-----------------
This module can only be configured with the zones for one carrier, however after reading the shipvalue topics about changes needed to clone the shipvalue module I've tried to make it easy to clone this module to provide for different carriers.
Basically for each carrier beyond the first you will need to decide on the clone's identifier which has to be the same in all the edits below (except the name and description in the ini file) and then follow the following steps (for the example the clone's identifier is '1'):
Copy postcode.php to postcode1.php.
Edit postcode1.php, change the following lines
59: class postcode {
60: var $classname = "postcode";
61: var $instance = '';
to
59:class postcode1 {
60: var $classname = "postcode1";
61: var $instance = '1';
Copy postcode.ini to postcode1.ini
Edit postcode1.ini, changing
4: name = Postcode Zones
....
12: description = UK Postcode Zones. Fixed shipping rates by zones defined by UK postcodes
....
15: filename = postcode.php
to
4: name = Postcode Zones 1 [enter any descriptive change here, shown on the shipping methods list]
....
12: description = UK Postcode Zones 1. Fixed shipping rates by zones defined by UK postcodes [enter any descriptive change here, shown on the shipping tab]
....
15: filename = postcode1.php
-------------------------------
As stated at the beginning of this post we offer no support or warranty for this module and accept no liabilty for problems caused by using this module but I look forward to hearing comments, ideas and bug reports from anyone who does test it.
Cheers,
Alan Brookland,
altcom Ltd.
[attachment cleanup by admin]