Jump to content

Another Shipping problem - different rates within one country


Recommended Posts

Hi there,

trying to get my head around this one. We use Parcelforce for shipping larger packages and they add a "fuel surcharge" for some areas of the UK - namely Scottish Highlands, Isle of Man, Scilly Isles, Shetland Isles & a couple of others. How would I set up shipping to take this into account? Each of these areas are charged at a different rate.

I first thought about using different zones, but UK (Scottish Highlands), UK (Isle of Man), etc as zone names would look wrong on the invoice address and customers could accidentally or deliberately choose the wrong zone to avoid the surcharge.

On further investigation I have found out that other UK carriers do exactly the same, so this cannot be a unique requirement!

Link to comment
Share on other sites

  • 3 weeks later...

Okay, so judging by the response I guess there is chance of that.

Alternative - is it possible (via a module) to change the logic of shipping from zone to Postcode? If so, is there any module documentation and where is it?

Link to comment
Share on other sites

I don't think zone appears on the invoice address does it?
Untested but according to the documentation I read, zones are concerned with shipping and states are for the address.


In the Carrier settings you can only specify which Zone the courier will deliver to. Business Post (for example) split the UK into 5 separate areas, each with their own delivery charge for the same parcel. Scotland is split into two distinct Business Post shipping zones. Business Post Zone B includes the Scottish Lowlands and the North of England at £7.34 whereas Business Post Zone C is for the Scottish Highlands and is £20.12!

Currently this is impossible to account for in PrestaShop and we have to tell the customer that they will be charged extra to get their delivery if they are in such an area. Which they will be invoiced for and is to be paid prior to the item being shipped. Not the best situation as you can imagine.

What I am proposing is the ability (in a specific courier shipping module) to hook into and extend the shipping scheme to use the Postcode entered by the client if they select United Kingdom as their country. If it is possible, that is, but without any API or developer's documentation it is difficult to know where to start without first studying the current source code. I have an idea on how to do it, but I currently do not have the knowledge of PrestaShop coding standards to do this easily.
Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...

Hi, yep same/similar problem, UK based client, uses Royal Mail small packages but needs to be able to offer insurance plus larger packages as explained above

also someway of combining items for a maximum cost (or is that here somewhere?)

Not sure if this will work:-

Toying with setting up unique weight matrix to each postal cost:

1 gram £1.50 second class 3 day
2 gram £3.00 (includes insurance)
3 gram £2.50 1st Class recorded

etc etc

or is there a module on its way, or in the beta ver?

/--- Paul

Link to comment
Share on other sites

  • 3 weeks later...

Ive just come across this problem too. Ive written a cludgey workaround for now which check the fioirst two digits of postcode and changes the zone accordingly, but its hard-coded and would be much nicer if it were an option.

   //Check zone against entered postcode
   $postcodes = array('BT','AB','DD','FK','G8','HS','JE','IM','IV','KA','KW','PA','PH','ZE');
   $pc = Tools::getValue('postcode', 8);
   $pc = strtoupper(substr(trim($pc),0,2));
   foreach($postcodes as $p) if(!strcmp($pc,$p)) {
       $id_zone = 9;
       $cart->id_carrier = 9;
   }

Link to comment
Share on other sites

  • 1 month later...

I've encountered the same problem with the shipping rates for Scottish highlands, Northern Ireland & Isle of Scilly all being so much more with the courier, but actually still part of the UK.

I've ended up setting up States within the UK, of England, Scottish Highlands, Northern Ireland etc and set new carries to service those areas.

Its an annoying work around but prevents loosing (in some cases a lot) money when someone puts UK when they are actually in somewhere offshore

I can post up printscreens if anyone wants them

Dan

Link to comment
Share on other sites

  • 2 months later...
Ive just come across this problem too. Ive written a cludgey workaround for now which check the fioirst two digits of postcode and changes the zone accordingly, but its hard-coded and would be much nicer if it were an option.

   //Check zone against entered postcode
   $postcodes = array('BT','AB','DD','FK','G8','HS','JE','IM','IV','KA','KW','PA','PH','ZE');
   $pc = Tools::getValue('postcode', 8);
   $pc = strtoupper(substr(trim($pc),0,2));
   foreach($postcodes as $p) if(!strcmp($pc,$p)) {
       $id_zone = 9;
       $cart->id_carrier = 9;
   }



Could you tell me where you put this code to take effect? I would like to implement something similar for my shop.

Thanks

Luke.
Link to comment
Share on other sites

  • 1 month later...

Hi there,

I've had the same issue as well. As a work around I split the UK into six zones like below and set up the delivery charge separately.

United Kingdom (Mainland)
United Kingdom (Scottish Highland)
United Kingdom (Scottish Island)
United Kingdom (Northern Ireland)
United Kingdom (Isle of Scilly, Isle of Wight)
United Kingdom (Isle of Man)

I'm not sure if this is the best solution but it seems to work fine so far. This site isn't live yet so it's not tested in the real world yet. Has anybody out there tried something like this?

Rio

Link to comment
Share on other sites

  • 2 weeks later...

Hi all,

Same problem for Spain and Canary Islands.

Does anybody know which is the info of the client's "delivery address" fields that is used to calculate the cost of delivery? is it the COUNTRY? or POSTAL CODE? or CITY?

Thanks in advance

Link to comment
Share on other sites

  • 1 month later...
Could you tell me where you put this code to take effect? I would like to implement something similar for my shop.

Thanks

Luke.


