Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Zone Code vs. Zone Name


rosemaryann

Recommended Posts

Posted

I'm trying to get my invoice and packing slip to display the state abbreviation (zone code) instead of the full state name. I'm having a hard time trying to figure out how to do this since it pulls the address from 'format_id' . Can anyone help me out? I'd appreciate it!

 

Thanks!

Posted
I'm trying to get my invoice and packing slip to display the state abbreviation (zone code) instead of the full state name. I'm having a hard time trying to figure out how to do this since it pulls the address from 'format_id' . Can anyone help me out? I'd appreciate it!

 

Thanks!

admin/includes/functions/general.php

find

  function tep_get_zone_name($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;
}
 }

 

change to

  function tep_get_zone_name($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;
}
 }

 

steve

Posted
admin/includes/functions/general.php

find

  function tep_get_zone_name($country_id, $zone_id, $default_zone) {


change to
[code]  function tep_get_zone_name($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;
}
 }

 

steve

 

Thanks for the response, steve. I did that but it didn't change the output of zone_name. The zone_name is still showing. I'm confused because it's pulling from the tep_address_format function (about line 358 in /admin/includes/functions/general.php) where it has

 

$state = tep_output_string_protected($address['state']);

 

So I'm wondering if I have to find where it defines what $address['state'] is from when the customer places the order? Except i have no idea how to do this because there are so many functions, I'm starting to get lost! ha. Or maybe I'm completely off.

 

Any other ideas?

Posted
I'm trying to get my invoice and packing slip to display the state abbreviation (zone code) instead of the full state name. I'm having a hard time trying to figure out how to do this since it pulls the address from 'format_id' . Can anyone help me out? I'd appreciate it!

 

Thanks!

 

 

Ok so I ended up finding the answer to my own question. Here's the answer for anyone who wants to make the same edit.

 

Open /catalog/includes/classes/order.php

 

 

Find & replace all instances of zone_name to zone_code EXCEPT for the following 4 instances:

 

~line 167 should read

'zone_code' => $sendto['zone_name']

 

~line 174 should read

'entry_state' => $sendto['zone_name']

 

~line 206 should

'zone_code' => $billto['zone_name']

 

~line 213 should read

'entry_state' => $billto['zone_name']

 

 

 

It will only work on new orders.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...