Jump to content
kymation

[Development] USPS Shipping Module

Recommended Posts

That old post is the only attempt that I know of, and I have no idea if it actually works in all cases. It appears to use the Dimensional Weight handler from the UPSXML module, and that has issues.

 

I might take a shot at this once the module is otherwise complete and working. We'll see.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I currently have osc 2.3.3.4 in production with UPSXML with dimensional support without any issues. This is the only shipping module that is accurate with regards to customer quotes on shipping especially for large packages.

Share this post


Link to post
Share on other sites

The difficulty is with the packing algorithm: it works well in some cases and fails miserably in others. You will have great results if all of your products ship individually, with less success if you have to pack multiple items per box.

 

Adding the existing Dimensional Weight module would not be very difficult. I'll take a look at that.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I completely understand on the multiple products in the cart and determining the correct size (volume), Utilizing the existing dimensional weight support module would be fine. Thanks!

Share this post


Link to post
Share on other sites

I've uploaded a new version to the addons area. No dimensional weight yet, but I did fix a few things. Domestic shipping should now be complete and return correct quotes.

 

Please test this if you can. I appreciate all comments. Bug reports welcome. Code even more welcome, especially CSS to fix that stupid Edit menu.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

It on my to do testing list. 


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Installed this on a bootstrap shop locally

 

No errors showing at the admin site, except...

 

Not getting any services showing to update....

 

Update Services
Check if you want to update the following services list.

 

shop side, USPS does not appear as as shipping choice.  I have flat rate also enabled.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Any error messages showing in the Admin panel? Did you get an error email?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

negative errors in admin panel..but looking around I found three email notifications.

 

The response from the USPS was empty. This could be a fault in the USPS server, or there is something very wrong with the request.

Request: API=RateV4&XML=%3CRateV4Request+USERID%3D%22914MYUSERID%22%3E%3CRevision%3E2%3C%2FRevision%3E%3C%2FRateV4Request%3E

Response:

-2147221202Common:XmlParseThe element 'RateV4Request' has incomplete content. List of possible elements expected: 'RateClientType, Package'.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I tested it on the 2.3.4 development area and almost everything worked for domestic address. The only exception was USPS First Class Package Service is shown $0.00 which is great for customers as its a free shipping surprise, but not for the seller... It appears only if the product weight is less than 1lb

Share this post


Link to post
Share on other sites

It's not sending a complete request. That's very odd. It doesn't do that on my test server, so I'm going to have to try to figure out how this could happen. Not fun.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@nepm  I believe that the maximum weight is 13 ounces for First Class Package Service. In any case it should not be free. ThioughI would not be surprised to find that the USPS is returning a zero cost for it. Another thing to test.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

In the admin console is shows: First-Class Mail Parcel versus First-Class Package Service showing in the customer side in shopping cart.

Share this post


Link to post
Share on other sites

That should not happen. It sounds like you have another USPS module installed, or you have some stale data. Edit the Admin settings and check the Update box, then save. Does that change?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

It's not sending a complete request. That's very odd. It doesn't do that on my test server, so I'm going to have to try to figure out how this could happen. Not fun.

 

Regards

Jim

 

My test shop is on uniserver.  I've not had any instances where the test shop failed to communicate with the outside world.  I suppose it's possible though.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I've added a new version with some additional error messages. This should make it a bit easier to tell where the error is happening. Please test and tell me what you get.

 

I've also added a test for services with a cost of zero. The service will not be shown to the customer, and an error message will be sent.

 

@@altoid  Your box is communicating with the USPS server, it's just not sending a complete request. Still trying to figure out how that can happen.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Jim, Where did you post that new version? 0.6 version has yesterday's date on the files. Are you storing them on your own server?

Share this post


Link to post
Share on other sites

The upload timed out. I got it to work after several tries. Please try again. If it doesn't work, try this one.

 

Regards

Jim

Edited by kymation

See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

