quetevendo Posted November 25, 2015 Posted November 25, 2015 Hi all, I need to show full state name in the address_book.php section.Currently it show zone_code, but I need to show zone_name. I have reviewed addons, forums and all the documentation that i found, but no solution. The states are not captured are selected from the drop-down, they are all loaded into the database.Just show me zone_name if the customer writes this... Can anybody help me. Attach File
♥Tsimi Posted November 26, 2015 Posted November 26, 2015 @@quetevendo Hi Franco I had the same problem a while back when I was building my store. I didn't like the address format showing the zone_id. To change that make the following changes to your general.php file. open your ../functions/general.php file FIND //// // Returns the zone (State/Province) code // TABLES: zones function tep_get_zone_code($country_id, $zone_id, $default_zone) { $zone_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); return $zone['zone_code']; } else { return $default_zone; } } REPLACE WITH //// // Returns the zone (State/Province) code // TABLES: zones /* BACK UP OF ORIGINAL CODE function tep_get_zone_code($country_id, $zone_id, $default_zone) { $zone_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); return $zone['zone_code']; } else { return $default_zone; } } */ //// // CHANGED TO SHOW ZONE NAME INSTEAD OF ZONE CODE // Returns the zone (State/Province) code // TABLES: zones function tep_get_zone_code($country_id, $zone_id, $default_zone) { $zone_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); return $zone['zone_name']; } else { return $default_zone; } } I don't remember the impact on other addresses shown in the shop like the address in the order history page or shipping and billing address. Just try it once and confirm that all addresses in your shop (catalog side) are showing correctly.
quetevendo Posted November 26, 2015 Author Posted November 26, 2015 Perfect!! It works!Thank you so much!!!You'll know which is the file that gives format to the address to alter the composition?Thank you!!
burt Posted November 26, 2015 Posted November 26, 2015 @@Tsimi On the right track, but...that change will affect a number of payment modules... L474 (approx) of /includes/functions/general.php sets $state ; $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state); You could try: $state = tep_get_zone_name($address['country_id'], $address['zone_id'], $state); which would probably be a cleaner solution.
quetevendo Posted November 26, 2015 Author Posted November 26, 2015 Perfect!! It works too!Thank you so much @@burt!!!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.