Jump to content
Sign in to follow this  
primordialstuff

USPS Module Help Please!

Recommended Posts

New Wrinkle this morning! Both Domestic and International worked fine with the Capitalization Changes but as of this morning, International is wonky again.... on 6 sites!

Anyone else?

Share this post


Link to post
Share on other sites
New Wrinkle this morning! Both Domestic and International worked fine with the Capitalization Changes but as of this morning, International is wonky again.... on 6 sites!

Anyone else?

 

Can you please clarify what you mean by "wonky again"? To my knowledge there was never a problem with international as the issue was limited to domestic US shipping options. I have tested my site and find no issues with international shipping. However, I only use Express International and Priority International. If the issue is with other options, I would not see them.

 

David


Anthony David

AllThingsTrendy.com

Share this post


Link to post
Share on other sites
Thanks Colin,

I guess I know just enough to be REALLY Dangerous.

I got my files from the link you provided.

I only have one database. bk2gdb1

Went to SQL

I imported the Update.sql

It says "Run SQL query/queries on database bk2gdb1:"

In "FIELDS" on the right, it shows the correct fields in "Configuration"

When I run it, it gives me # MySQL returned an empty result set (i.e. zero rows).

Same as when I copied and pasted.

:'(

At this point, I'm not really sure what the problem is. I just hack and hack at this stuff myself. If your web-host doesn't have a tech department to help you with phpmyadmin and SQL stuff, and no one who's truly expert turns up in these parts, there are a lot of other things you could try, with a range of difficulty and time factors involved, but all likely to teach you a few things about the SQL and phpmyadmin even if they turned out to be blind alleys. First, of course, you'd want to search through the documentation to get clear on exactly what your message means. If that doesn't lead you to an easy fix, you might try checking and repairing the table. You might try replacing it with a back-up, and so on, and so on. If the site was new and unmodified, I'd try reinstalling it. You could even try a second install on a second database and see if you could duplicate the error.

 

Sorry I can't be more help.

Edited by kymar

Share this post


Link to post
Share on other sites

Everything was fine after I changed all the Capital Letters, etc. as posted 11/19: but this morning, International will only show one option even though 2 or 3 options should be available AND it isn't the same option on different sites.

 

First Class International has totally disappeared everywhere and only one option is available: PRIORITY INTL FLATENV on some sites and EXPRESS on others.

 

The only difference in the programming between the six sites is the Methods Offered by the store owner... the code is identical.

Share this post


Link to post
Share on other sites
Everything was fine after I changed all the Capital Letters, etc. as posted 11/19: but this morning, International will only show one option even though 2 or 3 options should be available AND it isn't the same option on different sites.

 

First Class International has totally disappeared everywhere and only one option is available: PRIORITY INTL FLATENV on some sites and EXPRESS on others.

 

The only difference in the programming between the six sites is the Methods Offered by the store owner... the code is identical.

Not having that problem on my site. I enable only 1st Class Int, Priority Int, and Express Int. I have to ask, have you proofread your typing very carefully and removed and re-installed the module in admin, or did you use the contribution files? Have you seen whether the same errors occur with identical options enabled across the multiple sites?

Share this post


Link to post
Share on other sites

Re: the fix at

http://addons.oscommerce.com/info/487

I overwrote the old usps.php shipping module, removed from admin, then installed in admin. However when I click edit on the new usps module I get:

 

Fatal error: Call to undefined function: tep_cfg_select_multioption() in /admin/modules.php(220) : eval()'d code on line 1

Any ideas?

Share this post


Link to post
Share on other sites
Re: the fix at

http://addons.oscommerce.com/info/487

I overwrote the old usps.php shipping module, removed from admin, then installed in admin. However when I click edit on the new usps module I get:

 

Fatal error: Call to undefined function: tep_cfg_select_multioption() in /admin/modules.php(220) : eval()'d code on line 1

Any ideas?

Sorry, I was thinking this was a drop in replacement for the default OSC usps.php module, but it appears there's a lot more to it. Where do I start (it appears the latest is simply a replacement for the previous version of the mod... do I start with the 2002 mod install instructions, or is there a more recent "full install" - is 2.92 the correct starting point now, and then drop in the 2.9.2 fix?

