Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    Mar 2007
    Posts
    28
    Plugin Contributions
    0

    Default Changing required fields on account form for Irish customers

    Hello,

    most of the customers visiting my site are from Ireland. We're so wee we don't have post codes (well we do but there not used by postal system). I've looked at the \templates\my_template\templates\tpl_modules_create_account.php as I figured this is where I'd need to make some changes. Basically I would like it to function so that if the selected country is Ireland a postcode is not required, so validation will be skipped and the red * won't appear for postcode. I'm not sure how to achieve this or if it can be done using the override system. Could anyone give me some pointers?

    Thanks
    T

  2. #2
    Join Date
    Nov 2007
    Posts
    2
    Plugin Contributions
    0

    Default Re: Changing required fields on account form for Irish customers

    If you set the Minimum length value to 0 in the Min Values config menu - post does not become required. Not sure how to get rid of the red asterix though!!

  3. #3
    Join Date
    Nov 2007
    Posts
    2
    Plugin Contributions
    0

    Default Re: Changing required fields on account form for Irish customers

    Correction, if you remove the min length value altogether it makes the post code non-required.

  4. #4
    Join Date
    Mar 2007
    Posts
    28
    Plugin Contributions
    0

    Default Re: Changing required fields on account form for Irish customers

    Hi Jono, I saw a thread that recommended just adding a note to the post code saying if ireland is country chosen set postcode to "none".

    I do need the postcode to be required for non-irish visitors, so what I ideally would like to do is to change the post code to be not required when ireland is selected in the country drop down list. I know it can be done, but have never had to do it, so just wondered if anyone had already done this.

  5. #5
    Join Date
    Mar 2007
    Posts
    28
    Plugin Contributions
    0

    Default Re: Changing required fields on account form for Irish customers

    ok, I've think I've found the solution. Can anyone tell me if I'm missing something before I put it into production, please?

    skip post code check for given country code
    includes/modules/pages/login/jscript_form_check.php

    Code:
    //103 is code for Ireland, therefore skip postcode check for ireland.  Codes can be seen 
    //by viewing source of page with country drop down list.
     if (document.getElementById('country').value != 103)  {
        check_input("postcode", 4, "Your Post/ZIP Code must contain a minimum of 4 characters.");
      }
    hide post code if given country is selected
    includes/modules/pages/login/jscript_addr_pulldowns.php

    Code:
    //placed at top of function update_zone
    if (document.getElementById('country').value == 103){
            document.getElementById('hide_postcode').style.visibility='hidden';
      } else {
            document.getElementById('hide_postcode').style.visibility='visible';
      }
    includes/templates/YOUR_TEMPLATE/templates/tpl_modules_create_account.php

    make update happen if country list is changed
    Code:
    <label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
    <?php echo zen_get_country_list('zone_country_id', $selected_country,
     'id="country" '. 'onchange="update_zone(this.form);"') .
     (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' .
     ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
    
    <br class="clearBoth" />
    </fieldset>
    add div to contain elements that will be hidden
    Code:
    <div id="hide_postcode">
    <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" />
    </div>
    This works. The top two edits should be added to includes/modules/pages/create_account/jscript_form_check.php and includes/modules/pages/create_account/jscript_addr_pulldowns.php The files in login and create_account have the same data.

    Hope this helps someone with the same problem and is a valid solution to the problem. If any zen pros see issues please let me know ASAP.

  6. #6
    Join Date
    Mar 2007
    Posts
    28
    Plugin Contributions
    0

    Default Re: Changing required fields on account form for Irish customers

    Had to make the following change in includes/templates/YOUR_TEMPLATE/create_account.php
    Code:
    if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH && $country != 103) {
        $error = true;
        $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
      }
    as I was getting a postcode error message when form was submitted.

    Now I have one last error message that comes up, it says "Please select a state from the drop down list" (or words to that effect). I was somewhat hasty, me thinks, in editing the includes/templates/YOUR_TEMPLATE/templates/tpl_modules_create_account.php file.

    Code:
    <label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
    <?php echo zen_get_country_list('zone_country_id', $selected_country,
     'id="country" '. 'onchange="update_zone(this.form);"') .
     (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' .
     ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
    
    <br class="clearBoth" />
    </fieldset>
    I think this edit is causing the state drop down list to be required though it is not shown. Users can still sign up but after the first form submit they have to go back and choose a state from the drop down list before they can continue. Anyone suggest how to fix this problem??

  7. #7
    Join Date
    Jul 2008
    Posts
    2
    Plugin Contributions
    0

    application error Re: Changing required fields on account form for Irish customers

    Quote Originally Posted by tomzo View Post
    Hello,

    most of the customers visiting my site are from Ireland. We're so wee we don't have post codes (well we do but there not used by postal system). I've looked at the \templates\my_template\templates\tpl_modules_create_account.php as I figured this is where I'd need to make some changes. Basically I would like it to function so that if the selected country is Ireland a postcode is not required, so validation will be skipped and the red * won't appear for postcode. I'm not sure how to achieve this or if it can be done using the override system. Could anyone give me some pointers?

    Thanks
    T
    Your clients can now use the new Post Coding system for Ireland (PON Codes) available at www.irishpostcodes.ie
    and view the location of any PON Code by entering it here: http://www.irishpostcodes.ie/ponc/poncviewl.php

  8. #8
    Join Date
    Jul 2008
    Posts
    2
    Plugin Contributions
    0

    Default Re: Changing required fields on account form for Irish customers

    www.loc8code.com - available for use in web forms and supported on GARMIN SatNavs

 

 

Similar Threads

  1. Shipping on Customer's Account
    By SirBuck in forum Addon Shipping Modules
    Replies: 0
    Last Post: 28 Sep 2007, 07:35 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
  •