Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS Flippin' the ship on the International tip


AllanH

Recommended Posts

Yo :)

 

When I was trying to get the USPS module working I read in the other threads that deal with that explicitly that there was a bug in which the shipping option for an order was changed to the most expensive option at the final checkout screen even after the customer had chosen something else.

 

I can no longer find that thread (even after searching :( ), but I know it didn't give a solution to issue.

 

I have narrowed it down to be an issue only for international orders (we're U.S. based), but have zero idea how to fix this. We want to go live with our store within a week or so, and want to use the USPS service, but won't be if we can't solve this problem as it obviously does not look good to customers.

 

Has anyone else ecountered and fixed this issue?

 

Help is greatly appreciated!!

 

- Allan

 

:edit: PS A HUGE THANK YOU TO THE DEVELOPERS & COMMUNITY OF osCOMMERCE!!

Edited by AllanH
Link to comment
Share on other sites

Just to be crystal clear, a customer:

 

A) puts something in the cart

B) checkouts and sets shipping to the least expensive option

C) get to the final screen where it shows that they chose the most expensive shipping :(

 

It looks like a shady, underhanded scam on our part. Sucks, 'cause otherwise this works like a charm.

 

Anyhow, hopefully someone has dealt with this before...

 

Thanks!

 

Allan

Link to comment
Share on other sites

Thanks for the link :) Unfortunately, the instructions in the there didn't work for me :(

 

This is what USPS responds with, apparently:

 

This is the answer I got from USPS

 

Dear USPS Customer,

 

Thank you for contacting us. Your account is on production and active.

 

The International Rates API engine was updated a couple of months ago, which

in turn led to some unexpected changes to the XML values we respond with.

Below are the affected SvcDescription Strings and what they are now being

returned as:

 

Global Priority Mail - Flat-rate Envelope (large) IS NOW Global Priority

Mail - Flat-rate Envelope (Large)

Global Priority Mail - Flat-rate Envelope (small) IS NOW Global Priority

Mail - Flat-rate Envelope (Small)

Global Priority Mail - Variable Weight (single) IS NOW Global Priority

Mail - Variable Weight (Single)

Airmail Letter Post IS NOW Airmail Letter-post

Economy (Surface) Letter Post IS NOW Economy (Surface) Letter-post

 

These changes will affect your shopping cart's ability to parse through the

list of possible international services. Please verify/modify your parsing

selections to reflect these changes in order to ensure accurate parsing and

the display of all available options to your end customer.

 

We hope this helps. Thank you for using the USPS.

 

 

 

USPS Internet Customer Care Center

[email protected]

 

Making these changes doesn't do anything :'(

 

Are those all of the changes to be made or are there more?

 

Anyone?

 

thanks,

 

- Allan

 

PS I'm going to try checking the latet usps.php out of CVS and see if that works and will post results here.

 

PPS can anyone else testify to the same issue? remember that everything works just fine as long as the shipping address is domestic US (if you're US based) - as soon as you want to ship internationally, it jacks the rate from the customers original choice on the final confirmationn screen.

Link to comment
Share on other sites

Okay, so, for me, the changes noted in this and other threads did not fly. I got a couple of PM's from folks stating the same thing, so I wasn't alone :)

 

Checking the latest files out of CVS, however, appears to have worked!

 

For convenience, here are the two latest usps.php files in the their entirety:

 

1) /path/to/public/catalog/includes/languages/english/modules/shipping/usps.php

 