Share this post


Link to post
Share on other sites

I have looked through all of the posts in this thread and have followed the advice that was given but I am still getting the following error.

 

An error occurred with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

What I have done is change the lower case options to upper case. I then ran the sql update. I uninstalled the module. I even made a copy of the usps.php file, deleted the file on the server, and uploaded the edited file. Then I reinstalled the module and I still get this message. I don't know what else to do. The first time I got the error was when I modified the options to upper case.

 

My client is the one who notice that his shopping cart was omitting the First Class Option as a shipping option even though it was checked in the admin module. He also said that when he selects Library Rate is was giving him the Priority Rate instead. This lead me to this thread and the stumped state I am in now.

 

Please read the code...I need help! Below is a copy of my usps.php file. I hope someone will read through it and figure out what I messed up. It has been modified several times as you can see by the comments.

 

****************************************

<?php

/*

$Id: usps.php,v 1.47 2003/04/08 23:23:42 dgw_ Exp $

++++ modified as USPS Methods 2.7 03/26/04 by Brad Waite and Fritz Clapp ++++

++++ incorporating USPS revisions to service names ++++

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 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;

}

}

 

// Updated Nov 27 for USPS update

$this->types = array('EXPRESS' => 'Express Mail', 'FIRST CLASS' => 'First-Class Mail', 'PRIORITY' => 'Priority', 'PARCEL' => 'Parcel', 'BPM' => 'Bound Printed Material', 'LIBRARY' => 'Library', 'MEDIA' => 'Media Mail');

// End update

 

/*

$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 (Single)',

'Airmail Letter' => 'Airmail Letter Post',

'Airmail Parcel' => 'Airmail Parcel Post',

'Surface Letter' => 'Economy (Surface) Letter Post',

'Surface Post' => 'Economy (Surface) Parcel Post');

*/

 

// updated rate change

$this->intl_types = array('Global Express' => 'Global Express Guaranteed',

'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular',

'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular',

'Express Mail Int' => 'Express Mail International (EMS)',

'Express Mail Int Flat Rate Env' => 'Express Mail International (EMS) Flat Rate Envelope',

'Priority Mail Int' => 'Priority Mail International',

'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope',

'Priority Mail Int Flat Rate Box' => 'Priority Mail International Flat Rate Box',

'First-Class Mail Int' => 'First-Class Mail International');

// end

 

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

}

 

// class methods

function quote($method = '') {

global $order, $shipping_weight, $shipping_num_boxes, $transittime;

 

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

$this->_setService($method);

}

 

$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);

 

// Added by Kevin Chen (kkchen@uci.edu); Fixes the Parcel Post Bug July 1, 2004

// Refer to http://www.usps.com/webtools/htm/Domestic-Rates.htm documentation

// Thanks Ryan

if($shipping_pounds > 35 || ($shipping_pounds == 0 && $shipping_ounces < 6)){

$this->_setMachinable('False');

}

else{

$this->_setMachinable('True');

}

// End Kevin Chen July 1, 2004

 

if (in_array('Display weight', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {

$shiptitle = ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)';

} else {

$shiptitle = '';

}

 

$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 . $shiptitle);

 

$methods = array();

$size = sizeof($uspsQuote);

for ($i=0; $i<$size; $i++) {

list($type, $cost) = each($uspsQuote[$i]);

 

$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);

if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];

 

$methods[] = array('id' => $type,

'title' => $title,

'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);

}

 

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

 

