示例#1
0
 public function getCode($type, $code = '')
 {
     if (!Mage::getStoreConfig('shipping/shipusa/active')) {
         return parent::getCode($type, $code);
     }
     $codes = array('action' => array('single' => '3', 'all' => '4'), 'originShipment' => array('United States Domestic Shipments' => array('01' => Mage::helper('usa')->__('UPS Next Day Air'), '02' => Mage::helper('usa')->__('UPS Second Day Air'), '03' => Mage::helper('usa')->__('UPS Ground'), '07' => Mage::helper('usa')->__('UPS Worldwide Express'), '08' => Mage::helper('usa')->__('UPS Worldwide Expedited'), '11' => Mage::helper('usa')->__('UPS Standard'), '12' => Mage::helper('usa')->__('UPS Three-Day Select'), '13' => Mage::helper('usa')->__('UPS Next Day Air Saver'), '14' => Mage::helper('usa')->__('UPS Next Day Air Early A.M.'), '54' => Mage::helper('usa')->__('UPS Worldwide Express Plus'), '59' => Mage::helper('usa')->__('UPS Second Day Air A.M.'), '65' => Mage::helper('usa')->__('UPS Saver')), 'Shipments Originating in United States' => array('01' => Mage::helper('usa')->__('UPS Next Day Air'), '02' => Mage::helper('usa')->__('UPS Second Day Air'), '03' => Mage::helper('usa')->__('UPS Ground'), '07' => Mage::helper('usa')->__('UPS Worldwide Express'), '08' => Mage::helper('usa')->__('UPS Worldwide Expedited'), '11' => Mage::helper('usa')->__('UPS Standard'), '12' => Mage::helper('usa')->__('UPS Three-Day Select'), '14' => Mage::helper('usa')->__('UPS Next Day Air Early A.M.'), '54' => Mage::helper('usa')->__('UPS Worldwide Express Plus'), '59' => Mage::helper('usa')->__('UPS Second Day Air A.M.'), '65' => Mage::helper('usa')->__('UPS Saver')), 'Shipments Originating in Canada' => array('01' => Mage::helper('usa')->__('UPS Express'), '02' => Mage::helper('usa')->__('UPS Expedited'), '07' => Mage::helper('usa')->__('UPS Worldwide Express'), '08' => Mage::helper('usa')->__('UPS Worldwide Expedited'), '11' => Mage::helper('usa')->__('UPS Standard'), '12' => Mage::helper('usa')->__('UPS Three-Day Select'), '14' => Mage::helper('usa')->__('UPS Express Early A.M.'), '65' => Mage::helper('usa')->__('UPS Saver')), 'Shipments Originating in the European Union' => array('07' => Mage::helper('usa')->__('UPS Express'), '08' => Mage::helper('usa')->__('UPS Expedited'), '11' => Mage::helper('usa')->__('UPS Standard'), '54' => Mage::helper('usa')->__('UPS Worldwide Express PlusSM'), '65' => Mage::helper('usa')->__('UPS Saver')), 'Polish Domestic Shipments' => array('07' => Mage::helper('usa')->__('UPS Express'), '08' => Mage::helper('usa')->__('UPS Expedited'), '11' => Mage::helper('usa')->__('UPS Standard'), '54' => Mage::helper('usa')->__('UPS Worldwide Express Plus'), '65' => Mage::helper('usa')->__('UPS Saver'), '82' => Mage::helper('usa')->__('UPS Today Standard'), '83' => Mage::helper('usa')->__('UPS Today Dedicated Courrier'), '84' => Mage::helper('usa')->__('UPS Today Intercity'), '85' => Mage::helper('usa')->__('UPS Today Express'), '86' => Mage::helper('usa')->__('UPS Today Express Saver')), 'Puerto Rico Origin' => array('01' => Mage::helper('usa')->__('UPS Next Day Air'), '02' => Mage::helper('usa')->__('UPS Second Day Air'), '03' => Mage::helper('usa')->__('UPS Ground'), '07' => Mage::helper('usa')->__('UPS Worldwide Express'), '08' => Mage::helper('usa')->__('UPS Worldwide Expedited'), '14' => Mage::helper('usa')->__('UPS Next Day Air Early A.M.'), '54' => Mage::helper('usa')->__('UPS Worldwide Express Plus'), '65' => Mage::helper('usa')->__('UPS Saver')), 'Shipments Originating in Mexico' => array('07' => Mage::helper('usa')->__('UPS Express'), '08' => Mage::helper('usa')->__('UPS Expedited'), '54' => Mage::helper('usa')->__('UPS Express Plus'), '65' => Mage::helper('usa')->__('UPS Saver')), 'Shipments Originating in Other Countries' => array('07' => Mage::helper('usa')->__('UPS Express'), '08' => Mage::helper('usa')->__('UPS Worldwide Expedited'), '11' => Mage::helper('usa')->__('UPS Standard'), '54' => Mage::helper('usa')->__('UPS Worldwide Express Plus'), '65' => Mage::helper('usa')->__('UPS Saver'))), 'method' => array('1DM' => Mage::helper('usa')->__('Next Day Air Early AM'), '1DML' => Mage::helper('usa')->__('Next Day Air Early AM Letter'), '1DA' => Mage::helper('usa')->__('Next Day Air'), '1DAL' => Mage::helper('usa')->__('Next Day Air Letter'), '1DAPI' => Mage::helper('usa')->__('Next Day Air Intra (Puerto Rico)'), '1DP' => Mage::helper('usa')->__('Next Day Air Saver'), '1DPL' => Mage::helper('usa')->__('Next Day Air Saver Letter'), '2DM' => Mage::helper('usa')->__('2nd Day Air AM'), '2DML' => Mage::helper('usa')->__('2nd Day Air AM Letter'), '2DA' => Mage::helper('usa')->__('2nd Day Air'), '2DAL' => Mage::helper('usa')->__('2nd Day Air Letter'), '3DS' => Mage::helper('usa')->__('3 Day Select'), 'GND' => Mage::helper('usa')->__('Ground'), 'GNDCOM' => Mage::helper('usa')->__('Ground Commercial'), 'GNDRES' => Mage::helper('usa')->__('Ground Residential'), 'STD' => Mage::helper('usa')->__('Canada Standard'), 'XPR' => Mage::helper('usa')->__('Worldwide Express'), 'WXS' => Mage::helper('usa')->__('Worldwide Express Saver'), 'XPRL' => Mage::helper('usa')->__('Worldwide Express Letter'), 'XDM' => Mage::helper('usa')->__('Worldwide Express Plus'), 'XDML' => Mage::helper('usa')->__('Worldwide Express Plus Letter'), 'XPD' => Mage::helper('usa')->__('Worldwide Expedited')), 'pickup' => array('RDP' => array("label" => 'Regular Daily Pickup', "code" => "01"), 'OCA' => array("label" => 'On Call Air', "code" => "07"), 'OTP' => array("label" => 'One Time Pickup', "code" => "06"), 'LC' => array("label" => 'Letter Center', "code" => "19"), 'CC' => array("label" => 'Customer Counter', "code" => "03")), 'container' => array('CP' => '00', 'ULE' => '01', 'CSP' => '02', 'UT' => '03', 'PAK' => '04', 'UEB' => '21', 'UW25' => '24', 'UW10' => '25', 'PLT' => '30', 'SEB' => '2a', 'MEB' => '2b', 'LEB' => '2c'), 'container_description' => array('CP' => Mage::helper('usa')->__('Customer Packaging'), 'ULE' => Mage::helper('usa')->__('UPS Letter Envelope'), 'CSP' => Mage::helper('usa')->__('Customer Supplied Package'), 'UT' => Mage::helper('usa')->__('UPS Tube'), 'PAK' => Mage::helper('usa')->__('PAK'), 'UEB' => Mage::helper('usa')->__('UPS Express Box'), 'UW25' => Mage::helper('usa')->__('UPS Worldwide 25 kilo'), 'UW10' => Mage::helper('usa')->__('UPS Worldwide 10 kilo'), 'PLT' => Mage::helper('usa')->__('Pallet'), 'SEB' => Mage::helper('usa')->__('Small Express Box'), 'MEB' => Mage::helper('usa')->__('Medium Express Box'), 'LEB' => Mage::helper('usa')->__('Large Express Box')), 'dest_type' => array('RES' => '01', 'COM' => '02'), 'dest_type_description' => array('RES' => Mage::helper('usa')->__('Residential'), 'COM' => Mage::helper('usa')->__('Commercial')), 'unit_of_measure' => array('LBS' => Mage::helper('usa')->__('Pounds'), 'KGS' => Mage::helper('usa')->__('Kilograms'), 'CONVERT_LBS_KGS' => Mage::helper('usa')->__('Convert Lbs to Kgs')), 'containers_filter' => array(array('containers' => array('00'), 'filters' => array('within_us' => array('method' => array('01', '13', '12', '59', '03', '14', '02')), 'from_us' => array('method' => array('07', '54', '08', '65', '11')))), array('containers' => array('2a', '2b', '2c', '03'), 'filters' => array('within_us' => array('method' => array('01', '13', '14', '02', '59')), 'from_us' => array('method' => array('07', '54', '08', '65')))), array('containers' => array('24', '25'), 'filters' => array('within_us' => array('method' => array()), 'from_us' => array('method' => array('07', '54', '65')))), array('containers' => array('01', '04'), 'filters' => array('within_us' => array('method' => array('01', '14', '02', '59', '13')), 'from_us' => array('method' => array('07', '54', '65')))), array('containers' => array('04'), 'filters' => array('within_us' => array('method' => array()), 'from_us' => array('method' => array('08'))))));
     if (!isset($codes[$type])) {
         //            throw Mage::exception('Mage_Shipping', Mage::helper('usa')->__('Invalid UPS CGI code type: %s', $type));
         return false;
     } elseif ('' === $code) {
         return $codes[$type];
     }
     if (!isset($codes[$type][$code])) {
         //            throw Mage::exception('Mage_Shipping', Mage::helper('usa')->__('Invalid UPS CGI code for type %s: %s', $type, $code));
         return false;
     } else {
         return $codes[$type][$code];
     }
 }