Jump to content
bad_lemming

[Contribution] - USPS Methods

Recommended Posts

ot_shipping should be (without the line numbers of course):

 

27        $this->output[] = array('title' => str_replace($search, $replace, $order->info['shipping_method']) . ':',
28                                'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
29                                'value' => $order->info['shipping_cost']);
30      }

 

The other error is because you are missing the code that is supposed to be added to ADMIN/INCLUDES/FUNCTIONS/GENERAL.PHP

 

Add the code and double check to make sure that you didn't add it to CATALOG/INCLUDES/FUNCTIONS/GENERAL.PHP. If so, just remove it.

Share this post


Link to post
Share on other sites

Thank you very much!! I backed the two files "general.php" to prior to modifications and re-entered the changes in the instructions and it now works properly.

Edited by jayandjay91

Share this post


Link to post
Share on other sites

I had same problem USPS not working after 10pm. Try this...

in the install instruction of USPS step 8

-------------------------------------------------------------------------------------------------------------------

8. Set your time zone if it is not already set within your php.ini file (on your server) or within your script.

This will keep the script from sending your server time zone if the server is on a different zone than your store.

 

catalog/includes/application_top.php

 

Find on line 13:

// start the timer for the page parse time log

define('PAGE_PARSE_START_TIME', microtime());

 

Add Before -

For city list see http://www.php.net/manual/en/timezones.america.php. You must replace "YOURNEARESTCITY" with the one closest to you:

 

// set default store time zone

ini_set('date.timezone', 'America/YOURNEARESTCITY');

 

If your site does not calculate at night, then your time is still not set correctly. Instead of using the ini_set function, try the following:

date_default_timezone_set('America/YOURNEARESTCITY');

---------------------------------------------------------------------------------------------------------

 

read the last 2 lines, What I did was use

 

date_default_timezone_set('America/America/Los_Angeles');

 

instead. It fixed my time zone problem. I am in San Jose CA. I choose Los_Angeles as my time zone.

Edited by dave408

Share this post


Link to post
Share on other sites

I suppose the USPS will determine this. They make changes to their API and sometimes they change the server that they use for the communications. RateV4 simply means that you are sending your request to the server that communicates this particular API (Version 4). If they update their API to a fifth version and put that on a new server, then we'll have to update yet again to a Rate V5 - or whatever they choose to use.

 

Short answer - there is no end life as of now, but at some point in the future, it is likely that Rate V4 will be abolished just as past versions have been.

Share this post


Link to post
Share on other sites

I have a question for anyone who might know. I have a store running osCommerce Online Merchant v2.2 RC2a and using USPS Methods version 3.0, which is not calculating for international shipping and gives all kinds of funny characters for domestic shipping. I can see there have been a lot of upgraded packages for this contribution. Which one should I use?


☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆

Share this post


Link to post
Share on other sites

Well for anyone else wondering, I installed version 5.2.2 and it works great! Thanks for the contribution : )


☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆

Share this post


Link to post
Share on other sites

Hi, I'm wondering if there is a way to set a threshold for USPS First Class International? We want to only offer it on items that are 1 pound or less, and only for orders under $50 total.

Share this post


Link to post
Share on other sites

Hello there!

 

Thanks for the great contrib. I've having a few errors that I can't seem to pan out. See below:

 

Error: Undefined variable: handling_cost
File: includes/modules/shipping/usps.php
Line: 371

Error: Undefined index: methods
File: includes/classes/shipping.php
Line: 98

Error: Undefined index: module
File: checkout_shipping.php
Line: 211

 

I'm running OSC 2.3.1. For the first error I look here:

 

'cost' => ($cost + $handling_cost[0]) * $shipping_num_boxes);

 

I've verified the handling costs in the database and they are all currently set to 0.00. So I'm not quite sure why it's throwing the error.

 

Any help would be appreciated!

 

Peace,

Chris

Share this post


Link to post
Share on other sites

Hey!

Ive had USPS Methods up and running for a while now and tonight Im getting errors in the shipping module. The delivery method names have disappeared and the are some strange characters. I removed and reinstalled the module and re-entered my setting but with no luck.

 