if ($this->tax_class > 0) {

$this->quotes['tax'] = tep_get_tax_rate($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())");

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 ('Domestic Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES', 'Express, Priority, First Class, Parcel, BPM, Library, Media,', 'Select the domestic services to be offered:', '6', '14', 'tep_cfg_select_multioption(array(\'Express\', \'Priority\', \'First Class\', \'Parcel\', \'BPM\', \'Library\', \'Media\'), ', 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 ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GXG Document, GXG Non-Document, Express, Priority Lg, Priority Sm, Priority Var, Airmail Letter, Airmail Parcel, Surface Letter, Surface Post', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG Document\', \'GXG Non-Document\', \'Express\', \'Priority Lg\', \'Priority Sm\', \'Priority Var\', \'Airmail Letter\', \'Airmail Parcel\', \'Surface Letter\', \'Surface Post\'), ', now())");

*/

 

// updated rate change

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 ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'Global Express, Global Express Non-Doc Rect, Global Express Non-Doc Non-Rect, Express Mail Int, Express Mail Int Flat Rate Env, Priority Mail Int, Priority Mail Int Flat Rate Env, Priority Mail Int Flat Rate Box, First-Class Mail Int', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'Global Express\', \'Global Express Non-Doc Rect\', \'Global Express Non-Doc Non-Rect\', \'Express Mail Int\', \'Express Mail Int Flat Rate Env\', \'Priority Mail Int\', \'Priority Mail Int Flat Rate Env\', \'Priority Mail Int Flat Rate Box\', \'First-Class Mail Int\'), ', now())");

// end

 

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 ('USPS Options', 'MODULE_SHIPPING_USPS_OPTIONS', 'Display weight, Display transit time', 'Select from the following the USPS options.', '6', '16', 'tep_cfg_select_multioption(array(\'Display weight\', \'Display transit time\'), ', 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', 'MODULE_SHIPPING_USPS_OPTIONS', 'MODULE_SHIPPING_USPS_TYPES', 'MODULE_SHIPPING_USPS_TYPES_INTL');

}

 

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, $transittime;

 

if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $transit = TRUE;

 

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);

$allowed_types = explode(", ", MODULE_SHIPPING_USPS_TYPES);

 

while (list($key, $value) = each($this->types)) {

 

if ( !in_array($key, $allowed_types) ) continue;

 

$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>';

 

if($transit){

$transitreq = 'USERID="' . MODULE_SHIPPING_USPS_USERID .

'" PASSWORD="' . MODULE_SHIPPING_USPS_PASSWORD . '">' .

'<OriginZip>' . STORE_ORIGIN_ZIP . '</OriginZip>' .

'<DestinationZip>' . $dest_zip . '</DestinationZip>';

 

switch ($key) {

case 'Express': $transreq[$key] = 'API=ExpressMail&XML=' .

urlencode( '<ExpressMailRequest ' . $transitreq . '</ExpressMailRequest>');

break;

case 'Priority': $transreq[$key] = 'API=PriorityMail&XML=' .

urlencode( '<PriorityMailRequest ' . $transitreq . '</PriorityMailRequest>');

break;

case 'Parcel': $transreq[$key] = 'API=StandardB&XML=' .

urlencode( '<StandardBRequest ' . $transitreq . '</StandardBRequest>');

break;

default: $transreq[$key] = '';

break;

}

}

 

$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 = 'stg-production.shippingapis.com';

$api_dll = 'shippingapi.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();

// mail('you@yourdomain.com','USPS rate quote response',$body,'From: <you@yourdomain.com>');

if ($transit && is_array($transreq) && ($order->delivery['country']['id'] == STORE_COUNTRY)) {

while (list($key, $value) = each($transreq)) {

if ($http->Get('/' . $api_dll . '?' . $value)) $transresp[$key] = $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);

 

if ($transit) {

switch ($service) {

case 'Express': $time = ereg('<MonFriCommitment>(.*)</MonFriCommitment>', $transresp[$service], $tregs);

$time = $tregs[1];

if ($time == '' || $time == 'No Data') {

$time = '1 - 2 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

} else {

$time = 'Tomorrow by ' . $time;

}

break;

case 'Priority': $time = ereg('<Days>(.*)</Days>', $transresp[$service], $tregs);

$time = $tregs[1];

if ($time == '' || $time == 'No Data') {

$time = '2 - 3 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

} elseif ($time == '1') {

$time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAY;

} else {

$time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

}

break;

case 'Parcel': $time = ereg('<Days>(.*)</Days>', $transresp[$service], $tregs);

$time = $tregs[1];

if ($time == '' || $time == 'No Data') {

$time = '4 - 7 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

} elseif ($time == '1') {

$time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAY;

} else {

$time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

}

break;

case 'First Class': $time = '2 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

break;

default: $time = '';

break;

}

if ($time != '') $transittime[$service] = ' (' . $time . ')';

}

}

}

} 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;

}

}

$allowed_types = array();

