News:

Support the VirtueMart project and become a member

Main Menu

USPS 4.2.2 - Scotland vs South Dakota (score = Scots 1, S. Dak, 0)

Started by virtuesshop, April 30, 2011, 06:04:37 AM

Previous topic - Next topic

virtuesshop

Joomla: 1.5.7
VM: 1.1.5
USPS shipping module: 4.2.2

PROBLEM:
Checkout/shipping issue when customer Country = United Kingdom, and State/Province/Region = Scotland.

USPSv4.php is sending "South Dakota" as country name, and usps shipping module fails.

FIX:
uspsv4.php (at line 98 in v4.2.2) change to/add:

if ($dest_country == "GB") {
$q  = "SELECT state_name FROM #__{vm}_state WHERE state_2_code='".$db->f("state")."'";
$dbc->query($q);
$dbc->next_record();
$dest_country_name = $dbc->f("state_name");

//This is the fix for Scotland 4/29/11

if ($dest_country_name == "South Dakota") {
$dest_country_name = "Scotland";}
}

CAVEATS:
There may be other COUNTRY/STATE 2char codes that are the same, and this only solves the Scotland = "SD" vs South Dakota = "SD" problem.
The query should probably be changed to take care of any other/future state code duplication.

Cheers,
virtuesshop.com