Anyone else having problems with their shipping module?

 

Kurt

Share this post


Link to post
Share on other sites

Is nobody having problems with their shipping module? My shipping module has not been working for over a week. If you use USPS Methods and it is working...or not, can you please reply to this thread.

 

Kurt

Share this post


Link to post
Share on other sites

Hey Kurt,

 

Without any version info, not sure. I do recall seeing another poster describing the strange characters in their responses. I don't recall who the poster was, but if you search the forum for just USPS Methods, you'll find him among the first 2 pages.

 

As a side note, if you're using an older API, USPS is about to stop supporting you in the first quarter of next year anyway. Might be an opportune moment to go ahead and upgrade. USPS has announced they will end support for RATE and RATEV2 APIs March 31st.

Share this post


Link to post
Share on other sites

I had a problem with this contrib not posting to the order total. Rates returned fine, but on the confirmation page and the final order, no shipping was included.

 

For anyone else experiencing a similar issue, the problem turned out to be the '<' and '>' characters in the USPS return and the formatted display name. (Basically the <sup>, </sup> and <br>). It may be that it was running afoul of one of our security scrubbers. Not sure there.

 

As a solution, any place I found:

 

'title' => $title, (there are 4 in all)

 

I switched it to:

 

'title' => str_replace(array('<sup>', '</sup>', '®', '™', '<br>'), '', htmlspecialchars_decode($title)),

 

 

That solution actually removes the reg mark which some may object to. To leave it, I suspect you'd use:

 

'title' => str_replace(array('<sup>', '</sup>', '<br>'), '', htmlspecialchars_decode($title)),

 

I haven't actually tried that.

 

Removing the <br>, when you're using some of the optional displays such as signature conf or insurance, could prove to be very odd looking when displayed. Again, I din't want all that so it wasn't an issue. Hope that helps someone else out.

 

Art

Share this post


Link to post
Share on other sites

For those that are using Amazon checkout you are about to get a rude error.

I've been in contact with amazon checkout support and there is no fix as of this writing. So far no other checkout service has been affected by the change, so please keep this in mind.

 

I've upgraded from 5.2 to 6.1. 5.2-6.1 will generate the error at amazon checkout. It seems Amazon api is still operating under the old rate card and limited data.

 

The problem is amazon shipping method only accepts 100 characters.

The error you will receive is as follows:

 

The order is not valid. Detail: Invalid Cart XML: The content of field DisplayableShippingLabel is longer than maximum allowed. For this field, the maximum allowed length is 100.

 

DisplayableShippingLabel is only in their API, it is not in OSC. So here is where we need to limit.

 

What is displayed by OSC usps method 6.1 is:

First-Class Mail® Package

---Delivery Confirmation

---Approximate delivery time from mailing date 1 day $6.30

 

What Amazon sees is this:

<DisplayableShippingLabel>United States Postal Service&nbsp;<br>0 lbs, 11.36 oz (First-Class Mail Package (---Approx. delivery time 2 Days))</DisplayableShippingLabel>

 

 

As you can see this exceeds the 100 character limit and gives no real information.

 

Amazon suggested I limit the data which can be done. I've posted a few ideas on their official support thread.. The problem is what do we limit it to? The first 100 characters? Could write a perl script to disassemble and reassemble the data on the fly. Does it matter which characters to us as long as we are providing the actual total to process? My other thought is maybe sanitize the xml code for amazon checkout only.

Or amazon could fix their problem... Not likely to happen anytime soon.

Share this post


Link to post
Share on other sites

Been working on upgrading this for a few days, always get the same result when I try to install the usps module:

 

1170 - BLOB column 'set_function' used in key specification without a key length

 

ALTER TABLE `configuration` CHANGE `configuration_value` `configuration_value` TEXT NOT NULL, CHANGE `set_function` `set_function` TEXT NULL DEFAULT NULL

 

[TEP STOP]

OSC 2.2 trying to install usps 5.2.2.

If you are getting a "parse error" when you click edit in the admin OR

your international options with checkboxes are not showing up in the admin,

you may need to use phpMyAdmin to update the database -> configuration TABLE