The USPS First Class did not show and in the error log: Warning: curl_setopt_array(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in catalogdev/includes/modules/shipping/usps_codes.php on line 821, referer: catalogdev/account.php

[Mon Mar 23 20:03:17 2015] [error] [client 64.223.144.82] PHP Warning: constant(): Couldn't find constant MODULE_SHIPPING_USPS_CODES_DOMESTIC_SERVICES_61_HANDLING in catalogdev/includes/modules/shipping/usps_codes.php on line 523, referer: catalogdev/account.php

Share this post


Link to post
Share on other sites

Jim, 

 

The email received shows more detail below. The First-Class Package Service vs. First Class Mail Parcel the latter is correct according to USPS site running a manual quote there. In their Tag Name: RateV4Request / Package / Service with enumeration=FIRST CLASS vs. enumeration=FIRST CLASS COMMERCIAL as I choose retail vs onlne rates. The Tag Name: API RateV4Request / Package / FirstClassMailType  as enumeration=PARCEL vs. enumeration=PACKAGE SERVICE which appears to be option shown. I will check the code to see if those changes would resolve this $0.00 result.

 

Quote: A service has a quoted price of zero.

Service ID: 61
Service Name: First-Class™ Package Service
Service Price: 0
Request: API=RateV4&XML=2First Class CommercialPARCEL030310303105.28RegulartruePriority Commercial030310303105.28RegulartruePriority Commercial030310303105.28FLAT RATE ENVELOPERegulartruePriority Commercial030310303105.28SM FLAT RATE ENVELOPERegulartrueExpress Commercial030310303105.28Regulartrue
Response:
030310303105.28REGULAR1First-Class<sup>™</sup> Package Service0.002.250Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Insurancetruetrue2.102.10truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse15Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00030310303105.28VARIABLEREGULAR1Priority Mail 1-Day<sup>™</sup>5.755.0519Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.459Certificate of Mailing (Form 3817)truetrue1.301.30160Certificate of Mailing (Form 3877)truetrue0.470.470Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Ins
 urancetruetrue0.000.00truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse7Return Receipt for Merchandisetruetrue4.404.4015Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00030310303105.28FLAT RATE ENVELOPEREGULAR1Priority Mail 1-Day<sup>™</sup> Flat Rate Envelope5.755.0519Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.459Certificate of Mailing (Form 3817)truetrue1.301.30160Certificate of Mailing (Form 3877)truetrue0.470.470Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Insurancetruetrue0.000.00truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse7Return Receipt for Merchandisetruetr
 ue4.404.4015Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00030310303105.28SM FLAT RATE ENVELOPEREGULAR1Priority Mail 1-Day<sup>™</sup> Small Flat Rate Envelope5.755.0519Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.459Certificate of Mailing (Form 3817)truetrue1.301.30160Certificate of Mailing (Form 3877)truetrue0.470.470Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Insurancetruetrue0.000.00truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse7Return Receipt for Merchandisetruetrue4.404.4015Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>&#8
 482;</sup> Electronictruetrue0.000.00030310303105.28VARIABLEREGULAR1Priority Mail Express 1-Day<sup>™</sup>16.9513.0919Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70

Share this post


Link to post
Share on other sites

Hi Jim,

 

I changed Lines: 1629 - 1634

 
From:
 
case 'letter' :
              default;
              $FirstClassMailType = 'PARCEL';
              break;
            } //switch( $first_class_type
            break;
 
To:
 
case 'parcel' :
              default;
              $FirstClassMailType = 'PARCEL';
              break;
            } //switch( $first_class_type
            break; 
 
This was the result: Quote: A service has a quoted price of zero.

Service ID: 61
Service Name: First-Class™ Package Service
Service Price: 0
Request: API=RateV4&XML=2First Class CommercialPARCEL030310303105.28RegulartruePriority Commercial030310303105.28RegulartrueExpress Commercial030310303105.28Regulartrue
Response:
030310303105.28REGULAR1First-Class<sup>™</sup> Package Service0.002.250Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Insurancetruetrue2.102.10truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse15Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00030310303105.28VARIABLEREGULAR1Priority Mail 1-Day<sup>™</sup>5.755.0519Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.459Certificate of Mailing (Form 3817)truetrue1.301.30160Certificate of Mailing (Form 3877)truetrue0.470.470Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Ins
 urancetruetrue0.000.00truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse7Return Receipt for Merchandisetruetrue4.404.4015Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00030310303105.28VARIABLEREGULAR1Priority Mail Express 1-Day<sup>™</sup>16.9513.0919Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70

