Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

insert default value in Post Code textbox (such as N/A)


sheena

Recommended Posts

Hi,

 

I am having trouble trying to remove the postcode all together from my account setup page, but since I probably should have it there for international customers, i would like to be able to insert a default value into it such as N/A, or non applicable for irish customers (my main base) as we do not have postcodes in ireland.

 

At present users must enter a value into the box to continue, and since i cannot turn off that function, i would rather have something already inserted into the box so they dont have to bother entering something just to get past the account setup page.

 

Anyone any ideas how to insert a default value. I've tried setting the minimum value to 0 but STILL users must add a value into the text box for post code!!?????

 

Please help

 

Sheena

Link to comment
Share on other sites

To insert a default value edit your create_account.php and search for the line that creates the input field for postcode. there's a function tep_draw_inputfield(). Add as the last parameter the default value (enclosed in single quotes) and you should be good to go.

Link to comment
Share on other sites

To insert a default value edit your create_account.php and search for the line that creates the input field for postcode. there's a function tep_draw_inputfield(). Add as the last parameter the default value (enclosed in single quotes) and you should be good to go.

 

 

Hi Manfred

 

Thanks for your suggestion. I tried it but unfortunately id had no effect on the textbox. The following code is what appears in my create_account.php file.

 

<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
               <td class="main"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

 

This is what i changed it to, as you suggested by inserting a value into the last parameter of the code. I entered "N/A"

 

 <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
               <td class="main"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': 'N/A'); ?></td>

 

Did i do something wrong, or do you know why it might not be working. I can get text to appear to the right of the box, but nothing in it!

 

Sheena

Link to comment
Share on other sites

You didn't add it to the mentioned function as I suggested. Try this:

 

<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
<td class="main"><?php echo tep_draw_input_field('postcode', 'N/A') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

 

By the way, the fact that nothing happened, shows that you have the Entry_post_code still set to required. Edit the english.php language file and replace the asterisk at ENTRY_POST_CODE_TEXT with nothing. (define('ENTRY_POST_CODE_TEXT', '');)

Link to comment
Share on other sites

You didn't add it to the mentioned function as I suggested. Try this:

 

<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
<td class="main"><?php echo tep_draw_input_field('postcode', 'N/A') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

 

By the way, the fact that nothing happened, shows that you have the Entry_post_code still set to required. Edit the english.php language file and replace the asterisk at ENTRY_POST_CODE_TEXT with nothing. (define('ENTRY_POST_CODE_TEXT', '');)

 

 

Thanks a million Manfred for your help. I really appreciate it!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...