Results 1 to 10 of 21

Hybrid View

  1. #1

    Default Re: Free Shipping Based on Postal Code Zone?

    Quote Originally Posted by DrByte View Post
    Try this:

    1. In /includes/modules/shipping/freeshipper.php, insert some new code, as shown:
    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('L1S','L1T','L1V','L1W','L1X','L1Y','L1Z','L3P','L3R','L3S','L3T','L4A','L4B','L4C','L4E','L4H','L4J','L4K','L4L','L4S','L4T','L4V','L4W','L4X','L4Y','L4Z','L5A','L5B','L5C','L5E','L5G','L5H','L5J','L5K','L5L','L5M','L5N','L5P','L5R','L5S','L5T','L5V','L5W','L6A','L6B','L6C','L6E','L6G','L6P','L6R','L6S','L6T','L6V','L6W','L6X','L6Y','L6Z','L7A','M1B','M1C','M1E','M1G','M1H','M1J','M1K','M1L','M1M','M1N','M1P','M1R','M1S','M1T','M1V','M1W','M1X','M2H','M2J','M2K','M2L','M2M','M2N','M2P','M2R','M3A','M3B','M3C','M3H','M3J','M3K','M3L','M3M','M4A','M4B','M4C','M4E','M4G','M4H','M4J','M4K','M4L','M4M','M4N','M4P','M4R','M4S','M4T','M4V','M4X','M4Y','M5A','M5B','M5C','M5E','M5G','M5H','M5J','M5K','M5L','M5M','M5N','M5P','M5R','M5S','M5T','M5V','M5W','M5X','M6A','M6B','M6C','M6E','M6G','M6H','M6J','M6K','M6L','M6M','M6N','M6P','M6R','M6S','M7A','M7Y','M8V','M8W','M8X','M8Y','M8Z','M9A','M9B','M9C','M9L','M9M','M9N','M9P','M9R','M9V','M9W');
            $customer_postcode = $order->delivery['postcode'];
            $check3digitcode = substr($customer_postcode, 0, 3);
            $valid_digits = in_array($check3digitcode, $free_ship_postcodes);
            if ($valid_digits) $this->enabled = true;
          }
        }
    2. Enable the "freeshipper" module in Admin->Modules->Shipping

    And give it a try.

    If it works for you, consider a donation.


    Dr Byte,

    The code you made seems to be very useful for me as I happened to have the same predicament with Jim/New Zenner regarding free shipping within a specified territory. I tried to replace the 3-digit codes with 4-digit codes of ours but it seems it doesn't work for me. Here is the code that i modified:

    // check to see if postal code is in list of allowed codes:
    } else {
    $free_ship_postcodes = array('4328, 4031, 4329, 4327, 4032, 4005');
    $customer_postcode = $order->delivery['postcode'];
    $check4digitcode = substr($customer_postcode, 0, 4);
    $valid_digits = in_array($check4digitcode, $free_ship_postcodes);
    if ($valid_digits) $this->enabled = true;
    // END OF CODE

    Is this right? I have no idea about Php yet but I know a little on programming. I tried to modify all the setting on shipping modules and the configuration but still it doesnt work for me. Im not sure if i placed it exactly in the right code position in the Php file.

    Am i right that the idea is to have freeshipper available only to those listed in the code? But for other postal codes i tested, freeshipper works which is not what i wanted to do!

    Hope you could help me sort things out. Thanks a lot.

    Francis

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Free Shipping Based on Postal Code Zone?

    I haven't studied your PHP code, but I did spot this problem:
    $free_ship_postcodes = array('4328, 4031, 4329, 4327, 4032, 4005');
    Each value in that array should be in quotes separately, like this:
    Code:
    $free_ship_postcodes = array('4328', '4031', '4329', '4327', '4032', '4005');
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3

    Default Re: Free Shipping Based on Postal Code Zone?

    Quote Originally Posted by DrByte View Post
    Each value in that array should be in quotes separately, like this:
    Code:
    $free_ship_postcodes = array('4328', '4031', '4329', '4327', '4032', '4005');
    Hi Dr. Byte,

    I appreciate your effort. I changed and tried to install, remove and re-install again all the available options but still i can not get my desired result.

    What i wanted to achieve is to set the free shipper module to just 6 towns in the Philippines thus the need for the zip code filter or any other field perhaps.. then for the rest of the Philippines i want a flat rate shipping and zone shipping for the rest of the world. The last 2 works correctly but free shipping applies in all other towns or cities of the Philippines even they are not in the list. I even set up new zones for the 6 towns but still free shipping does not work as I want it to be.

    Thanks for your time and effort. I appreciate it a lot. I guess i will have to take a break for a while on this and consider other options.


    Francis

  4. #4

    Default Re: Free Shipping Based on Postal Code Zone?

    After tinkering and spending several hours analyzing and tweaking the codes, it finally worked. Thanks a lot for your help.

    Francis

  5. #5

    Default Re: Free Shipping Based on Postal Code Zone?

    Hi,

    I have this pressing problem. I skipped tinkering with this for a few days hoping that i would be able to finally succeed in my aim after a few days but I couldnt. I am using freeshipper, zipship and zones table rate modules. free shipper, through help above is already working good. All the three are working alright. What i want to do is to remove or hide during checkout the zipship message that it is not available when the other shipping modules are.

    So I am trying to insert the same postal code script as i dont want the zipship module to show within the zip code zones similar to the freeshipping option but i cant find where it will be inserted and im not sure if the code will really fit into the zipship code.

    Here is the freeshipping code i want to insert so the zipship message wont appear when the address with the mentioned zip codes are being used:

    } else {
    $free_ship_postcodes = array('4328','4301','4329','4327','4032','4005');
    $customer_postcode = $order->delivery['postcode'];
    $check4digitcode = substr($customer_postcode, 0, 4);
    $valid_digits = in_array($check4digitcode, $free_ship_postcodes);
    if ($valid_digits) $this->enabled = true;

    Or i hope you could have another idea how? Thank you very much in advance.

    Francis

  6. #6
    Join Date
    Jan 2010
    Location
    England
    Posts
    4
    Plugin Contributions
    0

    Have a Drink Re: Free Shipping Based on Postal Code Zone?

    DrByte Sensei is a STAR,

    Just tried this for United Kingdom Post Codes and it works a treat - fantastic - gonna go buy you a coffee and chocolate biscuit (cookie) right now for sure, have good weekend.

    Warren

  7. #7
    Join Date
    May 2011
    Posts
    5
    Plugin Contributions
    0

    Default Re: Free Shipping Based on Postal Code Zone?

    Hi guys,

    Any ideas how can this work in the free shipping options?

    Thank

 

 

Similar Threads

  1. Validate registration based on postal code?
    By sandragrills in forum Basic Configuration
    Replies: 2
    Last Post: 30 May 2011, 03:22 PM
  2. Free shipping to a single postal code
    By Angelica in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 24 May 2011, 01:38 AM
  3. Zone Shipping Price based on Postal Code
    By lioncity in forum General Questions
    Replies: 2
    Last Post: 10 Oct 2009, 03:43 PM

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