Share this post


Link to post
Share on other sites

OK....got the list of shipping options now.

 

Ran a test purchase,  looking for first class mail parcel (which is what I use mostly).  It didn't show up.

 

Here's the email error notice:

 

 

Quote: A service has a quoted price of zero.

Service ID: 61
Service Name: First-Class™ Package Service Service Price: 0
Request: API=RateV4&XML=2First Class CommercialPARCEL166021664807.04RegulartruePriority Commercial166021664807.04FLAT RATE ENVELOPERegulartrueExpress Commercial166021664807.04FLAT RATE BOXRegulartrueExpress Commercial166021664807.04FLAT RATE ENVELOPERegulartrueExpress Commercial166021664807.04FLAT RATE ENVELOPERegulartrueExpress Commercial166021664807.04RegulartrueExpress Commercial166021664807.04LEGAL FLAT RATE ENVELOPERegulartrueExpress Commercial166021664807.04LEGAL FLAT RATE ENVELOPERegulartrueExpress Commercial166021664807.04PADDED FLAT RATE ENVELOPERegulartrueExpress Commercial166021664807.04PADDED FLAT RATE ENVELOPERegulartrue
Response: 
166021664807.04REGULAR1First-Class<sup>™</sup> Package Service0.002.590Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Insurancetruetrue2.102.10truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse15Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00166021664807.04FLAT RATE ENVELOPEREGULAR1Priority Mail 2-Day<sup>™</sup> Flat Rate Envelope5.755.0519Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.459Certificate of Mailing (Form 3817)truetrue1.301.30160Certificate of Mailing (Form 3877)truetrue0.470.470Certified Mail<sup>®</sup>truetrue3.303.306Collect on Deliverytruetrue6.956.95truefalse1Insurancetruetrue0.000.00truefalse5Registered Mail<sup>™</sup>truetrue11.9511.95truefalse7Return Receipt for Merchandisetruetrue4.404.4015Signature Confirmation<sup>™</sup> Electronictruetrue2.352.3513USPS Tracking<sup>™</sup> Electronictruetrue0.000.00166021664807.04FLAT RATE BOXREGULAR1Priority Mail Express 1-Day<sup>™</sup> Flat Rate Boxes44.9544.9519Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04FLAT RATE ENVELOPEREGULAR1Priority Mail Express 1-Day<sup>™</sup> Flat Rate Envelope19.9918.1119Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04FLAT RATE ENVELOPEREGULAR1Priority Mail Express 1-Day<sup>™</sup> Flat Rate Envelope19.9918.1119Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04VARIABLEREGULAR1Priority Mail Express 1-Day<sup>™</sup>16.9513.0919Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04LEGAL FLAT RATE ENVELOPEREGULAR1Priority Mail Express 1-Day<sup>™</sup> Legal Flat Rate Envelope19.9918.1119Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04LEGAL FLAT RATE ENVELOPEREGULAR1Priority Mail Express 1-Day<sup>™</sup> Legal Flat Rate Envelope19.9918.1119Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04PADDED FLAT RATE ENVELOPEREGULAR1Priority Mail Express 1-Day<sup>™</sup> Padded Flat Rate Envelope19.9918.1119Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70166021664807.04PADDED FLAT RATE ENVELOPEREGULAR1Priority Mail Express 1-Day<sup>™</sup> Padded Flat Rate Envelope19.9918.1119Adult Signature Requiredtruetrue5.205.2020Adult Signature Restricted Deliverytruetrue5.455.456Collect on Deliverytruetrue6.956.95truefalse11Priority Mail Express Insurancetruetrue1.001.00truefalse8Return Receipttruetrue2.702.70
 

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I think I've figured out the problem here. The USPS has added a bunch of new services. Normally this would not be a problem; the code discovers them and adds them to the database. However, one of these new services is First Class, and that requires special additional parameters. Without those, the request returns a cost of zero. Nice.

 

You think the USPS has ever heard of error handling? No?

 

Anyway, this one seems to work. I'm not sure about the First Class parcel though, so please test that if you can.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I see

First-Class Mail® Parcel

Library Mail Parcel
Media Mail Parcel
 
For a 7.4 oz package, the parcel does not show during a test purchase.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

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

×