foreach( explode(", ", MODULE_SHIPPING_USPS_TYPES_INTL) as $value ) $allowed_types[$value] = $this->intl_types[$value];

 

$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];

$time = ereg('<SvcCommitments>(.*)</SvcCommitments>', $services[$i], $tregs);

$time = $tregs[1];

$time = preg_replace('/Weeks$/', MODULE_SHIPPING_USPS_TEXT_WEEKS, $time);

$time = preg_replace('/Days$/', MODULE_SHIPPING_USPS_TEXT_DAYS, $time);

$time = preg_replace('/Day$/', MODULE_SHIPPING_USPS_TEXT_DAY, $time);

 

if( !in_array($service, $allowed_types) ) continue;

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

continue;

}

 

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

if ($time != '') $transittime[$service] = ' (' . $time . ')';

}

}

}

}

 

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;

}

}

?>

Share this post


Link to post
Share on other sites
Does it say free shipping on products that weight less than 0.2 lbs? I have a free shipping contrib installed but that shouldn't have anything to do with the code that I posted. I don't think the problem is on my end.

No. I also have the free shipping mod installed but it's set to only give free shipping on specific products, and has nothing to do with the packing weight. I also discovered that international customers are receiving the following statement:

"An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner."

But only to address outside the United States. Anyone know why this is?

Share this post


Link to post
Share on other sites
I have looked through all of the posts in this thread and have followed the advice that was given but I am still getting the following error.

 

An error occurred with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

What I have done is change the lower case options to upper case. I then ran the sql update. I uninstalled the module. I even made a copy of the usps.php file, deleted the file on the server, and uploaded the edited file. Then I reinstalled the module and I still get this message. I don't know what else to do. The first time I got the error was when I modified the options to upper case.

 

My client is the one who notice that his shopping cart was omitting the First Class Option as a shipping option even though it was checked in the admin module. He also said that when he selects Library Rate is was giving him the Priority Rate instead. This lead me to this thread and the stumped state I am in now.

 

Please read the code...I need help! Below is a copy of my usps.php file. I hope someone will read through it and figure out what I messed up. It has been modified several times as you can see by the comments.

 

If what you pasted here is the file you're using, then you somehow missed or lost the upper case tags in the variable declaration section.

 

$this->intl_types = array('Global Express' => 'Global Express Guaranteed',
'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular',
'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular',
'Express Mail Int' => 'Express Mail International (EMS)',
'Express Mail Int Flat Rate Env' => 'Express Mail International (EMS) Flat Rate Envelope',
'Priority Mail Int' => 'Priority Mail International',
'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope',
'Priority Mail Int Flat Rate Box' => 'Priority Mail International Flat Rate Box',
'First-Class Mail Int' => 'First-Class Mail International');

 

should be

 

$this->intl_types = array('GLOBAL EXPRESS' => 'Global Express Guaranteed',
			'GLOBAL EXPRESS NON-DOC RECT' => 'Global Express Guaranteed Non-Document Rectangular',
			'GLOBAL EXPRESS NON-DOC NON-RECT' => 'Global Express Guaranteed Non-Document Non-Rectangular',
			'EXPRESS MAIL INT' => 'Express Mail International (EMS)',
			'EXPRESS MAIL INT FLAT RATE ENV' => 'Express Mail International (EMS) Flat Rate Envelope',
			'PRIORITY MAIL INT' => 'Priority Mail International',
			'PRIORITY MAIL INT FLAT RATE ENV' => 'Priority Mail International Flat Rate Envelope',
			'PRIORITY MAIL INT FLAT RATE BOX' => 'Priority Mail International Flat Rate Box',
			'FIRST-CLASS MAIL INT' => 'First-Class Mail International');

 

same problem in the tep_db_query section, for both domestic and international variables

 

refer to the usps-2.9.2a_1 contribution for details

Share this post


Link to post
Share on other sites
No. I also have the free shipping mod installed but it's set to only give free shipping on specific products, and has nothing to do with the packing weight. I also discovered that international customers are receiving the following statement:

"An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner."

But only to address outside the United States. Anyone know why this is?

A clarification on the International thing..

My code (since the update) as far as the capitalization goes, i think is correct. (see below). So i have no idea why international addresses alone are giving me an error. Is there some other portion of the code that would only affect international shipping?

$this->types = array('EXPRESS' => 'Express Mail', 'FIRST CLASS' => 'First-Class Mail', 'PRIORITY' => 'Priority Mail', 'PARCEL' => 'Parcel Post', 'BPM' => 'Bound Printed Material', 'LIBRARY' => 'Library', 'MEDIA' => 'Media Mail');

     $this->intl_types = array('GLOBAL EXPRESS' => 'Global Express Guaranteed',
               'GLOBAL EXPRESS NON-DOC RECT' => 'Global Express Guaranteed Non-Document Rectangular',
               'GLOBAL EXPRESS NON-DOC NON-RECT' => 'Global Express Guaranteed Non-Document Non-Rectangular',
               'EXPRESS MAIL INT' => 'Express Mail International (EMS)',
               'EXPRESS MAIL INT FLAT RATE ENV' => 'Express Mail International (EMS) Flat Rate Envelope',
               'PRIORITY MAIL INT' => 'Priority Mail International',
               'PRIORITY MAIL INT FLAT RATE ENV' => 'Priority Mail International Flat Rate Envelope',
               'PRIORITY MAIL INT FLAT RATE BOX' => 'Priority Mail International Flat Rate Box',
               'FIRST-CLASS MAIL INT' => 'First-Class Mail International');

Edited by dtchaos

Share this post


Link to post
Share on other sites
A On the International thing..

My code (since the update) as far as the capitalization goes, i think is correct. (see below). So i have no idea why international addresses alone are giving me an error. Is there some other portion of the code that would only affect international shipping?

 

Possibly the tep_db_query section, where all of the variables appear again.

 

I'd recommend that you start over again: Backup and uninstall your current settings and files. Replace them fully with the contribution files following the instructions to the letter, and not installing the module in admin or testing it until everything is set. If you're still getting the error, then it may be "above my paygrade" or at least beyond my expertise to help you. If you have custom changes to the files, re-insert them only after you've made sure that the "clean" (re-)install works properly.

Share this post


Link to post
Share on other sites
Possibly the tep_db_query section, where all of the variables appear again.

 

I'd recommend that you start over again: Backup and uninstall your current settings and files. Replace them fully with the contribution files following the instructions to the letter, and not installing the module in admin or testing it until everything is set. If you're still getting the error, then it may be "above my paygrade" or at least beyond my expertise to help you. If you have custom changes to the files, re-insert them only after you've made sure that the "clean" (re-)install works properly.

Well i tried this from scratch uninstalled the old one then rand the SQL replaced the usps.php and the other files then clicked the "isntall" button after everything was uploaded. Now the install button is still there, i can't edit settings or anything it's just stuck. I can't uninstall it. I tried going back to the old file(s) (the back ups) but that doesn't work. Now I'm at a total loss for how to fix this. Anyone have any ideas?

Share this post


Link to post
Share on other sites
Well i tried this from scratch uninstalled the old one then rand the SQL replaced the usps.php and the other files then clicked the "isntall" button after everything was uploaded. Now the install button is still there, i can't edit settings or anything it's just stuck. I can't uninstall it. I tried going back to the old file(s) (the back ups) but that doesn't work. Now I'm at a total loss for how to fix this. Anyone have any ideas?

To solve this i went into phpMyAdmin selected the configuration table and found a field with the configuration_key as installed_modules_shipping or something close to that. I edited it and removed usps.php from the field. There were also a bunch of duplicate fields for the usps shipping module. I have since removed all those fields and started the install from scratch. My problem now is none of the International shipping check boxes are showing up in the admin section. I'm still trying to figure out why. If you have any ideas why this might be please let me know.

Share this post


Link to post
Share on other sites
To solve this i went into phpMyAdmin selected the configuration table and found a field with the configuration_key as installed_modules_shipping or something close to that. I edited it and removed usps.php from the field. There were also a bunch of duplicate fields for the usps shipping module. I have since removed all those fields and started the install from scratch. My problem now is none of the International shipping check boxes are showing up in the admin section. I'm still trying to figure out why. If you have any ideas why this might be please let me know.

Corrupted table? You might want to look into the PHPMYADMIN repair routines. Hard for me to say.