and CHANGE "set_function" to TEXT from VARCHAR.

Can't do this either... I get the same 1170 error in myphp...

 

HELP!

Share this post


Link to post
Share on other sites

This is what the database table looks like:

CREATE TABLE `configuration` (
 `configuration_id` int(11) NOT NULL auto_increment,
 `configuration_title` varchar(64) NOT NULL default '',
 `configuration_key` varchar(64) NOT NULL default '',
 `configuration_value` varchar(255) NOT NULL default '',
 `configuration_description` varchar(255) NOT NULL default '',
 `configuration_group_id` int(11) NOT NULL default '0',
 `sort_order` int(5) default NULL,
 `last_modified` datetime default NULL,
 `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
 `use_function` varchar(255) default NULL,
 `set_function` varchar(255) default NULL,
 PRIMARY KEY  (`configuration_id`),
 KEY `set_function` (`set_function`)
) TYPE=MyISAM AUTO_INCREMENT=3588 ;

Should there be a KEY for 'set_function'?

Share this post


Link to post
Share on other sites

This is what the database table looks like:

CREATE TABLE `configuration` (
 `configuration_id` int(11) NOT NULL auto_increment,
 `configuration_title` varchar(64) NOT NULL default '',
 `configuration_key` varchar(64) NOT NULL default '',
 `configuration_value` varchar(255) NOT NULL default '',
 `configuration_description` varchar(255) NOT NULL default '',
 `configuration_group_id` int(11) NOT NULL default '0',
 `sort_order` int(5) default NULL,
 `last_modified` datetime default NULL,
 `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
 `use_function` varchar(255) default NULL,
 `set_function` varchar(255) default NULL,
 PRIMARY KEY  (`configuration_id`),
 KEY `set_function` (`set_function`)
) TYPE=MyISAM AUTO_INCREMENT=3588 ;

Should there be a KEY for 'set_function'?

 

Although i have not seen your previous post, if you are upgrading, the first question is did you remove the old version before upgrading replace files and pushing the install key? Meaning uninstall from the admin windows/modules/shipping/usps edit remove. add new files/edit files and then run install.

 

Since you are failing in PHP admin, it is more than likely you have the key already and when asked to update, it fails since the key/field already exists elsewhere. In OSC, disable/remove the module. In phpmyadmin search for each function in and more than likely you'll find a duplicate.in your database. Verify and delete duplicate or comment out in the install. Which is an easy work around but may cause you trouble later for upgrading and uninstall.

Share this post


Link to post
Share on other sites

I installed USPS 6.1 to a fresh version of OSC2.3.1 but when I go to checkout NOTHING shows for shipping. Any thoughts? Thank you in advance!

 

Nevermind Got it!

Edited by mvanderhoff

Share this post


Link to post
Share on other sites

Okay so it is now working BUT when I add two small items totally (0.02lbs) USPS wants it to ship USPS Large Priority Flat Rate Box but the items are tiny. Why did it choose this? Do I need to install Dimensional Support?

Share this post


Link to post
Share on other sites

Is there a way to make insurance an optional choice of the customer? I cannot seem to get it to work and can't find it in this thread.

 

Thanks!

Share this post


Link to post
Share on other sites

Hello,

 

I am using version 5.2.1 in OSC2.31. I have an issue with it not returning correct rate for Priority Mail for international. My site is returning $90.00, but when I look up the rate on USPS.com, it shows $40.00? Any ideas?

 

Also, I tried to down load version 6.1, maybe issue solved in it, but it looks like it was zipped on a Mac, and files are empty. Has anyone else had that download issue?

 

Thanks JR

Share this post


Link to post
Share on other sites

Okay so it is now working BUT when I add two small items totally (0.02lbs) USPS wants it to ship USPS Large Priority Flat Rate Box but the items are tiny. Why did it choose this? Do I need to install Dimensional Support?

 

I was having similar problems. Be sure to define the flat rate box dimensions accurately in USPS Methods Admin. Small FR Box is 8.625 x 5.375 x 1.625. Medium FR Box is 11 x 8.5 x 8.5, and Large FR Box is 12 x 12 x 8.5. Without the proper dimensions these will not show as options. I made shipments less than 5 lbs. the Small FR Box dimensions, 5-10 Medium, and Large above that.

