Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
UK Regional Shipping (Channel Isles, NI)
 
IrishC
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2008-01-29
 

Hi,

We’re trying to currently figure out a way to setup table based shipping that gives different prices for shipping to parts of the UK such as NI and Channel Isles which logically come under the GBR country code - but which in the real world cost more to ship to.  Now before anyone says “Use the Royal Mail extension” wink we already have it installed and it is nice, but we use a few different couriers etc (aswell as royal mail) so we want to standarise our shipping costs and use a “best method” approach which is decided at dispatch.

Possibly this is achievable in the Table Rates csv, but I have read elsewhere that the Postcode column isnt actually used in making a programatic shipping decision, and we are unsure whether the UK has usable Region/State values that will allow a decision either. To illustrate i’ve attched a screenshot of what I’m trying.  We specify the postcodes for the specialist areas within the UK and include the new price to ship to that region. 

Has anyone any knowledge, thoughts or experience on this?

Image Attachments
tablerates.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
IrishC
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2008-01-29
 

Quick update.  I’ve been trying this out regardless to see what the outcomes might be, and it seems the post codes have to be an exact match - which is obviously unrealistic.

I would like to match the first two letters of the postcode, but I’m pretty sure regular expressions arent supported - or at least these failed

BT*
IM*

(Northern Ireland postcodes all start BT, Isle of Man all start IM)

Perhaps I can modify the code if someone knows where the source for this functionality is?

 
Magento Community Magento Community
Magento Community
Magento Community
 
IrishC
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2008-01-29
 

SOLUTION.

Well not so bad, no one answered but I managed to find a very workable solution for this.  Basically as explained, as customers from NI, Channel Islands etc will specify UK as their country - the table rate lookup will return “mainland” costs, when infact, most stores will want to charge extra for shipping over water.  This is my solution.

STEP 1 :

In your tablerates.csv, define non mainland UK areas by specifying the first 2 letters of their postcode.  Thankfully all these areas have their own, as follows :

BT = Northern Ireland
PO = Isle of Wight
JE = Jersey
IM = Isle of Man
GY = Guernsey

Simply define your UK standard rate (Region = *; Postcode = *) and then define further variations, using the two letter notation above in the Postal Code column.  (see below for my example)

STEP 2 :

Open up “app/core/code/mage/shipping/model/MySql4/Carrier/Tablerate.php”

Find the following block of code :

$select->where(
            
$read->quoteInto(" (dest_country_id=? "$request->getDestCountryId()).
                
$read->quoteInto(" AND dest_region_id=? "$request->getDestRegionId()).
                
$read->quoteInto(" AND dest_zip=?) "$request->getDestPostcode()).

            
$read->quoteInto(" OR (dest_country_id=? "$request->getDestCountryId()).
                
$read->quoteInto(" AND dest_region_id=? AND dest_zip='') "$request->getDestRegionId()).

            
$read->quoteInto(" OR (dest_country_id=? AND dest_region_id='0' AND dest_zip='') "$request->getDestCountryId()).

            
$read->quoteInto(" OR (dest_country_id=? AND dest_region_id='0' "$request->getDestCountryId()).
                
$read->quoteInto("  AND dest_zip=?) "$request->getDestPostcode()).

            
" OR (dest_country_id='0' AND dest_region_id='0' AND dest_zip='')"
        
);

Replace with

$postcode $request->getDestPostcode();
        
        
$select->where(
            
$read->quoteInto(" (dest_country_id=? "$request->getDestCountryId()).
                
$read->quoteInto(" AND dest_region_id=? "$request->getDestRegionId()).
                
$read->quoteInto(" AND dest_zip=?) "substr($postcode,0,2)).

           
$read->quoteInto(" OR (dest_country_id=? "$request->getDestCountryId()).
                
$read->quoteInto(" AND dest_region_id=? AND dest_zip='') "$request->getDestRegionId()).

           
$read->quoteInto(" OR (dest_country_id=? AND dest_region_id='0' AND dest_zip='') "$request->getDestCountryId()).

           
$read->quoteInto(" OR (dest_country_id=? AND dest_region_id='0' "$request->getDestCountryId()).
           
$read->quoteInto("  AND dest_zip=?) "substr($postcode,0,2)).

            
" OR (dest_country_id='0' AND dest_region_id='0' AND dest_zip='')"
        
);

Now when the user specifys their shipping postcode, the tablerate.php will choose the rule based on the first two characters of the postcode rather than comparing the whole thing.

Hope this helps others to be able to ship at varying prices within the UK.

Image Attachments
tablerates.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
magnoob
Jr. Member
 
Total Posts:  8
Joined:  2008-09-14
 

Thanks IrishC… what are the chances of this getting this or something similar into the magento core?

Also just to say its probably best to put the changes in local/Mage/Shipping/Model/Mysql4/Carrier/ not the core/Mage… as the changes may be wiped out during upgrades

 
Magento Community Magento Community
Magento Community
Magento Community
 
vadimc
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2008-10-25
London
 

thanks IrishC, i used your modification too and it sorted by problem by 99%

We use a dedicated delivery service and each postcode begining (AB, AL etc) has a different charge and the only problem left is with situations like:
PO1 - is Portsmouth
PO30-po42 is isle of wight, which is more expensive
I hope magento would allow the wildcard search soon, but for now - thanks a lot!

 
Magento Community Magento Community
Magento Community
Magento Community
 
WebShopApps
Guru
 
Avatar
Total Posts:  460
Joined:  2008-05-30
London, UK
 

Hi,

I’ve written an extension which incorporates the code above, and provides effectively multiple table rates. An example CSV file is shown here:

