Index: branches/5.1.x/units/shipping_quote_engines/intershipper.php =================================================================== diff -u -r13100 -r13465 --- branches/5.1.x/units/shipping_quote_engines/intershipper.php (.../intershipper.php) (revision 13100) +++ branches/5.1.x/units/shipping_quote_engines/intershipper.php (.../intershipper.php) (revision 13465) @@ -1,6 +1,6 @@ Application->ConfigValue('Comm_StoreName'); $params['orig_addr1'] = $this->Application->ConfigValue('Comm_Shipping_AddressLine1'); $params['orig_addr2'] = $this->Application->ConfigValue('Comm_Shipping_AddressLine2'); @@ -173,21 +171,23 @@ $params['orig_postal'] = $this->Application->ConfigValue('Comm_Shipping_ZIP'); $params['orig_country'] = $this->Application->ConfigValue('Comm_Shipping_Country'); } - if( mb_strlen($params['orig_country']) == 3) - { - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = "'.$params['orig_country'].'"'; - $params['orig_country'] = $db->GetOne($sql); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + if (strlen($params['orig_country']) == 3) { + // got 3symbol ISO code -> resolve to 2symbol ISO code + $params['orig_country'] = $cs_helper->getCountryIso( $params['orig_country'] ); } - if( mb_strlen($params['orig_state']) != 2) - { - $sql = ' SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations - WHERE DestName = "'.$params['orig_state'].'"'; - $params['orig_state'] = $db->GetOne($sql); + + if (strlen($params['orig_state']) != 2) { + // got state name instead of ISO code -> resolve it to ISO code + $country_iso = $cs_helper->getCountryIso($params['orig_country'], true); + $params['orig_state'] = $cs_helper->getStateIso($params['orig_state'], $country_iso); } - if(isset($custom_params['ShipMethod'])) - { - $params['ShipMethod'] = $custom_params['ShipMethod']; + if (isset($custom_params['ShipMethod'])) { + $params['ShipMethod'] = $custom_params['ShipMethod']; } $params['packages'] = $custom_params['packages']; @@ -199,10 +199,10 @@ $params['dest_state'] = $custom_params['dest_state']; $params['dest_postal'] = $custom_params['dest_postal']; $params['dest_country'] = $custom_params['dest_country']; - if( mb_strlen($params['dest_country']) == 3) - { - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = "'.$params['dest_country'].'"'; - $params['dest_country'] = $db->GetOne($sql); + + if (strlen($params['dest_country']) == 3) { + // got 3symbol ISO code -> resolve to 2symbol ISO code + $params['dest_country'] = $cs_helper->getCountryIso( $params['dest_country'] ); } if(!$params['dest_city'] || !$params['dest_country'] ||