Should work. You might try something like the following in your shipping module:
Code:
function _upsRescom($foo) {
global $order, $db;
$result = $db->Execute(
'SELECT `c`.`customers_extrafield` FROM `' . TABLE_ADDRESS_BOOK '` AS `ab` '.
'LEFT JOIN `' . TABLE_CUSTOMERS . '` AS `c` ON `ab`.`customers_id`=`c`.`customers_id` ' .
'WHERE `ab`.`address_book_id`=\'' . (int)$_SESSION['sendto'] . '\''
);
if(!$result ->EOF) {
// Check the contents of the extra field and set $foo = RES or COM as appropriate
// You may want to only change $foo if things match exactly, in case somewhere
// the extrafield is used for a different purpose and contains different data.
// $result->fields['customers_extrafield'] will contain the result of the db query
}
switch ($foo) {
case 'RES': // Residential Address
$this->_upsResComCode = '1';
break;
case 'COM': // Commercial Address
$this->_upsResComCode = '0';
break;
}
}
Bookmarks