Page 5 of 5 FirstFirst ... 345
Results 41 to 42 of 42
  1. #41
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    54
    Plugin Contributions
    0

    Default Re: Shipping in NZ - help to figure this out

    Hi again,

    Have managed to get a code that appears to work during the account creation stage - it will check the users input against the fastway_zones to see if the postcode entered is in the database.

    add the following code to create_account.php (includes/modules/your_template)

    // existing code

    if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
    $error = true; $messageStack->add('create_account',ENTRY_POST_CODE_ERROR);

    // add this code to check postcode

    } else {
    // check Zen Cart for duplicate postcode
    $sql = "select * from " . TABLE_FASTWAY_ZONES . "
    where f_postcode = :postcode:";
    $check_postcode_query = $db->bindVars($sql, ':postcode:', $postcode, 'string');
    $check_postcode = $db->Execute($check_postcode_query);
    if ($check_postcode->RecordCount() < 1 ) {
    $error = true;
    $messageStack->add('create_account', ENTRY_POST_CODE_ERROR2);
    }

    You will also need to define the TABLE_FASTWAY_ZONES and ENTRY_POST_CODE_ERROR2 for this to work.

    I haven't tested this on a live shop yet, but it appears to work on my localhost.

    The only issue now is trying to keep the database up to date with any changes NZ Post make to the postcodes.

    Regards,

    Mike.

  2. #42
    Join Date
    Mar 2006
    Location
    Auckland, New Zealand
    Posts
    229
    Plugin Contributions
    0

    Default As the Shipping in NZ thread has been closed...

    and there's a few of us on here who come in intermittently, not to mention lots of updates... I was wondering if this thread could be reopened and kept open?

    I'm looking at the issue the guys last mentioned in about integrating Fastway Couriers properly to NZ Post Codes... is changing an sql database purely about time and motivation (the download they refer to is an Australian version and has 3000 records).

    In NZ, our postal code is based on streets, not towns, so I am assuming for it to work accurately, I will have to modify the data along the lines of:

    Currently = suburb, state, postcode, region, delivery, zone

    so do I just add in an extra column? and find some script somewhere in the files attached to it and modify them to pick up the extra column?

    This will be my first foray into delving into the deep dark workings of sql.... and all because I've uploaded the latest version on my laptop to finally upgrade my site from 1.2.7... I decided it was easier to start from scratch and do it properly this time... lol
    Elemi

    The Art of Bespoke Aromatherapy
    www.AmorAromatherapy.co.nz

 

 
Page 5 of 5 FirstFirst ... 345

Similar Threads

  1. Postcode validation on login with Fastway modules.
    By mikecnz in forum Addon Shipping Modules
    Replies: 2
    Last Post: 17 Nov 2010, 11:23 PM
  2. Basic postcode-based shipping?
    By Lyte in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 16 May 2010, 05:09 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