Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2010
    Posts
    6
    Plugin Contributions
    0

    Default Basic postcode-based shipping?

    Hi, I am wondering if there is any fairly simple way to enable flat-rate shipping of say £5/order for a particular set of about a dozen (local) postcodes.
    The option would only display if a customer was local.
    I have searched and found this thread, which is a bit brief but kind of like what I'm looking for:
    http://www.zen-cart.com/forum/showthread.php?t=110632

    I would be quite happy to hardcode the postcodes in but I'm still pretty new to ZenCart and my PHP skills are a bit minimal!

    Seems like a lot of people could use this kind of option but there are no obvious easy answers... except I guess Ceon's AdvShipper but I wonder if that would be almost over-complicating things, since I don't want to do anything very complex with other shipping rates.

    Thanks in advance for any advice!

  2. #2
    Join Date
    Feb 2010
    Posts
    6
    Plugin Contributions
    0

    Idea or Suggestion Re: Basic postcode-based shipping?

    well, obviously there was deafening silence in answer to my question above, so I have had to go away and do some thinking and thought I should share...

    This is what I have done with DrByte's original code - basically I am now taking off the last 3 digits of the UK postcode to give the outcode (first) part, which will have 3-5 digits depending on whether the outcode is 3 or 4 digits and whether the customer put a space in. Then in $free_ship_postcodes you need to put the list of 'local' postcodes you want to define, both with and without the space.

    I think you shouldn't need to include lowercase versions if you use the Capitalize Sign-up Fields mod:
    http://www.zen-cart.com/index.php?ma...roducts_id=441

    Say for example your postcode list is SG1,SG2,SG3,SG4,SG14,SG15,SG16,AL6,AL7 you need to insert new code (red) as shown below into /includes/modules/shipping/freeshipper.php

    Code:

    if ($check_flag == false) {
    $this->enabled = false;
    }

    // check to see if postal code is in list of allowed codes:
    } else {
    $free_ship_postcodes = array('SG1','SG2','SG3','SG4','SG14','SG15','SG16','AL6','AL7','SG1 ','SG2 ','SG3 ','SG4 ','SG14 ','SG15 ','SG16 ','AL6 ','AL7 ');
    $customer_postcode = $order->delivery['postcode'];
    $check_outcode = substr($customer_postcode, 0, -3);
    $valid_digits = in_array($check_outcode, $free_ship_postcodes);
    if ($valid_digits) $this->enabled = true;

    }
    }


    Now enable the "freeshipper" module in Admin->Modules->Shipping. I have changed the text in the freeshipper language file so it says 'Local Delivery' rather than 'Free Shipping', since I actually want flat rate.

    As far as I can tell, at first glance this seems to work, (thanks a million, DrByte) though I may very well have missed something! Any constructive criticism would be very welcome.

  3. #3
    Join Date
    Feb 2010
    Posts
    6
    Plugin Contributions
    0

    Default Re: Basic postcode-based shipping?

    oops, to be technically correct I should have said outward codes will have 2-5 digits depending on whether the outcode is 2, 3 or 4 digits and whether the customer put a space in (I forgot some postcodes were shorter) shouldn't affect anything above tho

  4. #4
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: Basic postcode-based shipping?

    if you want to move beyond basic you should have a look at Ceon Advanced Shipper - I use it for all my shipping options, I don't think there is anything more comprehensive.

 

 

Similar Threads

  1. Fastway Courier, PostCode based shipping method
    By FredZ in forum Addon Shipping Modules
    Replies: 41
    Last Post: 24 Apr 2012, 05:24 AM
  2. Stuck - Shipping based on UK postcode
    By backinthesaddle in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 28 Feb 2009, 11:12 PM
  3. Calculating shipping based on postcode (uk)
    By Dunk in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 13 Nov 2008, 02:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR