Jump to content
fulluvscents

USPS Rate V4, Intl Rate V2 (official support thread)

Recommended Posts

Hi,

As per ealier instructions I have come up with the following junk code which does not work... Anyone see any problems? Am I overlooking something?

foreach(explode(', ', MODULE_SHIPPING_USPS_TYPES) as $request_type)
   {
   if(is_numeric($request_type) || preg_match('#International#' , $request_type)) continue;
   $FirstClassMailType = '';
   $Container = 'VARIABLE';
   if (preg_match('#First\-Class#', $request_type))
 {
 if ($shipping_weight > 13/16) continue;
 else
  {
  $service = 'First-Class Mail';
  if ($request_type == 'First-Class MailRM Large Envelope') $FirstClassMailType = 'FLAT';
  else $FirstClassMailType = 'PARCEL';
  }
 }
   elseif ($request_type == 'Media MailRM') $service = 'MEDIA';
   // Changed from Parcel PostRM 20130129
   elseif ($request_type == 'Standard PostRM') $service = 'PARCEL';
   elseif (preg_match('#Priority MailTM#', $request_type))
 {
 $service = 'PRIORITY COMMERCIAL';
 if ($request_type == 'Priority MailTM Flat Rate Envelope') $Container = 'FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority MailTM Legal Flat Rate Envelope') $Container = 'LEGAL FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority MailTM Padded Flat Rate Envelope') $Container = 'PADDED FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority MailTM Small Flat Rate Box') $Container = 'SM FLAT RATE BOX';
 elseif ($request_type == 'Priority MailTM Medium Flat Rate Box') $Container = 'MD FLAT RATE BOX';
 elseif ($request_type == 'Priority MailTM Large Flat Rate Box') $Container = 'LG FLAT RATE BOX';
 elseif ($request_type == 'Priority MailTM Regional Rate Box A') $Container = 'REGIONALRATEBOXA';
 elseif ($request_type == 'Priority MailTM Regional Rate Box B') $Container = 'REGIONALRATEBOXB';
 elseif ($request_type == 'Priority MailTM Regional Rate Box C') $Container = 'REGIONALRATEBOXC';
 }
   elseif (preg_match('#Priority Mail ExpressTM#', $request_type))
 {
 $service = 'EXPRESS COMMERCIAL';
 if ($request_type == 'Priority Mail ExpressTM Flat Rate Envelope') $Container = 'FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority Mail ExpressTM Legal Flat Rate Envelope') $Container = 'LEGAL FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority Mail ExpressTM Flat Rate Boxes') $Container = 'FLAT RATE BOX';
 }

Share this post


Link to post
Share on other sites

I have such a headache now, I am running osCmax v2.0.35 (which lines up pretty much with osC v2.2) I HAD been running an older version of USPS Methods v5.2x but decided I would upgrade to the more versatile USPS Methods v6.1x. Some of what the install notes said to do was already in place, some of it had to be added.. the hardest MOD I have done to date..

 

So now USPS comes up in the list of shipping options but I'm getting:

United States Postal Service (1 pkg, 0.91 lbs total) United States Postal Service

An error occured with the USPS shipping calculations.

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

 

I'm tossed on where the problem might be. I need to turn on some kind of diagnostics here I think..

 

According to my notes, I MIGHT have to add back all those routines by Greg Deeth to

admin/includes/functions/general.php

includes/functions/general.php

(have done so now and it changed nothing)

 

Another note I have is a discrepancy between the USPS v6.1x and my oscMax version of includes\classes\packing.php

oscMax version shows (LN104-112:

            if (tep_not_null($non_ready_to_shipArray)) {
               // adapted code from includes/classes/shipping.php
               $shipping_non_ready_to_ship_boxes = 1;
               $shipping_non_ready_to_ship_weight = $total_non_ready_to_ship_weight; //DIFFERENT
               if (SHIPPING_BOX_WEIGHT >= $total_non_ready_to_ship_weight*SHIPPING_BOX_PADDING/100) {
                 $total_non_ready_to_ship_weight = $total_non_ready_to_ship_weight+SHIPPING_BOX_WEIGHT;
               } else {
                 $total_non_ready_to_ship_weight += $total_non_ready_to_ship_weight*SHIPPING_BOX_PADDING/100; //DIFFERENT
               }

 

while the USPS Methods install notes shows (same line numbers):

            if (tep_not_null($non_ready_to_shipArray)) {
               // adapted code from includes/classes/shipping.php
               $shipping_non_ready_to_ship_boxes = 1;
               if (SHIPPING_BOX_WEIGHT >= $total_non_ready_to_ship_weight*SHIPPING_BOX_PADDING/100) {
                 $total_non_ready_to_ship_weight = $total_non_ready_to_ship_weight+SHIPPING_BOX_WEIGHT;
               } else {
                 $total_non_ready_to_ship_weight += ($total_non_ready_to_ship_weight*SHIPPING_BOX_PADDING/100); //DIFFERENT
               }
               $shipping_non_ready_to_ship_weight = $total_non_ready_to_ship_weight; //DIFFERENT

 

 

 

The other problem is when I click EDIT, it is not holding the service choices - nothing is ticked ON

 

Have now (with the DEETH routines back in) uninstalled and reinstalled, now I get this:

United States Postal Service (1 pkg, 0.91 lbs total) United States Postal Service

-2147219487 Machinable value must be 'True' or 'False' for service type Standard Post and service type All.

 

Still on initial install ALL services ticked, when you go back in for an edit, NO SERVICES are ticked

 

 

Edited by wkdwich

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites

@@WIljen We are experiencing the same issue. For those that ship heavily with USPS should be jumping up here today. Some may not know there is an issue? FedEx and UPS is working just fine, but my customers rarely use them.

Share this post


Link to post
Share on other sites

Im having some difficulty getting this add on to work properly. Upon reading this forum Im reading about some STEP BY STEP INSTRUCTIONS that are supposedly included in a read me file with the add on... my add on only included simple instructions of the following line: "Please use a file compare tool to make the necessary changes to the included files.

Perform the small sql query."

 

what am I missing? There are 3 php files included with my add on along with a sql.txt file.

 

After going threw this thread I have updated my admin/includes/fuinctions/general.php and got the add on to work in the admin panel but it does not ask for a USPS password (is this normal) and NO USPS shipping option shows up on the checkout screen. At this point I am pretty frustrated since I cannot find the STEP BY STEP instructions everyone is speaking about.

 

Why is NO USPS option showing up on the checkout page?

Share this post


Link to post
Share on other sites

Kudos to @@FlyingKites for providing a working usps.php file. I've fixed the file so that custom handling for USPS domestic services properly adds. After some testing, I'll attach the file in a new thread (or on the old USPS Methods thread). I've tried fixing this USPS Rate V4, Intl Rate V2 contribution to no avail.

Share this post


Link to post
Share on other sites

Upon reading this forum Im reading about some STEP BY STEP INSTRUCTIONS that are supposedly included in a read me file with the add on...

I'm running an older version of osc, and also need step by step instructions, since I can't just add the new module to my existing installation.

 

At the moment, I am getting an error for International shipments, and my domestic shipment selection isn't getting stored in a session variable, so the confirmation page always defaults to the cheapest shipping option. I'm working only with First Class Mail, Media Mail, and Priority Mail at the moment. For international, I'm using the First-Class Mail Int Package option only, for testing purposes.

Share this post


Link to post
Share on other sites

I've tried deleting the old usps.php and trying to install the new one but it doesn't show up in my list of modules I'm able to install. I'm trying to use this with MVS (which shouldn't have that many problems, right?) I've attached what I currently have. Help would be greatly appreciated.

Share this post


Link to post
Share on other sites

I'm running an older version of osc, and also need step by step instructions, since I can't just add the new module to my existing installation.

 

At the moment, I am getting an error for International shipments, and my domestic shipment selection isn't getting stored in a session variable, so the confirmation page always defaults to the cheapest shipping option. I'm working only with First Class Mail, Media Mail, and Priority Mail at the moment. For international, I'm using the First-Class Mail Int Package option only, for testing purposes.

 

1. What version of OSC are you using?


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

@@starfox221

You need a MVS module, and there's currently none available. I'm working on one right now, so (unless someone beats me to it) you'll have to wait until I have it working.

 

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

@@starfox221

You need a MVS module, and there's currently none available. I'm working on one right now, so (unless someone beats me to it) you'll have to wait until I have it working.

 

Regards

Jim

 

Bless you! :D

Share this post


Link to post
Share on other sites

Kudos to FlyingKites for providing a working usps.php file. I've fixed the file so that custom handling for USPS domestic services properly adds. After some testing, I'll attach the file in a new thread (or on the old USPS Methods thread). I've tried fixing this USPS Rate V4, Intl Rate V2 contribution to no avail.

 

@@a.forever Are you jimping ship on USPS Rate V4, Intl Rate V2 / Restricted Methods?

Edited by negativeexistence

Share this post


Link to post
Share on other sites

Does anyone have just the lines of code and the list of the API names to change? A listing of what we need to find in the code and change? I'm using the USPS Rate V4, Intl Rate V2 on an OSC 2.3.3 cart. I have not seen any posts that relate to exactly what to change on this file.

 

It used to be just a simple "change Standard to Priority" et al, but this doesn't seem to be happening this time.

 

We've not been able to take orders for 36 hours and if I can't get this working, then I'll just have them switch over to flat rate.


Jennifer

Share this post


Link to post
Share on other sites

It's not all that easy. This one is nasty. Yes, there are some obvious changes (Express Mail => Priority Mail Express for example). Then there are a bunch of hidden changes: HTML entities changed to their numeric codes, adding the delivery time in the middle of the class names, and probably some more that I've missed.

 

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

@@a.forever Are you jimping ship on USPS Rate V4, Intl Rate V2 / Restricted Methods?

 

The overall goal for any fully functional shop is to have a working USPS module ASAP, with as many working features as possible.

 

As @@kymation mentioned, this update is dreadfully nasty with a ton of hidden changes, making a re-code of USPS Rate V4, Intl Rate V2 particularly difficult. It was much easier to retrofit the older 5.x version using the changes @FlyingKites made, and tweak it further to provide similar features that USPS Rate V4, Intl Rate V2 has. It'll be clunky, but working. Add-ons are only good and useful if people work to maintain and update them.

usps_beta.php

Share this post


Link to post
Share on other sites

FROM POST #541: If you absolutely cannot wait and need a working USPS module now, this post has a beta version of the file I'm working on. It's basically a tweak to the mod @@FlyingKites posted in Post #510. Except domestic handling works now, and First-Class is split into Letter, Large Envelope, and Parcel.

 

USE AT YOUR OWN RISK AND BACKUP ALL DATA IF YOU CHOOSE TO INVOKE THE FILE!

 

You will need to:

 

1) write down your current USPS settings

2) uninstall your current module

3) download this attachment

4) rename from usps_beta.php to usps.php

