Jump to content
fulluvscents

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

Recommended Posts

That's a generic error message, so it's not really helpful. Find this line in includes/modules/shipping/usps.php and uncomment it:

 

 

        // mail( STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $mail_body );

 

Then run a test order. You'll get an email that will tell you what's being sent to and received from USPS. Post the response part here if you can't figure it out.

 

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

Has anyone experienced this module resulting in duplicate configuration options within the admin panel? 

 

I am migrating my site from 2.2 to 2.3.3.4 and just installed USPS Methods Rates V4 Intl Rates V2 - R3.3 to a clean installation of OSC 2.3.3.4.  Well, it is clean except for that I purchased a template from one of the big guys and they provided the installation files.  

 

After installing the file and the module, when I edit the USPS shipping module, all configuration settings are displayed twice.  One after the other.  It seems that I can make the necessary modifications and save but this has me worried as other people will have to adjust this in the future and thus I need to figure out what is causing it.  I thought it might be in the module.php code since mine looked a bit different from that of the installation instructions, but after troubleshooting, that didn't seem to affect anything.

 

Attached is an image of the configuration screen.  Anyone have a suggestion on what could be causing this?

post-59670-0-37331100-1408743987_thumb.png

Edited by AllThingsTrendy

Anthony David

AllThingsTrendy.com

Share this post


Link to post
Share on other sites

Uninstall and reinstall your USPS module. If the problem doesn't go away, your "template" is probably interfering.

 

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

CATCH  the Rabbit why is it all so raggedy (your image)

 

serious though

 

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

 

works fine I use the one from  kymation (wonder where he got that name)

 

Think the later are also good but only used a few times so not an expert !

 

just replace the files and fill out the admin details filled out  again would suggest first uninstalling whatever you have to keep the database clean.

 

 

Regards

Joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

You should use the latest version of that module. Actually, I need to upload a new patch to that, so maybe the next version.

 

(wonder where he got that name)

 

Volume "K" of the O.E.D.

 

No, really.

 

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, I figured it out.  I made a mistake.  Instead of replacing the following line in modules.php, I left it and just copied the new code after.

 

$contents[] = array('text' => '<br>' . $keys);

 

Sorry for the false alarm!


Anthony David

AllThingsTrendy.com

Share this post


Link to post
Share on other sites

Glad to hear that you found it. I didn't think of that, but that would certainly account for the duplication.

 

I've updated the Addons section with the new version. It only affects stores that are using Paypal Standard (and possible Paypal Express, although I haven't tested that.) You should replace the module file if you are using one of those Paypal modules, otherwise don't bother.

 

I also updated the MVS version with all of the recent changes.

 

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,

 

Thank You for the updated module file!  I do utilize two PayPal modules with this template although I don't know if I was have any issues as a result.

 

Unfortunately, I still haven't tweaked the module properly as it is still acting up. I suspect it has something to do with this template and I am hoping you or someone can help me figure this out; even if I need to hire you.  Since this isn't a truly standard OSC, I feel even worse about posting questions for free support.

 

Here's the problem:  After I "fixed" the previous problem, this new issue appeared whereas the shipping types, weight ranges, and rates are not appearing in the proper fields within the admin UI (see screen captures within the attached usps_methods_2.png).  In hope of someone being able to easily see the issue, I'll paste the details of the two modifications to modules.php.

 

Instructions for Modification #1 to modules.php

