aiyou Posted November 28, 2008 Share Posted November 28, 2008 Hello I've done some searching, but have not been able to locate the relevant information - if it has been discussed before, please feel free to direct me to it... I'm looking to enhance the appearance of addresses used on order summaries, invoices, label, etc. Specifically, I would like to use state/province abbreviations when that is the norm for the destination. For example, customers in the state of California, have "California" printed in their addresses, not the postal abbreviation of "CA". I've also shipped to other countries, where the province abbreviation is preferred. I know that the ORDERS table contains the full state/province values in the customer_state, delivery_state, and billing_state fields. The abbreviations are stored in the ZONES table. In reviewing the /admin/functions/general.php file, there are functions that would appear to handle this. And, from the customer's perspective, the abbreviation is displayed in their address book correctly (CA instead of California), during checkout, and on their email confirmations. I don't want to use the abbreviation in all cases, but would rather have it as an available variable for configuration within the ADDRESS_FORMAT entry value. So, $state may provide the full state/province value, where as $stateabbr may yield the corresponding ZONE_CODE abbreviation value. I do have an older general.php file (7/03), so this may be something that has since been addressed (no pun intended). Thanks --Rob Link to comment Share on other sites More sharing options...
aiyou Posted December 2, 2008 Author Share Posted December 2, 2008 Getting closer - have at least identified the different functions used... During checkout process, customer address is formatted using /functions/general.php tep_address_format function, which has a nested call to tep_get_zone_code. Similarly, /admin/functions/general.php has tep_address_format, calling tep_get_zone_code. tep_get_zone_code is different between the two. from /functions/general.php (1.231 2003/07/09) 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; } } And, now from /admin/functions/general.php (v 1.160 2003/07/12) function tep_get_zone_code($country, $zone, $def_state) { $state_prov_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and zone_id = '" . (int)$zone . "'"); if (!tep_db_num_rows($state_prov_query)) { $state_prov_code = $def_state; } else { $state_prov_values = tep_db_fetch_array($state_prov_query); $state_prov_code = $state_prov_values['zone_code']; } return $state_prov_code; } While I feel I can muddle my way through code, at least to get the gist of what's going on, I don't code well. So, how might I go about modifying /admin/functions/general.php (tep_address_format) to return both $state (for the full text state/province name) and $stateabbr (for the 2- or 3- character ISO abbreviation). Anyone??? Yes, I realize that my general.php versions are different, and may be a contributing factor...the shopping cart came with the business when I bought it, so a lot of customization had already occurred by prior owner. In looking at the version info, the newer version ID (1.231 vs 1.160) has an older date reference (07/09/2003 vs 07/12/2003). --Rob Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.