5) upload new file to catalog/includes/modules/shipping

6) re-install module (preferably in a new browser window or after a cleared cache)

7) reapply USPS settings

 

usps_beta.php

Edited by a.forever

Share this post


Link to post
Share on other sites

I'm using OSC 2.2 RC2a and USPS Methods 5.2.1

 

@a.forever thanks for your work. Here are some of the problems I have encountered:

 

The assignment field for domestic handling fees are inaccurate. For example - to add in handling fee for 1st Class Mail Parcel you need to put the amount in the First-Class Mail regimark Letter field; to add in handling fee for Priority Mail you need to put the amount in the First-Class Mail regimark Large Envelope field; to add in handling fee for Priority Mail Express you need to put the amount in the First-Class Mail regimark Parcel field.

 

Alan

Edited by spiritalan

Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

I installed the usps.php file posted by @@a.forever however, when I try to edit the module once I install it in my admin, I get the modules/shipping.php page, but the table with the USPS module extends out and I see the arrow to the edit fields on the right side of the web page, but no editing fields.

 

It's like the entire editing portion of the module is completely gone.

 

I'm running 2.3.3 and I think it is because of this, but I don't know what to do about it.

 

Help?

Edited by blackopstoys

Jennifer

Share this post


Link to post
Share on other sites

1. What version of OSC are you using?

