Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Guest

Recommended Posts

Problem was between the seat and the keyboard.

function cheapest() {
        global $is_cont48, $shipping_weight...

I never added the bold.  Now it works.  Just have to figure out what to use for the cart value.

I thought maybe:

(($is_cont48 != 1) && ($shipping_weight < 0.8125) && ($subtotal < 400.00))

but that's not worked so far.

Link to comment
Share on other sites

Yep, tried that.  I don't think $subtotal exists at this point, and I didn't want to chance screwing something up down the line that might use it so I added this to shopping_cart.php:

    $pkg_val = $cart->show_total();
  tep_session_register ('pkg_val');

and then used $pkg_val in place of $subtotal in the shipping class.

Now it works.

Thanks Jim :)

Link to comment
Share on other sites

A quick question:

Rather than uninstalling/reinstalling and having to update settings again, why is it not possible to just update the database field?

Example:

UPDATE `configuration` SET `configuration_value` ='
0, 70, 0.00, 0, 70, 0.00, First-Class Package Service - RetailTM,
0, 70, 0.50, 0, 70, 0.00, 0, 70, 0.00, USPS Retail GroundTM,
0, 70, 0.50, Priority MailTM,
0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, Priority Mail ExpressTM,
0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, First-Class Package International ServiceTM,
0, 70, 1.50, Priority Mail InternationalRM,
0, 70, 1.50, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, Priority Mail Express InternationalTM,
0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00'
WHERE `configuration`.`configuration_key` = `MODULE_SHIPPING_USPS_TYPES`;

(I've split the line for readability)

I tried but it didn't appear to work, unless some caching was going on.

 

Link to comment
Share on other sites

I've made the following revision:

Quote
You need to update line 522  with the following: 
Change from:
        \'First-Class MailRM Parcel\',  
Replace with:
        \'First-Class Package Service - RetailTM\', 

Uninstalled/reinstalled then added all the required information back in. Still no USPS shipping showing.

I did notice in Admin that it is displayed as "1st-Class Package Service - Retail" (and all others) rather than "First-Class Package Service - RetailTM". Is this relevant?

 

Link to comment
Share on other sites

Panic over (for now, until USPS screw up their clientèle again!)

I had done a blanket conversion to https (due to the enforced SSL fiasco!) and of course, USPS doesn't like that in the API - go figure.

Until the next time...

 

Link to comment
Share on other sites

If anyone is interested, here's the latest USPS Release Notes.  However, the real gem in this one was in the email from the USPS:

Quote

- The renaming of First-Class Mail Parcel to First-Class Package Service-Retail went into effect September 3 in our domestic price calculator API (RateV4). The name change was mistakenly communicated initially with a September 22 effective date.

I was going to say something snarky about that, but I can't come up with anything that tops that quote, so I'll let it speak for itself.

Regards

Jim

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

Link to comment
Share on other sites

  • 5 weeks later...

Anyone happen to know where the test for whether the shipping module is enabled occurs, and if I can add a condition in that test that would disable the module if the subtotal is over a certain value?

 

Link to comment
Share on other sites

@Supertex,

within the class constructor:

      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;
          }
        }
// your check BEGIN
        if (your order subtotal condition) {
          $check_flag = false;
        }
// your check END
        
        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
    }

 

Edited by raiwa
Link to comment
Share on other sites

I have $pkg_val as a session variable.  Can I use that in the class constructor, or do I have to make that a global somehow?

- and thank you for the reply.  I love this community!

 

Edited by Supertex
Link to comment
Share on other sites

  • 2 weeks later...

Hi Folks,

After some several attacks, my heavily modified oscommerce site was getting too much for me to maintain,  I started over on oscmax which seems to be pretty darn close to oscommerce. I'm having some issues with USPS module which I believe are addressed in this thread.

I have the latest installation of oscmax (2.5.4) and it appears my USPS is functional although I'm seeing "------" in place of the USPS service names. I uninstalled my USPS module and added this USPS Rate V4 module but I am not seeing any changes, all USPS services on admin and catalog side are still showing as "------" and do not post the weight. For example I have first class and priority mail enabled and I see this:

