I ran into a similar issue. I wanted the delivery address on the packing slip to use the state abbreviation instead of the state name since I use it to make the shipping label.
To accomplish this I used the zones table to get the state code:
$state_abbr = $db->Execute("select zone_code
from " . TABLE_ZONES . "
where zone_name = '" . $order->delivery['state'] . "'");
then replaced the delivery state (to be used in forming the delivery address) with the state code:
$order->delivery['state'] = $state_abbr->fields['zone_code'];
I added those lines after the billing/shipping address check in admin/packingslip.php. The original looked like this:
if ($order_check->fields['billing_street_address'] != $order_check->fields['delivery_street_address']) {
$show_customer = 'true';
}
the new version looks like this:
if ($order_check->fields['billing_street_address'] != $order_check->fields['delivery_street_address']) {
$show_customer = 'true';
}
// change state abbreviation
$state_abbr = $db->Execute("select zone_code
from " . TABLE_ZONES . "
where zone_name = '" . $order->delivery['state'] . "'");
$order->delivery['state'] = $state_abbr->fields['zone_code'];
I would definitely appreciate any tips to improve this code with regards to "Zen best practices" or general PHP or mysql tips.
I think in the US the state code is preferred by USPS over the full state name, so making this change could possibly improve your delivery times.