Share this post


Link to post
Share on other sites
Corrupted table? You might want to look into the PHPMYADMIN repair routines. Hard for me to say.

So it is likely that these are not being input into the database correctly? I'm fairly certain that the code below is what inserts them into the database.

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 ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GLOBAL EXPRESS,GLOBAL EXPRESS NON-DOC RECT, GLOBAL EXPRESS NON-DOC NON-RECT, EXPRESS MAIL INT, EXPRESS MAIL INT FLAT RATE ENV, PRIORITY MAIL INT, PRIORITY MAIL INT FLAT RATE ENV, PRIORITY MAIL INT FLAT RATE BOX, FIRST-CLASS MAIL INT', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GLOBAL EXPRESS\', \'GLOBAL EXPRESS NON-DOC RECT\', \'GLOBAL EXPRESS NON-DOC NON-RECT\', \'EXPRESS MAIL INT\', \'EXPRESS MAIL INT FLAT RATE ENV\', \'PRIORITY MAIL INT\', \'PRIORITY MAIL INT FLAT RATE ENV\', \'PRIORITY MAIL INT FLAT RATE BOX\', \'FIRST-CLASS MAIL INT\'), ',  now())");

After installing the data base there is a row in the "configuration" table with the following values

 

configuration_value = GLOBAL EXPRESS,GLOBAL EXPRESS NON-DOC RECT, GLOBAL EXPRESS NON-DOC NON-RECT, EXPRESS MAIL INT, EXPRESS MAIL INT FLAT RATE ENV, PRIORITY MAIL INT, PRIORITY MAIL INT FLAT RATE ENV, PRIORITY MAIL INT FLAT RATE BOX, FIRST-CLASS MAIL INT

configuration_key = MODULE_SHIPPING_USPS_TYPES_INTL

configuration_title = Int'l Shipping Methods

 

Are these values correct? is this where the it gets the information to draw the check boxes? If this information is correct is it possible that the code the draws the check boxes on screen is wrong, if so where is that code, and what should it look like?

 

Thanks!

Share this post


Link to post
Share on other sites
So it is likely that these are not being input into the database correctly? I'm fairly certain that the code below is what inserts them into the database.

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 ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GLOBAL EXPRESS,GLOBAL EXPRESS NON-DOC RECT, GLOBAL EXPRESS NON-DOC NON-RECT, EXPRESS MAIL INT, EXPRESS MAIL INT FLAT RATE ENV, PRIORITY MAIL INT, PRIORITY MAIL INT FLAT RATE ENV, PRIORITY MAIL INT FLAT RATE BOX, FIRST-CLASS MAIL INT', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GLOBAL EXPRESS\', \'GLOBAL EXPRESS NON-DOC RECT\', \'GLOBAL EXPRESS NON-DOC NON-RECT\', \'EXPRESS MAIL INT\', \'EXPRESS MAIL INT FLAT RATE ENV\', \'PRIORITY MAIL INT\', \'PRIORITY MAIL INT FLAT RATE ENV\', \'PRIORITY MAIL INT FLAT RATE BOX\', \'FIRST-CLASS MAIL INT\'), ',  now())");

After installing the data base there is a row in the "configuration" table with the following values

 

configuration_value = GLOBAL EXPRESS,GLOBAL EXPRESS NON-DOC RECT, GLOBAL EXPRESS NON-DOC NON-RECT, EXPRESS MAIL INT, EXPRESS MAIL INT FLAT RATE ENV, PRIORITY MAIL INT, PRIORITY MAIL INT FLAT RATE ENV, PRIORITY MAIL INT FLAT RATE BOX, FIRST-CLASS MAIL INT

configuration_key = MODULE_SHIPPING_USPS_TYPES_INTL

configuration_title = Int'l Shipping Methods

 

Are these values correct? is this where the it gets the information to draw the check boxes? If this information is correct is it possible that the code the draws the check boxes on screen is wrong, if so where is that code, and what should it look like?

 

Thanks!

I believe the part that "draws the check boxes" - if I understand you correctly - is the function called by tep_cfg_select_multioption with the subsequent array variables. As you probably know, all it takes is a single missing quote or other mis-punctuation to throw the whole thing off

 

