You should keep the changes you made to the tpl_modules_create_account.php (especially the renaming of the "State" field to "City").
If you don't have a file named /includes/modules/responsive_sheffield_blue/create_account.php, create a template override by copying the like-named file from the /includes/modules directory into the responsive_sheffield_blue subdirectory.
You'll need to edit that template-override file, looking for the following block (for zc1.5.5a, around line 200) that deals with the country/state values:
Code:
if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_CITY_ERROR);
}
if (ACCOUNT_STATE == 'true') {
$check_query = "SELECT count(*) AS total
FROM " . TABLE_ZONES . "
WHERE zone_country_id = :zoneCountryID";
$check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
$check = $db->Execute($check_query);
$entry_state_has_zones = ($check->fields['total'] > 0);
if ($entry_state_has_zones == true) {
$zone_query = "SELECT distinct zone_id, zone_name, zone_code
FROM " . TABLE_ZONES . "
WHERE zone_country_id = :zoneCountryID
AND " .
((trim($state) != '' && $zone_id == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
"zone_id = :zoneID
ORDER BY zone_code ASC, zone_name";
$zone_query = $db->bindVars($zone_query, ':zoneCountryID', $country, 'integer');
$zone_query = $db->bindVars($zone_query, ':zoneState', strtoupper($state), 'noquotestring');
$zone_query = $db->bindVars($zone_query, ':zoneID', $zone_id, 'integer');
$zone = $db->Execute($zone_query);
//look for an exact match on zone ISO code
$found_exact_iso_match = ($zone->RecordCount() == 1);
if ($zone->RecordCount() > 1) {
while (!$zone->EOF && !$found_exact_iso_match) {
if (strtoupper($zone->fields['zone_code']) == strtoupper($state) ) {
$found_exact_iso_match = true;
continue;
}
$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);
}
}
}
... and make the highlighted changes, copying the matching zone's name into the city value.
Code:
/*-bof --- City will be copied from the matching state ---
if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_CITY_ERROR);
}
-eof --- City will be copied from the matching state --- */
if (ACCOUNT_STATE == 'true') {
$check_query = "SELECT count(*) AS total
FROM " . TABLE_ZONES . "
WHERE zone_country_id = :zoneCountryID";
$check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
$check = $db->Execute($check_query);
$entry_state_has_zones = ($check->fields['total'] > 0);
if ($entry_state_has_zones == true) {
$zone_query = "SELECT distinct zone_id, zone_name, zone_code
FROM " . TABLE_ZONES . "
WHERE zone_country_id = :zoneCountryID
AND " .
((trim($state) != '' && $zone_id == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
"zone_id = :zoneID
ORDER BY zone_code ASC, zone_name";
$zone_query = $db->bindVars($zone_query, ':zoneCountryID', $country, 'integer');
$zone_query = $db->bindVars($zone_query, ':zoneState', strtoupper($state), 'noquotestring');
$zone_query = $db->bindVars($zone_query, ':zoneID', $zone_id, 'integer');
$zone = $db->Execute($zone_query);
//look for an exact match on zone ISO code
$found_exact_iso_match = ($zone->RecordCount() == 1);
if ($zone->RecordCount() > 1) {
while (!$zone->EOF && !$found_exact_iso_match) {
if (strtoupper($zone->fields['zone_code']) == strtoupper($state) ) {
$found_exact_iso_match = true;
continue;
}
$zone->MoveNext();
}
}
if ($found_exact_iso_match) {
$zone_id = $zone->fields['zone_id'];
$zone_name = $zone->fields['zone_name'];
$city = $zone_name; // Copy the city from the selected zone's 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);
}
}
}
That should do it for the coding part (please note that I haven't tested this, so be sure to attempt the changes on a test site!). You'll also need to change the wording of the two (currently state-related) messages that I highlighted above.
You'll also want to apply these changes to the address-gathering forms and processing for the checkout_payment_address, checkout_shipping_address and address_book_process page.