I'm embarrassed to say, and not only that, my usps.php has been hacked with all the various updates I've had to deal with since 2001. I'm a one-man shop and have always been able to figure out how to modify usps.php before. But the July 28 changes have me stumped.

 

What I really need is urgent help in updating my existing file. I'm willing to pay for your time in analyzing my current development file, which attempts to incorporate the July 28 version changes, but is failing entirely for international shipping and is buggy for domestic shipping.

 

Another thing that would really help would be a heavily commented version of the July 28 usps.php that's been submitted, explaining where the changes are and what the new code (e.g., "regimark"?) is supposed to be doing. Re: "regimark" etc... As naming is so critical to data retrieval in this module, I'm confused about the chosen strategy and uncertain about how to implement it.

 

I know I'm asking a lot, but I'm desperate to get the shipping module on my 12-year-old instance of osCommerce working again. If you can help me out of the mess the latest V4 changes have left me in, send me a message or email me at llscotts@gmail.com and let me know how much it might cost.

 

FYI, the site in question is Classic 45s (http://www.classic45s.com)

Share this post


Link to post
Share on other sites

I'm using OSC 2.2 RC2a and USPS Methods 5.2.1

 

@a.forever thanks for your work. Here are some of the problems I have encountered:

 

The assignment field for domestic handling fees are inaccurate. For example - to add in handling fee for 1st Class Mail Parcel you need to put the amount in the First-Class Mail regimark Letter field; to add in handling fee for Priority Mail you need to put the amount in the First-Class Mail regimark Large Envelope field; to add in handling fee for Priority Mail Express you need to put the amount in the First-Class Mail regimark Parcel field.

 

Alan

Alan,

 

I noticed that 5 minutes after I uploaded the beta. That's why it's a beta. Again, use at your own risk.

 

It's been reworded and I'm just about to test it. The fields for handling correspond to the quantity of methods checkmarked. For example, if for Domestic Shipping Methods you checkmarked

 

Method 1 - First-Class Mail® Letter

Method 5 - Standard Post®

Method 7 - Priority Mail™ Flat Rate Envelope

 

Then for Domestic Flat Handling Fees, use only the first 3 lines (currently worded as First-Class regimark Letter, First-Class regimark Large Envelope, First-Class regimark Parcel).

Share this post


Link to post
Share on other sites

I followed the instructions and I get this error when I try to edit

Fatal error: Call to undefined function tep_cfg_multiinput_list() in /hsphere/local/home/shoppein/shoppeintheforest.com/admin/modules.php(217) : eval()'d code on line 1 $ShipmentRateDetail$ShipmentRateDetail

Share this post


Link to post
Share on other sites

I've been dealing with this all day long, with no success. I've basically gotten to the point that the rates are calculated correctly and display; however, the shipping methods do not display, just the $$ amounts in ascending order with radio buttons.

 

When you select one of them, nothing happens. No way to checkout, I can't figure out how to #1 - display the shipping method text, and #2 - checkout when the radio button is selected.

 

Big Prob. Any thoughts or ideas? I'm stumped and worn out looking at it. I do have the module installed, and it appears to be correct.

Edited by Dizzycajun

Share this post


Link to post
Share on other sites

@a.forever are you testing this on a OSC 2.3.3 store? I know people with this version store that the contribution has not been working.

By the way, I know I am using this at my own risk and I appreciate all you are doing.

Thanks, Alan :)

Edited by spiritalan

Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

I followed the instructions and I get this error when I try to edit

Fatal error: Call to undefined function tep_cfg_multiinput_list() in /hsphere/local/home/shoppein/shoppeintheforest.com/admin/modules.php(217) : eval()'d code on line 1 $ShipmentRateDetail$ShipmentRateDetail

 

Post #18 in this thread fixed that for me.

http://forums.oscommerce.com/topic/393466-heads-up-july-28-2013-usps-name-change-for-express-mail/

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

×