Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Drop-down box for States and Regions


Guest

Recommended Posts

When my customer creates an account, I would prefer that the "State/Region" field be q drop down box rather than a text field. When I look at the code in create_account.php, I see that this ability is built in. Under what circumstances does this ability turn on? What exactl is $entry_state_has_zones ?

 

CODE SNIPPET:------------------

 

<?php

if (ACCOUNT_STATE == 'true') {

?>

<tr>

<td class="main"><?php echo ENTRY_STATE; ?></td>

<td class="main">

<?php

if ($process == true) {

if ($entry_state_has_zones == true) {

$zones_array = array();

$zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");

while ($zones_values = tep_db_fetch_array($zones_query)) {

$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);

}

echo tep_draw_pull_down_menu('state', $zones_array);

} else {

echo tep_draw_input_field('state');

}

} else {

echo tep_draw_input_field('state');

}

 

if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;

?>

Link to comment
Share on other sites

By default, it processes the form once to see which country you have chosen, so it can build the list of states and display them again when you submit the form. But this clears the password field meaning they have to re-type, and it's not very user friendly!

 

My site's for the UK, you can see the customer signup thing working at http://electriccommerce.co.uk/catalog

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...