Discovered a problem with my original version when used with the World Zones contribution where accented charaters such as é or ï are defined with the HTML code for the character. Any attempt to select a state with such a character results in a error because when the form is submitted the HTML character codes get converted into the actual characters and the state name no longer matches what is in the database. The updated instructions here fix this problem.

If you have already installed this contribution the fix is simple as follows:

There are four files containing the following lines:

while ($zones_values = tep_db_fetch_array($zones_query)) {
$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);}

These files being catalog/create_account.php, catalog/includes/modules/address_book_details.php, catalog/includes/modules/checkout_new_address.php, and catalog/admin/customers.php. In all four of the files those lines will need to be changed to read as follows:

while ($zones_values = tep_db_fetch_array($zones_query)) {
$zones_array[] = array('id' => htmlspecialchars($zones_values['zone_name']), 'text' => $zones_values['zone_name']);}

Immediately below these lines is an echo tep_draw_pull_down_menu statement. In two of the files the third parameter (immediately after $zones_array,) will be something other than a null (''). In those two files (catalog/includes/modules/address_book_details.php and catalog/admin/customers.php) you will need to enclose the third parameter inside an htmlspecialchars function.

In catalog/includes/modules/address_book_details.php the line will need to read as follows:

echo tep_draw_pull_down_menu('state', $zones_array, htmlspecialchars(tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state'])), $parms);


and in catalog/admin/customers.php the line will need to read as follows:

echo tep_draw_pull_down_menu('entry_state', $zones_array, htmlspecialchars(tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)), $parms);




More...