Share this post


Link to post
Share on other sites

WARNING!

Received today in my e-mail:

 

 

Web Tools integrator;

 

On January 22, 2012, USPS will update domestic shipping services and international pricing and product features. For detailed information on prices and new product features, please reference the Federal Register Notices viewable at http://pe.usps.com/.

 

Price Change updates will be available in the Web Tools testing environment for integrator access on or around January 6, 2012. The test environment can be accessed, using your production UserID, via the following URL scheme, host and path:

Secure APIs: https://stg-secure.shippingapis.com/ShippingApi.dll

Non-secure APIs: http://stg-production.shippingapis.com/ShippingApi.dll

 

Please note that the changes below are intended to be backwards compatible, however, may not be depending on how individual programs are integrated with the APIs.

 

Web Tools APIs will be affected in the following manner:

· All Web Tools APIs with postage prices incorporated will be updated to reflect the price changes;

· Domestic Rate Calculator API Changes:

  • New <Container> request enumerations added to RateV4 to support the USPS product offerings and prices listed in the Federal Register Notice:

* FLAT RATE BOX (Express Mail Flat Rate Box),
* REGIONALRATEBOXC (Priority Mail Regional Rate Box C);
  • New <FirstClassMailType> request enumeration added to RateV4:

* PACKAGE SERVICE;
  • Optional <ReturnServiceInfo> tag added to RateV4 to return “Loss Guarantee Only” commitment information when an Express Mail Commitment is requested to certain destinations
  • First-Class Mail Package <MailService> response values updated in RateV3 and RateV4 as follows:

* Postage CLASSID="0" - Retail Pricing
<MailService>First-Class Mail® Package</MailService> will become:
<MailService>First-Class Mail® Parcel</MailService>,
* Postage CLASSID="61" - Commercial Pricing
<MailService>First-Class Mail® Package</MailService> will become:
<MailService>First-Class Mail® Package Service</MailService>;
  • New response nodes in RateV3 and RateV4 to support the USPS product offerings and prices listed in the Federal Register Notice (Express Mail Flat Rate Box and Priority Mail Regional Rate Box C, specifically);
  • Rate and RateV2 responses will be modified to:

* Return trademarked product names,
* Enforce dimensional requirements through error messaging for large, oversize and
S- restricted
destinations.

 

· All Rate Calculator API integrators are encouraged to migrate to the latest API versions (RateV4, IntlRateV2):

  • Rate and RateV2 versions of the domestic Rate Calculator will be retired on March 31, 2012, requiring all integrators to migrate to the latest versions;

 

· International Rate Calculator API:

  • New response nodes in IntlRate and IntlRateV2 to support the USPS product offerings and prices listed in the Federal Register Notice (Express Mail Flat Rate Box, specifically);

 

· Express Mail Label and Hold For Pickup Express APIs:

  • New <Container> request data tags to support the Express Mail Flat Rate Box;

* FLAT RATE BOX

 

· Delivery Confirmation and Signature Confirmation APIs:

  • New <Container> request data tags to support the Priority Mail Regional Rate Box C;

* REGIONALRATEBOXC

 

· Express Mail International API:

  • New <Container> request data tags to support the Express Mail Flat Rate Box:

* FLATRATEBOX.

 

 

Please contact the USPS Internet Customer Care Center with any questions or concerns at 1-800-344-7779 or uspstechsupport@esecurecare.net.

 

- Web Tools Program Office

 

Have any of you experts looked at this? Think it will break things?

 

 

EDIT: Tried to clean up the formatting; their bullet list didn't copy-paste well ...

Edited by TomB01

Share this post


Link to post
Share on other sites

WARNING!

Received today in my e-mail:

 

 

 

Have any of you experts looked at this? Think it will break things?

 

 

EDIT: Tried to clean up the formatting; their bullet list didn't copy-paste well ...

Has anyone been able to sandbox this update? I have tried but failed to see the outcome in PayPal's shipping offering which was nil in their sandbox. Maybe I was doing something wrong? Edited by videod

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

×