“Country”,"Region/State","Zip/Postal Code","Weight from”, “Weight to","Shipping Price","Delivery Type”
“GBR”,"*”,"*”,"0”,"5”,"2.99","1st Class Recorded”
“GBR”,"*”,"*”,"0”,"32”,"7.99","ParcelForce 24-48”
“GBR”,"*”,"*”,"32”,"1000”,"80.00","Special Pallet Delivery”
“GBR”,"*”,"*”,"2000”,"2100”,"0","Collection Only”
“GBR”,"*”,"BT”,"0”,"5”,"11.99","1st Class Recorded”
“GBR”,"*”,"BT”,"0”,"32”,"14.99","ParcelForce 24-48”
“GBR”,"*”,"BT”,"0”,"1000”,"200","Special Pallet Delivery”
“IRL”,"*”,"*”,"0”,"5”,"17.99","1st Class Recorded”
“IRL”,"*”,"*”,"0”,"32”,"17.99","ParcelForce 24-48”
“*”,"*”,"*”,"0”,"10”,"50”,"Worldwide"

It also allows for collection only items, and gives the ability to exclude products from free delivery.  I’m just waiting approval from Magento for the extension.  I have it working on a couple of sites successfully.  If you want more info PM me.

Rgds

Karen

 
Magento Community Magento Community
Magento Community
Magento Community
 
AndyM
Jr. Member
 
Total Posts:  23
Joined:  2008-11-06
 

wow great stuff Karen, perfect timing just what we’re looking for.

 
Magento Community Magento Community
Magento Community
Magento Community
 
IrishC
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2008-01-29
 

Excellent Karen.  Looking forward to seeing it!  Would love to build a module/extention but never seem to have the time to invest into learning the ins and outs of how it all hangs together.  Any pointers on where to start?  smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
WebShopApps
Guru
 
Avatar
Total Posts:  460
Joined:  2008-05-30
London, UK
 

Hi,

I’m not sure how long this extension will take to get approved.  If you want a copy of it PM me and I’ll send it to you.  I’m asking for a 20GBP donation for commercial use, though this is entirely at your own discretion as is released on OSL.  I’ll be offering free support and upgrades as part of this. The extension comes with examples and documentation.

I’ve sent it out to a number of people now and no issues have been raised. One of the really nice parts to it is that it allows complete flexibility over the descriptions and rates, with no hard-coding.  So if, say, Royal Mail put their prices up you can just update the csv file, upload it and you have your new rates.

If you want to see a demo goto http://www.woodlineuk.com and use the user test@test.com password password to see it’s functionality.

If you want to build a module yourself - well probably best to either take a look at someone else’s or just dive in and have a go.  I had already written a flat rate module beforehand so this helped me out.  Trouble with looking at other people’s is that you could copy their mistakes!

Rgds

Karen

 
Magento Community Magento Community
Magento Community
Magento Community
 
SteveM
Jr. Member
 
Total Posts:  20
Joined:  2008-07-25
 

Thank you very much for these posts, they helped me a great deal smile

Good luck with your extension Karen wink

Steve

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

Fantastic work..

This really got me out of a tight spot.

Allowed me to do free shipping to certain postcodes by ammending the above code to go upto 4 digits.

smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
whitetie
Jr. Member
 
Total Posts:  12
Joined:  2008-11-24
Oxford
 

Hello Guys,

I have been reading this thread with great interest but still cant magage to accomplish what is I’m sure a prety simple task.

I am hoping to go live in a few weeks but still have problems with the shipping side of things. This has been a great learning curve for me as I have very limited experience in this field, although I love the challenge..

All I want to do is offer free shippng to England and Wales and then a surcharge for the rest of the UK. i.e Scotland and NI.

I have created a table rate as mentioned above (and changed the php) with the first two postcode letters for all of Scotand to see if it works, but still no joy!

Country,Region/State,Zip/Postal Code,Weight (and above),Shipping Price
GBR,*,AB,0,30
GBR,*,DD,0,30
GBR,*,DG,0,30
GBR,*,EH,0,30
GBR,*,FK,0,30
GBR,*,G,0,30
GBR,*,HS,0,30
GBR,*,IV,0,30
GBR,*,KA,0,30
GBR,*,KW,0,30
GBR,*,KY,0,30
GBR,*,ML,0,30
GBR,*,PA,0,30
GBR,*,PH,0,30
GBR,*,TD,0,30
GBR,*,ZE,0,100
GBR,*,*,0,0

I would be more than happy to pay for any help or assistance in this issue.

Having spent most of the day trying to sort it out, I feel that I am pretty close to resolving this..

Any help would be greatly appreciated

Cheers

Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
vadimc
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2008-10-25
London
 

did you rebuild/refresh the cache?

 
Magento Community Magento Community
Magento Community
Magento Community
 
whitetie
Jr. Member
 
Total Posts:  12
Joined:  2008-11-24
Oxford
 

Hi,

Thanks for your swift reply

Yep, refreshed the cache to no avail!

Any other ideas?

Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
vadimc
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2008-10-25
London
 

i have it working for my webshop with the price vs destination and this is an example row from my csv:

GBR,*,*,0.0000,8.6900

I used 4 digits after the zero and running the latest magento - 1.20.1

only change i made was app/code/core/Mage/Shipping/Model/Mysql4/Carrier as per the above instructions

 
Magento Community Magento Community
Magento Community
Magento Community
 
WebShopApps
Guru
 
Avatar
Total Posts:  460
Joined:  2008-05-30
London, UK
 

Hi,

I now have the extension live that incorporates this funtionality.  See

http://www.magentocommerce.com/extension/604/auctionmaid-matrixrate

Rgds

Karen

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2