[HACK] Shipping Address to use abbrev for State (USA only)
Posted: Sun Jul 19, 2009 10:36 pm
This hack is very basic and just provides the shipping address, state information in standard abbreviated format as part of the zip code.
Known compatibility: ISC 5.0.5
Open: /admin/includes/classes/class.shipments.php
Find:
After, Add:
Note: this hack depends on the USA being set as country with countryid of 226... If your country data uses a different value (because you've hacked the data or similar) it will not work properly.
Known compatibility: ISC 5.0.5
Open: /admin/includes/classes/class.shipments.php
Find:
Code: Select all
$GLOBALS['BillingAddress'] = ISC_ADMIN_ORDERS::BuildOrderAddressDetails($addressDetails, false);
Code: Select all
// MOD Abbrev USA State - Shipping only.
/*
* Generates 2 letter state code for USA orders and append to zip code
* Also removes the state full text if valid state found.
*
*/
if($shipmentDetails[$addressColumnPrefix.'shipcountryid'] == 226) {
// Get the abbreviation
$query = "SELECT stateabbrv FROM [|PREFIX|]country_states WHERE stateid = ". $shipmentDetails[$addressColumnPrefix.'shipstateid'];
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 1);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$shipmentDetails[$addressColumnPrefix.'shipzip'] = $row['stateabbrv']." ".$shipmentDetails[$addressColumnPrefix.'shipzip'];
$shipmentDetails[$addressColumnPrefix.'shipstate'] = '';
}
}
// END MOD.