<?php
/*
 $Id: usps.php,v 1.1.1.1 2004/11/04 08:49:16 allan Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_USPS_TEXT_TITLE', 'United States Postal Service');
define('MODULE_SHIPPING_USPS_TEXT_DESCRIPTION', 'United States Postal Service<br><br>You will need to have registered an account with USPS at http://www.uspsprioritymail.com/et_regcert.html to use this module<br><br>USPS expects you to use pounds as weight measure for your products.');
define('MODULE_SHIPPING_USPS_TEXT_OPT_PP', 'Parcel Post');
define('MODULE_SHIPPING_USPS_TEXT_OPT_PM', 'Priority Mail');
define('MODULE_SHIPPING_USPS_TEXT_OPT_EX', 'Express Mail');
define('MODULE_SHIPPING_USPS_TEXT_ERROR', 'An error occured with the USPS shipping calculations.<br>If you prefer to use USPS as your shipping method, please contact the store owner.');
?>

 

2) /path/to/public/catalog/includes/modules/shipping/usps.php

<?php
/*
 $Id: usps.php,v 1.1.1.1 2004/11/04 08:49:18 allan Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class usps {
   var $code, $title, $description, $icon, $enabled, $countries;

// class constructor
   function usps() {
     global $order;

     $this->code = 'usps';
     $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_USPS_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_usps.gif';
     $this->tax_class = MODULE_SHIPPING_USPS_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);

     if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_USPS_ZONE > 0) ) {
       $check_flag = false;
       $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
           $check_flag = true;
           break;
         }
       }

       if ($check_flag == false) {
         $this->enabled = false;
       }
     }

     $this->types = array('Express' => 'EXPRESS',
                          'First Class' => 'First-Class Mail',
                          'Priority' => 'Priority',
                          'Parcel' => 'Parcel');

     $this->intl_types = array('GXG Document' => 'Global Express Guaranteed Document Service',
                               'GXG Non-Document' => 'Global Express Guaranteed Non-Document Service',
                               'Express' => 'Global Express Mail (EMS)',
                               'Priority Lg' => 'Global Priority Mail - Flat-rate Envelope (Large)',
                               'Priority Sm' => 'Global Priority Mail - Flat-rate Envelope (Small)',
                               'Priority Var' => 'Global Priority Mail - Variable Weight Envelope (Single)',
                               'Airmail Letter' => 'Airmail Letter-post',
                               'Airmail Parcel' => 'Airmail Parcel Post',
                               'Surface Letter' => 'Economy (Surface) Letter-post',
                               'Surface Post' => 'Economy (Surface) Parcel Post');

     $this->countries = $this->country_list();
   }

// class methods
   function quote($method = '') {
     global $osC_Tax, $order, $shipping_weight, $shipping_num_boxes;

     if ( tep_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types)) ) {
       $this->_setService($method);
     }

     $this->_setMachinable('False');
     $this->_setContainer('None');
     $this->_setSize('REGULAR');

// usps doesnt accept zero weight
     $shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight);
     $shipping_pounds = floor ($shipping_weight);
     $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
     $this->_setWeight($shipping_pounds, $shipping_ounces);

     $uspsQuote = $this->_getQuote();

     if (is_array($uspsQuote)) {
       if (isset($uspsQuote['error'])) {
         $this->quotes = array('module' => $this->title,
                               'error' => $uspsQuote['error']);
       } else {
         $this->quotes = array('id' => $this->code,
                               'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)',
                               'tax' => 0);

         $methods = array();
         $size = sizeof($uspsQuote);
         for ($i=0; $i<$size; $i++) {
           list($type, $cost) = each($uspsQuote[$i]);

           $methods[] = array('id' => $type,
                              'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
                              'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
         }

         $this->quotes['methods'] = $methods;

         if ($this->tax_class > 0) {
           $this->quotes['tax'] = $osC_Tax->getTaxRate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         }
       }
     } else {
       $this->quotes = array('module' => $this->title,
                             'error' => MODULE_SHIPPING_USPS_TEXT_ERROR);
     }

     if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

     return $this->quotes;
   }

   function check() {
     if (!isset($this->_check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_USPS_STATUS'");
       $this->_check = tep_db_num_rows($check_query);
     }
     return $this->_check;
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable USPS Shipping', 'MODULE_SHIPPING_USPS_STATUS', 'True', 'Do you want to offer USPS shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enter the USPS User ID', 'MODULE_SHIPPING_USPS_USERID', 'NONE', 'Enter the USPS USERID assigned to you.', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enter the USPS Password', 'MODULE_SHIPPING_USPS_PASSWORD', 'NONE', 'See USERID, above.', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Which server to use', 'MODULE_SHIPPING_USPS_SERVER', 'production', 'An account at USPS is needed to use the Production server', '6', '0', 'tep_cfg_select_option(array(\'test\', \'production\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_USPS_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_USPS_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_USPS_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_USPS_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_PASSWORD', 'MODULE_SHIPPING_USPS_SERVER', 'MODULE_SHIPPING_USPS_HANDLING', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER');
   }

   function _setService($service) {
     $this->service = $service;
   }

   function _setWeight($pounds, $ounces=0) {
     $this->pounds = $pounds;
     $this->ounces = $ounces;
   }

   function _setContainer($container) {
     $this->container = $container;
   }

   function _setSize($size) {
     $this->size = $size;
   }

   function _setMachinable($machinable) {
     $this->machinable = $machinable;
   }

   function _getQuote() {
     global $order;

     if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) {
       $request  = '<RateRequest USERID="' . MODULE_SHIPPING_USPS_USERID . '" PASSWORD="' . MODULE_SHIPPING_USPS_PASSWORD . '">';
       $services_count = 0;

       if (isset($this->service)) {
         $this->types = array($this->service => $this->types[$this->service]);
       }

       $dest_zip = str_replace(' ', '', $order->delivery['postcode']);
       if ($order->delivery['country']['iso_code_2'] == 'US') $dest_zip = substr($dest_zip, 0, 5);

       reset($this->types);
       while (list($key, $value) = each($this->types)) {
         $request .= '<Package ID="' . $services_count . '">' .
                     '<Service>' . $key . '</Service>' .
                     '<ZipOrigination>' . SHIPPING_ORIGIN_ZIP . '</ZipOrigination>' .
                     '<ZipDestination>' . $dest_zip . '</ZipDestination>' .
                     '<Pounds>' . $this->pounds . '</Pounds>' .
                     '<Ounces>' . $this->ounces . '</Ounces>' .
                     '<Container>' . $this->container . '</Container>' .
                     '<Size>' . $this->size . '</Size>' .
                     '<Machinable>' . $this->machinable . '</Machinable>' .
                     '</Package>';
         $services_count++;
       }
       $request .= '</RateRequest>';

       $request = 'API=Rate&XML=' . urlencode($request);
     } else {
       $request  = '<IntlRateRequest USERID="' . MODULE_SHIPPING_USPS_USERID . '" PASSWORD="' . MODULE_SHIPPING_USPS_PASSWORD . '">' .
                   '<Package ID="0">' .
                   '<Pounds>' . $this->pounds . '</Pounds>' .
                   '<Ounces>' . $this->ounces . '</Ounces>' .
                   '<MailType>Package</MailType>' .
                   '<Country>' . $this->countries[$order->delivery['country']['iso_code_2']] . '</Country>' .
                   '</Package>' .
                   '</IntlRateRequest>';

       $request = 'API=IntlRate&XML=' . urlencode($request);
     }

     switch (MODULE_SHIPPING_USPS_SERVER) {
       case 'production': $usps_server = 'production.shippingapis.com';
                          $api_dll = 'shippingapi.dll';
                          break;
       case 'test':
       default:           $usps_server = 'testing.shippingapis.com';
                          $api_dll = 'ShippingAPITest.dll';
                          break;
     }

     $body = '';

     $http = new httpClient();
     if ($http->Connect($usps_server, 80)) {
       $http->addHeader('Host', $usps_server);
       $http->addHeader('User-Agent', 'osCommerce');
       $http->addHeader('Connection', 'Close');

       if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();

       $http->Disconnect();
     } else {
       return false;
     }

     $response = array();
     while (true) {
       if ($start = strpos($body, '<Package ID=')) {
         $body = substr($body, $start);
         $end = strpos($body, '</Package>');
         $response[] = substr($body, 0, $end+10);
         $body = substr($body, $end+9);
       } else {
         break;
       }
     }

     $rates = array();
     if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) {
       if (sizeof($response) == '1') {
         if (ereg('<Error>', $response[0])) {
           $number = ereg('<Number>(.*)</Number>', $response[0], $regs);
           $number = $regs[1];
           $description = ereg('<Description>(.*)</Description>', $response[0], $regs);
           $description = $regs[1];

           return array('error' => $number . ' - ' . $description);
         }
       }

       $n = sizeof($response);
       for ($i=0; $i<$n; $i++) {
         if (strpos($response[$i], '<Postage>')) {
           $service = ereg('<Service>(.*)</Service>', $response[$i], $regs);
           $service = $regs[1];
           $postage = ereg('<Postage>(.*)</Postage>', $response[$i], $regs);
           $postage = $regs[1];

           $rates[] = array($service => $postage);
         }
       }
     } else {
       if (ereg('<Error>', $response[0])) {
         $number = ereg('<Number>(.*)</Number>', $response[0], $regs);
         $number = $regs[1];
         $description = ereg('<Description>(.*)</Description>', $response[0], $regs);
         $description = $regs[1];

         return array('error' => $number . ' - ' . $description);
       } else {
         $body = $response[0];
         $services = array();
         while (true) {
           if ($start = strpos($body, '<Service ID=')) {
             $body = substr($body, $start);
             $end = strpos($body, '</Service>');
             $services[] = substr($body, 0, $end+10);
             $body = substr($body, $end+9);
           } else {
             break;
           }
         }

         $size = sizeof($services);
         for ($i=0, $n=$size; $i<$n; $i++) {
           if (strpos($services[$i], '<Postage>')) {
             $service = ereg('<SvcDescription>(.*)</SvcDescription>', $services[$i], $regs);
             $service = $regs[1];
             $postage = ereg('<Postage>(.*)</Postage>', $services[$i], $regs);
             $postage = $regs[1];

             if (isset($this->service) && ($service != $this->service) ) {
               continue;
             }

             $rates[] = array($service => $postage);
           }
         }
       }
     }

     return ((sizeof($rates) > 0) ? $rates : false);
   }

   function country_list() {
     $list = array('AF' => 'Afghanistan',
                   'AL' => 'Albania',
                   'DZ' => 'Algeria',
                   'AD' => 'Andorra',
                   'AO' => 'Angola',
                   'AI' => 'Anguilla',
                   'AG' => 'Antigua and Barbuda',
                   'AR' => 'Argentina',
                   'AM' => 'Armenia',
                   'AW' => 'Aruba',
                   'AU' => 'Australia',
                   'AT' => 'Austria',
                   'AZ' => 'Azerbaijan',
                   'BS' => 'Bahamas',
                   'BH' => 'Bahrain',
                   'BD' => 'Bangladesh',
                   'BB' => 'Barbados',
                   'BY' => 'Belarus',
                   'BE' => 'Belgium',
                   'BZ' => 'Belize',
                   'BJ' => 'Benin',
                   'BM' => 'Bermuda',
                   'BT' => 'Bhutan',
                   'BO' => 'Bolivia',
                   'BA' => 'Bosnia-Herzegovina',
                   'BW' => 'Botswana',
                   'BR' => 'Brazil',
                   'VG' => 'British Virgin Islands',
                   'BN' => 'Brunei Darussalam',
                   'BG' => 'Bulgaria',
                   'BF' => 'Burkina Faso',
                   'MM' => 'Burma',
                   'BI' => 'Burundi',
                   'KH' => 'Cambodia',
                   'CM' => 'Cameroon',
                   'CA' => 'Canada',
                   'CV' => 'Cape Verde',
                   'KY' => 'Cayman Islands',
                   'CF' => 'Central African Republic',
                   'TD' => 'Chad',
                   'CL' => 'Chile',
                   'CN' => 'China',
                   'CX' => 'Christmas Island (Australia)',
                   'CC' => 'Cocos Island (Australia)',
                   'CO' => 'Colombia',
                   'KM' => 'Comoros',
                   'CG' => 'Congo (Brazzaville),Republic of the',
                   'ZR' => 'Congo, Democratic Republic of the',
                   'CK' => 'Cook Islands (New Zealand)',
                   'CR' => 'Costa Rica',
                   'CI' => 'Cote d\'Ivoire (Ivory Coast)',
                   'HR' => 'Croatia',
                   'CU' => 'Cuba',
                   'CY' => 'Cyprus',
                   'CZ' => 'Czech Republic',
                   'DK' => 'Denmark',
                   'DJ' => 'Djibouti',
                   'DM' => 'Dominica',
                   'DO' => 'Dominican Republic',
                   'TP' => 'East Timor (Indonesia)',
                   'EC' => 'Ecuador',
                   'EG' => 'Egypt',
                   'SV' => 'El Salvador',
                   'GQ' => 'Equatorial Guinea',
                   'ER' => 'Eritrea',
                   'EE' => 'Estonia',
                   'ET' => 'Ethiopia',
                   'FK' => 'Falkland Islands',
                   'FO' => 'Faroe Islands',
                   'FJ' => 'Fiji',
                   'FI' => 'Finland',
                   'FR' => 'France',
                   'GF' => 'French Guiana',
                   'PF' => 'French Polynesia',
                   'GA' => 'Gabon',
                   'GM' => 'Gambia',
                   'GE' => 'Georgia, Republic of',
                   'DE' => 'Germany',
                   'GH' => 'Ghana',
                   'GI' => 'Gibraltar',
                   'GB' => 'Great Britain and Northern Ireland',
                   'GR' => 'Greece',
                   'GL' => 'Greenland',
                   'GD' => 'Grenada',
                   'GP' => 'Guadeloupe',
                   'GT' => 'Guatemala',
                   'GN' => 'Guinea',
                   'GW' => 'Guinea-Bissau',
                   'GY' => 'Guyana',
                   'HT' => 'Haiti',
                   'HN' => 'Honduras',
                   'HK' => 'Hong Kong',
                   'HU' => 'Hungary',
                   'IS' => 'Iceland',
                   'IN' => 'India',
                   'ID' => 'Indonesia',
                   'IR' => 'Iran',
                   'IQ' => 'Iraq',
                   'IE' => 'Ireland',
                   'IL' => 'Israel',
                   'IT' => 'Italy',
                   'JM' => 'Jamaica',
                   'JP' => 'Japan',
                   'JO' => 'Jordan',
                   'KZ' => 'Kazakhstan',
                   'KE' => 'Kenya',
                   'KI' => 'Kiribati',
                   'KW' => 'Kuwait',
                   'KG' => 'Kyrgyzstan',
                   'LA' => 'Laos',
                   'LV' => 'Latvia',
                   'LB' => 'Lebanon',
                   'LS' => 'Lesotho',
                   'LR' => 'Liberia',
                   'LY' => 'Libya',
                   'LI' => 'Liechtenstein',
                   'LT' => 'Lithuania',
                   'LU' => 'Luxembourg',
                   'MO' => 'Macao',
                   'MK' => 'Macedonia, Republic of',
                   'MG' => 'Madagascar',
                   'MW' => 'Malawi',
                   'MY' => 'Malaysia',
                   'MV' => 'Maldives',
                   'ML' => 'Mali',
                   'MT' => 'Malta',
                   'MQ' => 'Martinique',
                   'MR' => 'Mauritania',
                   'MU' => 'Mauritius',
                   'YT' => 'Mayotte (France)',
                   'MX' => 'Mexico',
                   'MD' => 'Moldova',
                   'MC' => 'Monaco (France)',
                   'MN' => 'Mongolia',
                   'MS' => 'Montserrat',
                   'MA' => 'Morocco',
                   'MZ' => 'Mozambique',
                   'NA' => 'Namibia',
                   'NR' => 'Nauru',
                   'NP' => 'Nepal',
                   'NL' => 'Netherlands',
                   'AN' => 'Netherlands Antilles',
                   'NC' => 'New Caledonia',
                   'NZ' => 'New Zealand',
                   'NI' => 'Nicaragua',
                   'NE' => 'Niger',
                   'NG' => 'Nigeria',
                   'KP' => 'North Korea (Korea, Democratic People\'s Republic of)',
                   'NO' => 'Norway',
                   'OM' => 'Oman',
                   'PK' => 'Pakistan',
                   'PA' => 'Panama',
                   'PG' => 'Papua New Guinea',
                   'PY' => 'Paraguay',
                   'PE' => 'Peru',
                   'PH' => 'Philippines',
                   'PN' => 'Pitcairn Island',
                   'PL' => 'Poland',
                   'PT' => 'Portugal',
                   'QA' => 'Qatar',
                   'RE' => 'Reunion',
                   'RO' => 'Romania',
                   'RU' => 'Russia',
                   'RW' => 'Rwanda',
                   'SH' => 'Saint Helena',
                   'KN' => 'Saint Kitts (St. Christopher and Nevis)',
                   'LC' => 'Saint Lucia',
                   'PM' => 'Saint Pierre and Miquelon',
                   'VC' => 'Saint Vincent and the Grenadines',
                   'SM' => 'San Marino',
                   'ST' => 'Sao Tome and Principe',
                   'SA' => 'Saudi Arabia',
                   'SN' => 'Senegal',
                   'YU' => 'Serbia-Montenegro',
                   'SC' => 'Seychelles',
                   'SL' => 'Sierra Leone',
                   'SG' => 'Singapore',
                   'SK' => 'Slovak Republic',
                   'SI' => 'Slovenia',
                   'SB' => 'Solomon Islands',
                   'SO' => 'Somalia',
                   'ZA' => 'South Africa',
                   'GS' => 'South Georgia (Falkland Islands)',
                   'KR' => 'South Korea (Korea, Republic of)',
                   'ES' => 'Spain',
                   'LK' => 'Sri Lanka',
                   'SD' => 'Sudan',
                   'SR' => 'Suriname',
                   'SZ' => 'Swaziland',
                   'SE' => 'Sweden',
                   'CH' => 'Switzerland',
                   'SY' => 'Syrian Arab Republic',
                   'TW' => 'Taiwan',
                   'TJ' => 'Tajikistan',
                   'TZ' => 'Tanzania',
                   'TH' => 'Thailand',
                   'TG' => 'Togo',
                   'TK' => 'Tokelau (Union) Group (Western Samoa)',
                   'TO' => 'Tonga',
                   'TT' => 'Trinidad and Tobago',
                   'TN' => 'Tunisia',
                   'TR' => 'Turkey',
                   'TM' => 'Turkmenistan',
                   'TC' => 'Turks and Caicos Islands',
                   'TV' => 'Tuvalu',
                   'UG' => 'Uganda',
                   'UA' => 'Ukraine',
                   'AE' => 'United Arab Emirates',
                   'UY' => 'Uruguay',
                   'UZ' => 'Uzbekistan',
                   'VU' => 'Vanuatu',
                   'VA' => 'Vatican City',
                   'VE' => 'Venezuela',
                   'VN' => 'Vietnam',
                   'WF' => 'Wallis and Futuna Islands',
                   'WS' => 'Western Samoa',
                   'YE' => 'Yemen',
                   'ZM' => 'Zambia',
                   'ZW' => 'Zimbabwe');

     return $list;
   }
 }
?>

Link to comment
Share on other sites

Thanks for posting the CVS files. Out of curiosity, I ran includes/modules/shipping/usps.php in Beyond Compare against my current usps.php file. Some differences in the domestic types array and in tax quotes.

 

The types array starting at line 46...

 

CVS file:

 

     $this->types = array('Express' => 'EXPRESS',
                         'First Class' => 'First-Class Mail',
                         'Priority' => 'Priority',
                         'Parcel' => 'Parcel');

 

Older file:

 

     $this->types = array('Express' => 'Express Mail',
                         'First Class' => 'First-Class Mail',
                         'Priority' => 'Priority Mail',
                         'Parcel' => 'Parcel Post');

 

The intl_types array starting at line 51 is the same in both files (in line with the recommended changes in the USPS letter).

 

Line 67...

The CVS file added global $osC_Tax.

 

global $osC_Tax, $order, $shipping_weight, $shipping_num_boxes;

 

Line 91...

 

CVS file:

 

'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)',
                              'tax' => 0);

 

Older file:

 

'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');

 

Line 107...

 

CVS file:

 

$this->quotes['tax'] = $osC_Tax->getTaxRate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

 

Older file:

 

$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

 

Cheers.

Edited by bglkk

"Buy the ticket, take the ride..." -HST

Link to comment
Share on other sites

Thanks for the direct comparison bglkk :)

 

By way of follow up, after I finally got it working, I discovered that I also needed to be able to limit and control which options were presented to our customers, which meant that I needed the USPS Methods contrib (http://www.oscommerce.com/community/contributions,487/category,2/search,usps).

 

I was wary to undo the work I had just done (the contrib calls for replacing both usps.php files), but it was necessary, so I did it and it worked just fine.

 

So, the usps.php files in the USPS Methods contrib work as well.

 

Upon completing this, I do recall that someone in one of the other threads did, actually, suggest doing this, I just brushed over it as I did think it applied to me.

 

Let's have three cheers for having a well thought out flow chart detailing your needs and objectives! (what I should have done, but didn't) :blush:

 

Word.

 

- A

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...