Try this:
/admin/includes/functions/general.php
insert this before line 491:
Code:
$zone_query = "select zone_code
from " . TABLE_ZONES . " z
left join " . TABLE_COUNTRIES . " c on c.countries_id = z.zone_country_id
where zone_name = '" . $address['state'] . "'";
$zone = $db->Execute($zone_query);
if ($zone->RecordCount() > 0 ) $state = $zone->fields['zone_code'];
Thus it'll look like this (starting from 479:
Code:
if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
$country = zen_get_country_name($address['country_id']);
if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
$state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
}
} elseif (isset($address['country']) && zen_not_null($address['country'])) {
if (is_array($address['country'])) {
$country = zen_output_string_protected($address['country']['countries_name']);
} else {
$country = zen_output_string_protected($address['country']);
}
$zone_query = "select zone_code
from " . TABLE_ZONES . " z
left join " . TABLE_COUNTRIES . " c on c.countries_id = z.zone_country_id
where zone_name = '" . $address['state'] . "'";
$zone = $db->Execute($zone_query);
if ($zone->RecordCount() > 0 ) $state = $zone->fields['zone_code'];
} else {
$country = '';
}
$postcode = zen_output_string_protected($address['postcode']);
$zip = $postcode;
Do similarly to
/includes/functions/functions_customers.php
insert on line 67, making it look like this (quoted from 55 onward):
Code:
if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
$country = zen_get_country_name($address['country_id']);
if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
$state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
}
} elseif (isset($address['country']) && zen_not_null($address['country'])) {
if (is_array($address['country'])) {
$country = zen_output_string_protected($address['country']['countries_name']);
} else {
$country = zen_output_string_protected($address['country']);
}
$zone_query = "select zone_code
from " . TABLE_ZONES . " z
left join " . TABLE_COUNTRIES . " c on c.countries_id = z.zone_country_id
where zone_name = '" . $address['state'] . "'";
$zone = $db->Execute($zone_query);
if ($zone->RecordCount() > 0) $state = $zone->fields['zone_code'];
} else {
$country = '';
}