The values look correct to me on first glance, but, if your table is corrupted or otherwise impaired, either as a result of your own edits or of other problems that can develop over time and use, then it might need either to be repaired or replaced. Without figuring out how the code and database interaction work in their entirety and why precisely they're written as they are - something I've never done and that might take a good bit of time for a mere hacker like me - it's probably worth going back to your last working database backup (or a true clean install if that's a workable option for you), and then re-installing from there using the contribution files or some other working version of usps.php exactly as written. Once you've got things appearing more or less as expected, even if it's a largely or partly obsolete version, then you can proceed to whatever remaining alterations you need to make, proceeding very carefully, of course.

Share this post


Link to post
Share on other sites
I believe the part that "draws the check boxes" - if I understand you correctly - is the function called by tep_cfg_select_multioption with the subsequent array variables. As you probably know, all it takes is a single missing quote or other mis-punctuation to throw the whole thing off

 

The values look correct to me on first glance, but, if your table is corrupted or otherwise impaired, either as a result of your own edits or of other problems that can develop over time and use, then it might need either to be repaired or replaced. Without figuring out how the code and database interaction work in their entirety and why precisely they're written as they are - something I've never done and that might take a good bit of time for a mere hacker like me - it's probably worth going back to your last working database backup (or a true clean install if that's a workable option for you), and then re-installing from there using the contribution files or some other working version of usps.php exactly as written. Once you've got things appearing more or less as expected, even if it's a largely or partly obsolete version, then you can proceed to whatever remaining alterations you need to make, proceeding very carefully, of course.

I tested it, and it actually works, as in it presents the correct prices from USPS to the customer (for both international and domestic) I just don't see the check boxes for the international shipping types on the admin page. I'd like to be able to disable some of these but since it works I'm not going to play with it too much. If anyone finds a reason why this would happen please let me know.

Thanks for all the help so far.

Share this post


Link to post
Share on other sites
At this point, I'm not really sure what the problem is. I just hack and hack at this stuff myself. If your web-host doesn't have a tech department to help you with phpmyadmin and SQL stuff, and no one who's truly expert turns up in these parts, there are a lot of other things you could try, with a range of difficulty and time factors involved, but all likely to teach you a few things about the SQL and phpmyadmin even if they turned out to be blind alleys. First, of course, you'd want to search through the documentation to get clear on exactly what your message means. If that doesn't lead you to an easy fix, you might try checking and repairing the table. You might try replacing it with a back-up, and so on, and so on. If the site was new and unmodified, I'd try reinstalling it. You could even try a second install on a second database and see if you could duplicate the error.

 

Sorry I can't be more help.

 

I followed instructions for installing the 2.9.2 fix, as other have suggested in this thread, ran update.sql, and got this error upon trying to 'edit' the USPS module from within the admin section: Fatal error: Call to undefined function: tep_cfg_select_multioption() in /mnt/w0003/d43/s04/b0259707/www/store/nfoscomm/catalog/admin/modules.php(212) : eval()'d code on line 1.

 

I'm not sure what this means and don't know how to fix it. I had deleted the original usps.php before replacing with the Nov 19 version. I'd really appreciate some help--I'm a novice and don't know enough to proceed. Can anyone help? Thanks so much...

Share this post


Link to post
Share on other sites
I followed instructions for installing the 2.9.2 fix, as other have suggested in this thread, ran update.sql, and got this error upon trying to 'edit' the USPS module from within the admin section: Fatal error: Call to undefined function: tep_cfg_select_multioption() in /mnt/w0003/d43/s04/b0259707/www/store/nfoscomm/catalog/admin/modules.php(212) : eval()'d code on line 1.

 

I'm not sure what this means and don't know how to fix it. I had deleted the original usps.php before replacing with the Nov 19 version. I'd really appreciate some help--I'm a novice and don't know enough to proceed. Can anyone help? Thanks so much...

It sounds like you may be missing this:

// USPS Methods 2.5
// Alias function for Store configuration values in the Administration Tool
 function tep_cfg_select_multioption($select_array, $key_value, $key = '') {
   for ($i=0; $i<sizeof($select_array); $i++) {
     $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
     $string .= '<br><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"';
     $key_values = explode( ", ", $key_value);
     if ( in_array($select_array[$i], $key_values) ) $string .= ' CHECKED';
     $string .= '> ' . $select_array[$i];
   } 
   $string .= '<input type="hidden" name="' . $name . '" value="--none--">';
   return $string;
 }
