Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2006
    Posts
    17
    Plugin Contributions
    0

    Default How to make "State/Province" Drop/Down optional?

    I need to make State/Province field during registration optional (but not disabled/deleted/masked). I set:
    Configurations - Minimum Values - State = BLANK (as in nothing, NOT"0")
    Configurations - Customer Details - State = TRUE
    Configurations - Customer Details - State - Always display as pulldown? = FALSE

    Customers from countries that have no built-in states are able to create account with just Country chosen. But for those countries with built-in States/Provinces (i.e. USA, Australia), if customer doesn't select a state/province, an error comes back as

    [##############################]Please select a state from the States pull down menu.
    [/COLOR]
    In other words, it forces customers from countries with built-in States/Provinces to select a State/Province

    I read this post but didn't find answer..
    https://www.zen-cart.com/showthread....ields-optional

    I have tried both Classic template, Westminister New template.

    Someone help!

  2. #2
    Join Date
    Nov 2006
    Posts
    17
    Plugin Contributions
    0

    Default Re: How to make "State/Province" Drop/Down optional?

    No one knows? COme on,.. please

  3. #3

    Default Re: How to make "State/Province" Drop/Down optional?

    Have you been able to deal with that question? What configuration parameters should I set?

  4. #4
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Idea or Suggestion Twitch Make State Optional

    Yes, try this new module for Zen Cart 1.56c...

    Twitch Make State Optional
    20a for Zen Cart 1.56c - Twitch Base6
    August 6.2020

    Please backup your database and fileset locally prior to making changes to your Zen Cart shop.

    This will install a switch in Admin > Configuration > Customer Details > Twitch - Make State Optional that controls the form check - messageStack and javascript - to allow the state to become optional during account creation.

    Be sure to test on create account, login and split login as your site may handle these sign up methods differently.


    Copyright (C) 2020 Twitchtoo Media


    ***** DEVELOPERS START *****

    SQL Update
    INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Twitch - Make State Optional', 'TWI_ACCOUNT_STATE_OPTIONAL', 'false', '<br/>Make State <strong>Optional</strong> in Account Create Form?', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


    Uninstall Only
    DELETE FROM configuration WHERE configuration_key in ('TWI_ACCOUNT_STATE_OPTIONAL');
    Uninstall Only


    ***


    Update template and core files...


    includes/modules/YOUR_TEMPLATE/create_account.php
    replace this:
    $zone->MoveNext();
    }
    }

    if ($found_exact_iso_match) {
    $zone_id = $zone->fields['zone_id'];
    $zone_name = $zone->fields['zone_name'];
    } else {
    $error = true;
    $error_state_input = true;
    $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
    }
    } else {
    if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
    $error = true;
    $error_state_input = true;
    $messageStack->add('create_account', ENTRY_STATE_ERROR);
    }
    }
    }


    with this:
    $zone->MoveNext();
    }
    }
    if ($found_exact_iso_match) {
    $zone_id = $zone->fields['zone_id'];
    $zone_name = $zone->fields['zone_name'];
    } else {
    if (TWI_ACCOUNT_STATE_OPTIONAL == 'false') {
    $error = true;
    $error_state_input = true;
    $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
    } // eof TWI_ACCOUNT_STATE_OPTIONAL
    }
    } else {
    if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
    if (TWI_ACCOUNT_STATE_OPTIONAL == 'false') {
    $error = true;
    $error_state_input = true;
    $messageStack->add('create_account', ENTRY_STATE_ERROR);
    } // eof TWI_ACCOUNT_STATE_OPTIONAL
    }
    }
    }


    includes/form_check.js.php
    replace this:
    <?php if (ACCOUNT_STATE == 'true') { ?>
    check_state(<?php echo (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '", "' . ENTRY_STATE_ERROR_SELECT; ?>");
    <?php } ?>


    with this:
    <?php if (ACCOUNT_STATE == 'true') { ?>
    <?php if (TWI_ACCOUNT_STATE_OPTIONAL == 'false') { ?>
    check_state(<?php echo (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '", "' . ENTRY_STATE_ERROR_SELECT; ?>");
    <?php } ?>
    <?php } ?>



    includes/modules/pages/create_account/jscript_form_check.php
    replace this:
    <?php if (ACCOUNT_STATE == 'true') { ?>
    check_state(<?php echo (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '", "' . ENTRY_STATE_ERROR_SELECT . '"'; ?>);
    <?php } ?>


    with this:
    <?php if (ACCOUNT_STATE == 'true') { ?>
    <?php if (TWI_ACCOUNT_STATE_OPTIONAL == 'false') { ?>
    check_state(<?php echo (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '", "' . ENTRY_STATE_ERROR_SELECT . '"'; ?>);
    <?php } ?>
    <?php } ?>



    includes/modules/pages/login/jscript_form_check.php
    replace this:
    <?php if (ACCOUNT_STATE == 'true') { ?>
    check_state(<?php echo (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '", "' . ENTRY_STATE_ERROR_SELECT . '"'; ?>);
    <?php } ?>


    with this:
    <?php if (ACCOUNT_STATE == 'true') { ?>
    <?php if (TWI_ACCOUNT_STATE_OPTIONAL == 'false') { ?>
    check_state(<?php echo (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '", "' . ENTRY_STATE_ERROR_SELECT . '"'; ?>);
    <?php } ?>
    <?php } ?>


    ***** DEVELOPERS END *****


    Twitch Make State Optional Complete!


    ***** Please Donate *****

    If my work has helped you today in any way, show your appreciation with things like positive feedback or donations.
    Find me at www.twitchtoo.com

    Thanks

    Twitch.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

 

 

Similar Threads

  1. Replies: 6
    Last Post: 31 Mar 2009, 04:59 AM
  2. Howdo i get rid of the drop down that appears by state/province
    By paulFromWales in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 12 Sep 2007, 01:47 PM
  3. Drop Down State / Province box
    By RKB in forum General Questions
    Replies: 2
    Last Post: 27 Oct 2006, 05:08 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