phpzen-cart

Disabling Zipcode field in zencart signup/checkout


Please help with this little zen-cart challenge.

Some fields especially the zip code is/are not required for the running of my online store as not all area where shipping covers has for example zip codes. The question is therefore how to disable those fields that are not necessary for signup/check in zen-cart. Can anyone help please


Solution

  • To make the field not required, you have to do 2 things.

    Go to includes/languages/YOUR_TEMPLATE_NAME/english.php (or your specific language file) and remove the *

    example, for Post Code:

    In english.php, it says (around line 200):

    define('ENTRY_POST_CODE', 'Post/Zip Code:');
    define('ENTRY_POST_CODE_ERROR', 'Your Post/ZIP Code must contain a minimum of ' . ENTRY_POSTCODE_MIN_LENGTH . ' characters.');
    define('ENTRY_POST_CODE_TEXT', '*');
    

    and change it to:

    define('ENTRY_POST_CODE', 'Post/Zip Code:');
    define('ENTRY_POST_CODE_ERROR', 'Your Post/ZIP Code must contain a minimum of ' . ENTRY_POSTCODE_MIN_LENGTH . ' characters.');
    define('ENTRY_POST_CODE_TEXT', ''); // *removed
    

    then, go to your www.yourshop.com/YOURadmin and in configuration> minimum values clear out the number for Post/Zip Code.

    to completely remove it from your page, you have to go to includes/templates/YOUR_TEMPLATE_NAME/tpl_modules_create_account.php and remove the code block for this specific entry. Something really similar to this:

    <label class="inputLabel" for="postcode"><?php echo ENTRY_POST_CODE; ?></label>
    <?php echo zen_draw_input_field('postcode', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40') . ' id="postcode"') .
    (zen_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="alert">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    

    You can start reading something about customization for zencart on zencart wiki at http://www.zen-cart.com/wiki/index.php/Customisation_-_Templates

    Hope this help.