////
// Retreive server information

from admin/includes/function/general.php (mine is on line 801) I recommend you check your general.php file and make sure this function is in there. If you're not sure where to put it, look up the directions in zip and it should tell you where to put it. I hope this Helps.

Share this post


Link to post
Share on other sites

I've been working on this for two days, have followed all instructions to the letter, and still have similar problems. I installed USPS 2.9.2 and get the following issues:

- when I attempt to edit the USPS module in the admin panel I get "Parse error: syntax error, unexpected T_GLOBAL, expecting ')' in /home/skyspet3/public_html/catalog/admin/modules.php(341) : eval()'d code on line 1"

- the international shipping methods don't draw any boxes

- this results in an error saying "contact store owner" on checkout.

 

I'm rather at my wits end on this. I've backed up and restored twice, followed all the instructions twice...am I using the wrong USPS contrib? My previous one was 1.5 something, didn't have the options for international (need these), and had the error with parcel post being more than express.

 

Any help is appreciated, including offers of paid help at this point.

Share this post


Link to post
Share on other sites

whoever is having problems getting the international boxes to display in admin shipping modules:

 

this fix has already been mentioned!!!

 

to get the international boxes to display all you have to do is goto myphpadmin editor or whatever you use to edit your database and change the set function from (255) to text... OR

 

you can also goto the value of the set function for internation shipping and just delete the last option and add the missing

 

),

 

 

at the end of it!!

 

 

so i just deleted the last one from mine, and it now looks like this

 

tep_cfg_select_multioption(array('GLOBAL EXPRESS', 'GLOBAL EXPRESS NON-DOC RECT', 'GLOBAL EXPRESS NON-DOC NON-RECT', 'EXPRESS MAIL INT', 'EXPRESS MAIL INT FLAT RATE ENV', 'PRIORITY MAIL INT', 'PRIORITY MAIL INT FLAT RATE ENV'),

 

the problem before was that the ), was missing becuase it was too long.

 

thats it!!

 

now it will display correctly.....

 

took me a while to figure it out also hahaha!!

 

:)

 

 

but its working now.

 

:)

Edited by drex

Share this post


Link to post
Share on other sites
I am having the same issue and client lost tons fo sales because of it....

 

it was working fine before this. site has been up a bit then suddenly it is defaulting and called postal service and they say it isnt their issue... thinks something stinks

 

Something does stink. On 18 Nov. USPS changed their API to caps, thereby throughting all of us little business' out the windowI have seen their old API put up on a screen next to the new one. There is a lot of difference between the two. I have had a web consultant and designer work on it for two days and he then had to put it back to the backup, still broke. I have disabled my USPS shipping modual and have gone to flat rate, per item, and pick-up. Maybe not the best but I have to do business and it was my only other option. The USPS changed it on us and os commerce can't or won't tell us how to fix it. Bill

Share this post


Link to post
Share on other sites
whoever is having problems getting the international boxes to display in admin shipping modules:

 

this fix has already been mentioned!!!

 

to get the international boxes to display all you have to do is goto myphpadmin editor or whatever you use to edit your database and change the set function from (255) to text... OR

 

you can also goto the value of the set function for internation shipping and just delete the last option and add the missing

 

),

at the end of it!!

so i just deleted the last one from mine, and it now looks like this

 

tep_cfg_select_multioption(array('GLOBAL EXPRESS', 'GLOBAL EXPRESS NON-DOC RECT', 'GLOBAL EXPRESS NON-DOC NON-RECT', 'EXPRESS MAIL INT', 'EXPRESS MAIL INT FLAT RATE ENV', 'PRIORITY MAIL INT', 'PRIORITY MAIL INT FLAT RATE ENV'),

 

the problem before was that the ), was missing becuase it was too long.

 

thats it!!

 

now it will display correctly.....

 

took me a while to figure it out also hahaha!!

 

:)

but its working now.

 

:)

This worked. I changed the set_function field to text and ran the SQL again and everything works perfectly now.

Thank you very much!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×