Ok a little update, after loads of reading and comparing zen cart files I have found that it should be done more like this
Code:
function get_zone_code($order, $default_zone, $zone) {
global $db;
$orderstate = $order->billing['state'];
$zone_query = "select zone_code
from " . TABLE_ZONES . "
where zone_name = '" . (string)$orderstate . "'";
$zone = $db->Execute($zone_query);
if ($zone->RecordCount() > 0) {
return $zone->fields['zone_code'];
} else {
return $default_zone;
}
}
and later on in the file is this
Code:
if (($order->billing['country']['iso_code_2']) == 'US') {
$plain .= "BillingState=" . $zone->fields['zone_code'] . "&";
}else{
$plain .= "BillingState=" . "&";
}
I have double checked that my test customer's state is Alaska and everthing up to a point works ..... however when using sagepay's simulater the encryted string shows that the billing state is sent but only as a "&" which I belive is from the else statement in the second block of the code.
Can someone please check this coding and let me know where I have gone wrong. I am using a vanilla 1.3.8a install of zen-cart to test the module
Bookmarks