Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    54
    Plugin Contributions
    0

    Default Postcode validation on login with Fastway modules.

    Hi,

    As the title suggest I am trying to write a code that will check the customers postcode is valid by running it through my postcode database.

    This code is in includes/modules/create_account.php

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

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

    for some reason it returns an error:

    1146 Table 'h-----p.table_fastway_zones' doesn't exist
    in:
    [select * from TABLE_FASTWAY_ZONES where f_postcode = '1001']

    The table does exist - and this code below works:

    $check_query = "SELECT count(*) AS total
    FROM " . TABLE_ZONES . "
    WHERE zone_country_id = :zoneCountryID";

    So it shouldn't be an issue with the database prefix...

    I'm working with 1.3.9h on a localhost setup if that helps..

    Regards,

    Mike.

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Postcode validation on login with Fastway modules.

    TABLE_FASTWAY_ZONES is an undefined constant, therefore the table it refers to can't be found (doesn't exist).

    TABLE_ZONES is a correctly defined constant, therefore there is no problem with using it.

    Solution: Define the TABLE_FASTWAY_ZONES constant so that it refers to a valid tablename

    Cheers
    Rod

  3. #3
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    54
    Plugin Contributions
    0

    Default Re: Postcode validation on login with Fastway modules.

    Thanks Rob, that worked a charm.

    Regards,

    Mike.

 

 

Similar Threads

  1. v151 Address validation via Postcode Anywhere
    By dochsa in forum Addon Shipping Modules
    Replies: 2
    Last Post: 30 Apr 2013, 05:06 PM
  2. Fastway Courier, PostCode based shipping method
    By FredZ in forum Addon Shipping Modules
    Replies: 41
    Last Post: 24 Apr 2012, 05:24 AM
  3. help with Fastway Shipping Module
    By maori1 in forum Addon Shipping Modules
    Replies: 84
    Last Post: 1 Jul 2010, 05:04 AM
  4. UK Postcode Validation
    By babyandme in forum Managing Customers and Orders
    Replies: 0
    Last Post: 30 Aug 2007, 12:48 PM
  5. Remove Street Address & Postcode fields on Login page
    By efghijk in forum Customization from the Admin
    Replies: 2
    Last Post: 19 Jul 2007, 07:04 AM

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