Quote

 

Shipping Quotes:

United States Postal Service 
Service (------Approx. delivery time 1 Day):$3.00

United States Postal Service 

Service (------Approx. delivery time 1 Day):$6.65

United Parcel Service (1 x 0.11lbs) (3 Day Select):$15.70

United Parcel Service (1 x 0.11lbs) (Ground):$12.36Package Weight: 1 x 0.11 | Product Qty: 1

 

I went back in to usps.php and updated line 522 for "First-Class Package Service - RetailTM", and did an uninstall/reinstall of the module but still no changes.

Any suggestions on this? Thanks!

Link to comment
Share on other sites

While oscMax started out as a fork of osCommerce, it has deviated quite a bit from that point. Since this module works in osCommerce, the most likely explanation is that something in the oscMax codebase is interfering. Sorry, but I'm not enough of an expert on that code to know where to look.

Regards

Jim

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

Link to comment
Share on other sites

2 minutes ago, kymation said:

While oscMax started out as a fork of osCommerce, it has deviated quite a bit from that point. Since this module works in osCommerce, the most likely explanation is that something in the oscMax codebase is interfering. Sorry, but I'm not enough of an expert on that code to know where to look.

Regards

Jim

Hi Jim,

I'm aware that other oscmax active developers are using this module, they've said the shipping module is 1-1 drop in with oscommerce. 

Is there a full and current list of the current USPS services? Looking at this module, it appears the list is:

$services_list = "
        \'First-Class MailRM Stamped Letter\', 
        \'First-Class MailRM Large Envelope\', 
        \'First-Class Package Service - RetailTM', 
        \'Media Mail Parcel\', 
        \'Library Mail Parcel\',
        \'USPS Retail GroundTM\', 
        \'Priority MailTM\', 
        \'Priority MailTM Flat Rate Envelope\', 
        \'Priority MailTM Legal Flat Rate Envelope\', 
        \'Priority MailTM Padded Flat Rate Envelope\', 
        \'Priority MailTM Small Flat Rate Box\', 
        \'Priority MailTM Medium Flat Rate Box\', 
        \'Priority MailTM Large Flat Rate Box\', 
        \'Priority MailTM Regional Rate Box A\', 
        \'Priority MailTM Regional Rate Box B\', 
        \'Priority Mail ExpressTM\', 
        \'Priority Mail ExpressTM Flat Rate Envelope\', 
        \'Priority Mail ExpressTM Legal Flat Rate Envelope\', 
        \'First-Class MailRM International Letter\', 
        \'First-Class MailRM International Large Envelope\', 
        \'First-Class Package International ServiceTM\', 
        \'Priority Mail InternationalRM\', 
        \'Priority Mail InternationalRM Flat Rate Envelope\', 
        \'Priority Mail InternationalRM Small Flat Rate Box\', 
        \'Priority Mail InternationalRM Medium Flat Rate Box\', 
        \'Priority Mail InternationalRM Large Flat Rate Box\', 
        \'Priority Mail Express InternationalTM\', 
        \'Priority Mail Express InternationalTM Flat Rate Envelope\', 
        \'USPS GXGTM Envelopes\', 
        \'Global Express GuaranteedRM (GXG)\'
      ";

Does this list look current? I've included the update at line 522 for First-Class Package Service - RetailTM

Link to comment
Share on other sites

Are you using this version of the module: https://apps.oscommerce.com/E3EVx&usps-methods-rates-v4-intl-rates-v2-01  If so, the only change needed would be the name change that you've already done. The rest of the services should work even without that change. I don't remember ever seeing dashes in place of the service names, which made me think it's some external problem.

The list of services you posted seems to match the latest version that I have. I think the problem is elsewhere.

Sorry I'm not being much help.

Regards

Jim

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

Link to comment
Share on other sites

8 minutes ago, kymation said:

Are you using this version of the module: https://apps.oscommerce.com/E3EVx&usps-methods-rates-v4-intl-rates-v2-01  If so, the only change needed would be the name change that you've already done. The rest of the services should work even without that change. I don't remember ever seeing dashes in place of the service names, which made me think it's some external problem.