Replied by PM, but for the benefit of others, this would go into order.php near the bottom of the main code (ie: before any functions). The $zone_id value would need to be set to the appropriate zone ID for Highlands and Islands (Mine is 9, but it could be anything).

In addition, I also use a different carrier for zone 9, so I added the following:

   if($id_zone==9) {
       //Need to change shipping price to different carrier
       $cart->id_carrier = 11;

   } else {
       if (isset($_POST['id_carrier']) AND Validate::isInt($_POST['id_carrier']) 
           AND sizeof(Carrier::checkCarrierZone(intval($_POST['id_carrier']), intval($id_zone))))
           $cart->id_carrier = intval($_POST['id_carrier']);
       elseif (!$isVirtualCart)
           $errors[] = Tools::displayError('invalid carrier or no carrier selected');
   }

   $cart->update();



So the whole thing looks like this (I cant specify line numbers as I have several modifications on order.php):

   if (!$id_zone = Address::getZoneById($address->id))
       $errors[] = Tools::displayError('no zone match with your address');

   //Check zone against entered postcode
   $postcodes = array('BT','AB','DD','FK','G8','HS','JE','IM','IV','KA','KW','PA','PH','ZE','AK');
   $pc = Tools::getValue('postcode', 8);
   $pc = strtoupper(substr(trim($pc),0,2));
   foreach($postcodes as $p) if(!strcmp($pc,$p)) {
       $id_zone = 9;
   }

   if($id_zone==9) {
       //Need to change shipping price to different carrier
       $cart->id_carrier = 11;

   } else {
       if (isset($_POST['id_carrier']) AND Validate::isInt($_POST['id_carrier']) 
           AND sizeof(Carrier::checkCarrierZone(intval($_POST['id_carrier']), intval($id_zone))))
           $cart->id_carrier = intval($_POST['id_carrier']);
       elseif (!$isVirtualCart)
           $errors[] = Tools::displayError('invalid carrier or no carrier selected');
   }

   $cart->update();



   } # if(!sizeof($errors))

   if (sizeof($errors))
   {
       $smarty->assign('errors', $errors);
       displayCarrier();
       include(dirname(__FILE__).'/footer.php');
       exit;
   }

   $orderTotal = $cart->getOrderTotal();
}

Link to comment
Share on other sites

Hi all,

Same problem for Spain and Canary Islands.

Does anybody know which is the info of the client's "delivery address" fields that is used to calculate the cost of delivery? is it the COUNTRY? or POSTAL CODE? or CITY?

Thanks in advance


Anyone figure this one out as I'm wondering if I'm going to have to remind customers to enter "Northern Ireland" (added country and zone) in their country field to avail of free shipping.
Link to comment
Share on other sites

  • 10 months later...

if (!$id_zone = Address::getZoneById($address->id))

$errors[] = Tools::displayError('no zone match with your address');

 

//Check zone against entered postcode

$postcodes = array('G3','G4');

$pc = Tools::getValue('postcode', 8);

$pc = strtoupper(substr(trim($pc),0,2));

foreach($postcodes as $p) if(!strcmp($pc,$p)) {

$id_zone = 9;

}

 

if($id_zone==666) {

//Need to change shipping price to different carrier

$cart->id_carrier = 11;

 

} else {

if (isset($_POST['id_carrier']) AND Validate::isInt($_POST['id_carrier'])

AND sizeof(Carrier::checkCarrierZone(intval($_POST['id_carrier']), intval($id_zone))))

$cart->id_carrier = intval($_POST['id_carrier']);

elseif (!$isVirtualCart)

$errors[] = Tools::displayError('invalid carrier or no carrier selected');

}

 

$cart->update();

 

 

 

} # if(!sizeof($errors))

 

if (sizeof($errors))

{

$smarty->assign('errors', $errors);

displayCarrier();

include(dirname(__FILE__).'/footer.php');

exit;

}

 

$orderTotal = $cart->getOrderTotal();

}

 

 

 

Tried this on PS1.4.4 and it's not working.

I got zone xxx with id=9 and added that zone to my carrier, I have put my local postcode during registration, so that first 2 digits are matching those from the hard coded list.

Added code to /classes/order.php line 184

It hasn't changed anything, zone(europe) is still chosed by country as it was before.

 

Anybody please help, i am trying to set diferent prices for diferent postcode groups to offer local same day delivery.

 

Thanks

Link to comment
Share on other sites

  • 4 years later...

I've encountered the same problem with the shipping rates for Scottish highlands, Northern Ireland & Isle of Scilly all being so much more with the courier, but actually still part of the UK.

 

I've ended up setting up States within the UK, of England, Scottish Highlands, Northern Ireland etc and set new carries to service those areas.

 

Its an annoying work around but prevents loosing (in some cases a lot) money when someone puts UK when they are actually in somewhere offshore

 

I can post up printscreens if anyone wants them

 

Dan

 

Hi Dan / All

 

I know this is an old post BUT I am facing the same problem.

 

Any chance you could post up how you created these states for the UK so I can get these done for my site.

 

Im using PS 1.6.1.

 

Thanks in advance.

 

Ade

Link to comment
Share on other sites

Any chance you could post up how you created these states for the UK so I can get these done for my site.

 

Hey, I'll have a look at the new 1.6 way of doing things (not been using Prestashop for a few years now as have moved jobs) but it shouldn't be too much different or hard to achieve.

 

Worked quite well once done, and didn't confuse customers either which was always a bonus.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...