Find 

 
if (tep_not_null($action)) {
    switch ($action) {
      case 'save':
        while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
 
If you do not already have this line or something very similar:
 
 if( is_array( $value ) ){
          $value = implode( ", ", $value);
                          $value = ereg_replace (", --none--", "", $value);
                            }
 
Then, insert this after the above code, otherwise skip this:
// USPS START
if( is_array( $value ) ) $value = implode( ', ', $value);
// USPS END

 

Actual Modification #1 to modules.php

Code Before Modification

  if (tep_not_null($action){
    switch ($action{
      case 'save':
        reset($HTTP_POST_VARS['configuration']);
        while (list($key$valueeach($HTTP_POST_VARS['configuration']){
        // bof Dynamic Template System              
          if((is_array($value)&& (!empty($value))){
          $pages '';
          $count count($value);
          for($i=$i<$count$i++){
          $pages "$pages$value[$i]";
          tep_db_query("update " TABLE_CONFIGURATION " set configuration_value = '" $pages "' where configuration_key = '" $key "'")
               }
          }
        // eof Dynamic Template System
          else
          {         
          tep_db_query("update " TABLE_CONFIGURATION " set configuration_value = '" $value "' where configuration_key = '" $key "'");
          }
        }
        tep_redirect(tep_href_link(FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module']));
        break;
      case 'install':
      case 'remove':

 

 

Code After Modification

  if (tep_not_null($action){
    switch ($action{
      case 'save':
        reset($HTTP_POST_VARS['configuration']);
        while (list($key$valueeach($HTTP_POST_VARS['configuration']){
          
// USPS START
      ifis_array$value $value implode', '$value);
// USPS END
          
        // bof Dynamic Template System              
          if((is_array($value)&& (!empty($value))){
          $pages '';
          $count count($value);
          for($i=$i<$count$i++){
          $pages "$pages$value[$i]";
          tep_db_query("update " TABLE_CONFIGURATION " set configuration_value = '" $pages "' where configuration_key = '" $key "'")
               }
          }
        // eof Dynamic Template System
          else
          {         
          tep_db_query("update " TABLE_CONFIGURATION " set configuration_value = '" $value "' where configuration_key = '" $key "'");
          }
        }
        tep_redirect(tep_href_link(FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module']));
        break;
      case 'install':
      case 'remove':

 

 

Instructions for Modification #2 to modules.php

Find:
 
$contents[] = array('text' => '<br>' . $keys);
 
Replace with:
 
// USPS START
//        $contents[] = array('text' => '<br>' . $keys);
        $contents[] = array('text' => '<br />' . preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/'), array('®', '™', 'Intl', 'Env'), $keys));
// USPS END

 

 

Actual Modification#2 to modules.php

Code Before Modification

      $contents array('form' => tep_draw_form('modules'FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module''&action=save'));

      $contents[array('text' => $keys);
      $contents[array('align' => 'center''text' => '<br />' tep_draw_button(IMAGE_SAVE'disk'null'primary'
     
tep_draw_button(IMAGE_CANCEL'close'tep_href_link(FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module'])));
      break;

 

 

Code After Modification

      $contents array('form' => tep_draw_form('modules'FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module''&action=save'));
//      $contents[] = array('text' => $keys); <AllThingsTrendy>NOTICE MY TEMPLATE DOES NOT INCLUDE THE "<br>". As you can see by the commented lines, I have tried
with and without it.


// USPS START
//        $contents[] = array('text' => '<br>' . $keys);
        $contents[array('text' => '<br />' preg_replace(array('/RM/''/TM/''/International/''/Envelope/')array('®''™'
         
'Intl''Env')$keys));
//        $contents[] = array('text' => preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/'), array('®', '™',
         'Intl', 'Env'), $keys));

// USPS END
      
      $contents[array('align' => 'center''text' => '<br />' tep_draw_button(IMAGE_SAVE'disk'null'primary'tep_draw_button(IMAGE_CANCEL,
     
'close'tep_href_link(FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module'])));
      break;

 

 

 

 

 

 

 

 

post-59670-0-34783500-1408806775_thumb.png


Anthony David

AllThingsTrendy.com

Share this post


Link to post
Share on other sites

The second edit appears to contain errors. Something is putting line breaks in the inserted line. If those breaks are actually there, they need to be removed. If your editor is doing that, go find a different editor. Something like Notepad++ would be good.

 

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, I added those line breaks because the forum post appeared to cause the entry to require scrolling  Below is the actual...

 

 

 

      $contents array('form' => tep_draw_form('modules'FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module''&action=save'));
//      $contents[] = array('text' => $keys);

// USPS START
//        $contents[] = array('text' => '<br>' . $keys);
//        $contents[] = array('text' => '<br />' . preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/'), array('®', '™', 'Intl', 'Env'), $keys));
        $contents[array('text' => preg_replace(array('/RM/''/TM/''/International/''/Envelope/')array('®''™''Intl''Env')$keys));
// USPS END
      
      $contents[array('align' => 'center''text' => '<br />' tep_draw_button(IMAGE_SAVE'disk'null'primary'tep_draw_button(IMAGE_CANCEL'close'tep_href_link(FILENAME_MODULES'set=' $set '&module=' $HTTP_GET_VARS['module'])));
      break;

Anthony David

AllThingsTrendy.com

Share this post


Link to post
Share on other sites

OK, that was too easy. After taking another look at your code, it appears that the first edit will not work. Your template code is making one change to arrays, and this module is trying to make a different change to the same arrays. This will never work.

 

Sorry, but there's a fundamental incompatibility between this module (and several other modules that use the same code) and your template. One or the other would require substantial code changes. That's more than I can do in this support thread.

 

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

Looks like your lovely US Postal Service is about to screw us over again...

 

September 7, 2014 USPS will be implementing changes and additional features to the Web Tools APIs. Detailed release notes are available on the USPS Web Tools home page at www.usps.com/webtools.

I've said it before and I'll say it again. You need to do a mass protest to them and get THEM to produce an official oscommerce shipping (sic) module. You Americans love to sue for the slightest thing, so why so reticent about this nonsense? (Rhetorical.)

Edited by ejsolutions

Share this post


Link to post
Share on other sites

Many people have protested before, with absolutely no result. They don't care.

 

It looks like First Class Parcel is going to take a hit, and probably some others.

 

I'm about 80% done with a new module that will stop a lot of the damage. I just need the time to finish it. It looks like that will be at least a month from now, so we'll probably have to patch this one yet again.

 

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 spoke too soon. First Class seems to still be working (using the test server at USPS) and so does Media Mail, but everything else is broken. Still trying to find out why. The USPS documentation is worthless, as usual.

 

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

Your efforts are appreciated, as always.

Best of luck.

 

USPS forgets who the customer is.

Share this post


Link to post
Share on other sites

I've got a module working. I think. The module download is here. Please download and test this. I'm particularly interested in the First Class rates, but it doesn't hurt to test all of them.

 

If you are replacing an existing module, you'll need to replace the module file as usual, and also add includes/classes/http.php. The latter fixes the odd problem with chunked encoding that the USPS claims they aren't using.

 

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

Not seeing 1st class domestic parcel.  Priority is showing up.


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 forgot to take my email address out. For those of you testing (all one of you) please change the email on line 558 to yours. Thanks.

 

@@altoid: I'll take a look at it. First Class is what they changed (plus Library and Media) so that is where I ecpect problems.

 

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

Hi Jim,  I down loaded the above and went to new files>includes>modules>shipping>usps.php and also changed line 558.  I'm still not getting first class.  Just Priority Mail & Priority Mail Express.

Share this post


Link to post
Share on other sites

riddle me this?  I took the new usps off and put my old on back up and look

nited States Postal Service 0 lbs, 6 oz shipping_usps.gif First-Class Mail® Parcel $3.86 Priority Mail $6.35 Priority Mail Express $21.42

Share this post


Link to post
Share on other sites

Your old module is using the production server with the old API, while the test version is using the new API. Starting Monday, the new API will be installed on the production server and your quotes will stop working. Well, some of them.

 

I got sidetracked by a broken monitor on this machine. I'll go take another look at the changes for First Class.

 

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

Ditto for me.  Like dculley, I only use 1st Class Parcel, Priority and Priority Express - both domestic and international.  1st Class is not coming up, but I was using Rate V2_r3.4.  1st Class is really the only reason I use USPS - it's the cheapest shipping going for small packages.  Sounds like I need to wait for a new module. 

 

Many thanks for your efforts, Jim! 

Share this post


Link to post
Share on other sites

Let's try this again: here's the latest test version. I'm getting First Class Parcel quotes now. Still no Media or Library mail. I'm not sure how many people use those. I'll take another look at Media at least.

 

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

And again: Try #3. This one has Media and Library Mail working.
 
It just takes a while to wrap my brain around the convoluted and nonsensical mess that USPS calls an API. My brain keeps trying to run away and hide. Don't blame it.
 
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

And again: Try #3. This one has Media and Library Mail working.

 

It just takes a while to wrap my brain around the convoluted and nonsensical mess that USPS calls an API. My brain keeps trying to run away and hide. Don't blame it.

 

Regards

Jim

When using an international address, I get the following error:

 

Warning: Illegal string offset 'ServiceName' in /html/includes/modules/shipping/usps.php on line 118

 

EDIT: Also, you need to remove all ** in function get_usps_services_list() for international services. And within the same function, Global Express GuaranteedRT should probably change to Global Express GuaranteedRM.

Edited by a.forever

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

×