The list of services you posted seems to match the latest version that I have. I think the problem is elsewhere.

Sorry I'm not being much help.

Regards

Jim

All suggestions are appreciated, thanks Jim.

Is the link you provided the same as USPS Rate V4 Intl Rate V2_r3.6? I am using this V2_r3.6.

Link to comment
Share on other sites

The issues are probably in my installation or database.

In this USPS module package, there are some "files to modify" in two directories called 2.3.4 and 2.3.x.x. What are these directories referencing? The first of them appears to have a catalog side file and the other has an admin side file, this doesn't make sense to me. Is 2.3.4 an oscommerce release number and if so, what is 2.3.x.x?

Also, everything in the "New_Files" directory of this downloaded package appears to be catalog side files, I make that assumption because the they are not packed in an "admin" directory and the instructions don't say otherwise. Are these meant for the catalog side?

Also, why does the module have a readme.txt and an upgrade.txt which appear fairly similar yet have enough differences to confuse the heck out a person?

 

 

Link to comment
Share on other sites

This module has a long history, so some parts of it may not make sense. Basically, the 2.3.x.x files match those found in osC 2.3.1, 2.3.2, etc, while the 2.3.4 files are specific to 2.3.4. Probably none of those match anything in oscMax so you're going to have to patch your files. I suggest the use of a good file comparison program.

The Admin file change is needed to make the installer store the database entries correctly. It's used in several modules, so that change may already be in your package. Check to make certain.

The catalog side changes were needed to make the module results display correctly in older versions of osC. Check that those patches match your code. This is more likely where your problem lies.

Regards

Jim

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

Link to comment
Share on other sites

  • 1 month later...

The USPS has just released the notes for their January update. Other than the usual price increases, they are changing some of the unusual classes, mostly adding more information in the response. I don't see anything that we need to be concerned about, but there could be something lurking in there that I missed.

I don't see a link on their website for the January release notes, so I'll attach my copy.

Regards

Jim

00000261.Web_Tools_Release_Notes_-_January_2018_-_EXTERNALv1.1.pdf

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

Link to comment
Share on other sites

@crimble crumble You're going to have to find out what the USPS server is returning before you can do anything about it. First, turn on "Send Debug Email" in the admin settings for the module. Then you need to wait until this error happens again. When it does, copy that email and compare it to a valid quote. Post here if you can't figure out the problem from that.

I suspect that the USPS server is returning an error message that the module can't handle. We just need to know what it is so the module can be modified to detect it. Of course it could also be something entirely different that I haven't thought of.

Regards

Jim

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

Link to comment
Share on other sites

crimble crumble - I don't think this is related to the USPS module. I recently had this same problem with a site except it was showing a "z". That letter is the first letter of the shipping module. In my case it was Zones. The probably only happened with the paypal express module and only when it was clicked without logging in. I didn't troubleshoot it since my client decided to switch to the paypal standard module instead. So this isn't much help but might get you looking in the correct location. Maybe the option in express settings in admin to allow picking shipping options is causing the problem?

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 1 month later...

hi,

I just downloaded the latest version of this USPS addon and in the /includes/classes/http.php file every single function starts with a capital first letter - as in "Function" vs. "function"

Does this make any difference? I googled it but cannot find anything on this matter. The reason I ask is because DreamWeaver does not recognize anything other than a lower case version as a function per its color coding.

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

The word function is a php keyword and those are not case-sensitive. See here. But it is considered bad form to use upper-case for keywords. And there is a push to make them case-sensate, which will probably happen at some point. See here.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...

I am using the USPS Rate V4 Intl Rate V2 , updates as of   $Mod: USPS API changes 20160119 a.forever $

in osCmax, and it seems to work.  But, I need to add insurance to domestic Priority and International Priority.  I have tried the N, S and H checkbuttons, but they have no effect.  There are insurance checkbuttons for

extra services, both domestic and international, but none specifically for Priority.  Anyway, no matter what settings of the N, S H Insurance buttons are set, the USPS quote for domestic postage is always the same (too low).

Am I doing anything wrong?  Is there an option or update that will fix this?

Thanks,

Jon

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...