Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] - USPS Methods


Recommended Posts

Not having fun here.. removed my current module, replaced with http://addons.oscommerce.com/info/487 international is fine - though I have not looked to see if the handling fee was added - but I got a completely blank page on domestic quotes

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

Link to comment
Share on other sites

Here is My quick fix for USPS domestic rates and international issues i tested both and both are now working

 

 

Find

$this->intl_types = array('GLOBAL EXPRESS' => 'Global Express Guaranteed',
							'GLOBAL EXPRESS NON-DOC RECT' => 'Global Express Guaranteed Non-Document Rectangular',
							'GLOBAL EXPRESS NON-DOC NON-RECT' => 'Global Express Guaranteed Non-Document Non-Rectangular',
							'EXPRESS MAIL INT' => 'Express Mail International',
							'EXPRESS MAIL INT FLAT RATE ENV' => 'Express Mail International Flat-Rate Envelope',
							'PRIORITY MAIL INT' => 'Priority Mail International',
							'PRIORITY MAIL INT FLAT RATE ENV' => 'Priority Mail International Flat-Rate Envelope',
							'PRIORITY MAIL INT FLAT RATE BOX' => 'Priority Mail International ' . $this->PriorityFlatRateBoxType,
							'FIRST-CLASS MAIL INT' => 'First Class Mail International package** ' . $this->FirstClassIntType);

 

 

Find

$size = sizeof($uspsQuote);
         for ($i=0; $i<$size; $i++) {
           list($type, $cost) = each($uspsQuote[$i]);
$type = str_replace('&lt;sup&gt;&amp;reg;&lt;/sup&gt;', '', $type);
$type = str_replace('&lt;sup&gt;&amp;trade;&lt;/sup&gt;', '', $type);
$type = str_replace('**', '', $type);

 

Find

$service = ereg('<SvcDescription>(.*)</SvcDescription>', $services[$i], $regs);
	  $service = $regs[1];

                         $service = str_replace('&lt;sup&gt;&amp;reg;&lt;/sup&gt;', '', $service); 
             $service = str_replace('&lt;sup&gt;&amp;trade;&lt;/sup&gt;', '', $service); 


             $postage = ereg('<Postage>(.*)</Postage>', $services[$i], $regs);

 

 

These changes make it work.

to get Handling to work you need to do the $service routine above for the Switch:Case..

 

Look for this

$service = ereg('<MailService>(.*)</MailService>', $response[$i], $regs);

$service = $regs[1];

and add the same as above directly following:

 

$service = str_replace('&lt;sup&gt;&amp;reg;&lt;/sup&gt;', '', $service);

$service = str_replace('&lt;sup&gt;&amp;trade;&lt;/sup&gt;', '', $service);

Link to comment
Share on other sites

Did some tweaking and I've got some of the domestic working. It's not complete.

 

Flat rate options, library, and BPM are not included.

 

All standard (pre-flat rate) domestic options are working - first class, media, parcel, priority, and express.

 

Besides what I already know isn't working or included, if anyone runs across bugs relative to what IS included, let me know.

 

And if anyone can get it working with ANY flat rate options, that would just be icing on the cake.

 

USPS Methods 5.0.1

Link to comment
Share on other sites

Did some tweaking and I've got some of the domestic working. It's not complete.

 

Besides what I already know isn't working or included, if anyone runs across bugs relative to what IS included, USPS Methods 5.0.1

 

Thank you so much, mine is finally working! I only use First Class, Parcel Post & basic Priority (since most do not choose the correct size box) and they are showing during check-out.

 

I did notice that the shipping calculator is no longer showing in the cart for international (does for domestic), not a huge problem.

 

Thanks again for all your work!

Link to comment
Share on other sites

Jetta, installed and followed your instructions to a T, easy enough.. immediately tested domestic and again I am getting a blank screen so I turned it off again

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

Link to comment
Share on other sites

I installed the latest USPS contribution and it's working for me too. The only off thing I noticed is that Domestic quotes don't show the delivery time, but I will most likely hard code those temporarily. I only offer Express and Priority...

 

By the way, I edited out the 'library' additions and left out the _vti_cnf files and directories that were added by Fulluv Scents.

 

Thank you everyone!!

 

UPDATE:

domestic options show priority on the confirmation page no matter which is chosen (priority or express). I'm now only offering priority until I can fix this.

Edited by getflocked
Link to comment
Share on other sites

Jetta:

 

Your latest contribution 5.0.1 is working perfectly for me. International and domestic. Also any changes to shipping method carry over to the confirmation page correctly. Thank you very kindly for your efforts!

 

I wish you good health and prosperity in the New Year!

 

Did some tweaking and I've got some of the domestic working. It's not complete.

 

Flat rate options, library, and BPM are not included.

 

All standard (pre-flat rate) domestic options are working - first class, media, parcel, priority, and express.

 

Besides what I already know isn't working or included, if anyone runs across bugs relative to what IS included, let me know.

 

And if anyone can get it working with ANY flat rate options, that would just be icing on the cake.

 

USPS Methods 5.0.1

Link to comment
Share on other sites

For those of you that are wondering how to make the First Class Mail Estimate show back up, find the case below:

 

case 'First Class Mail': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               default:            $time = '';

 

change to:

 

case 'First-Class Mail Package': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               default:            $time = '';

 

 

Good team work by the way!

Link to comment
Share on other sites

I've added 5.0.1 however I can no longer select the international shipping options. They all show up and in the admin panel the check boxes are missing.

 

There were there before.

 

Mike

Link to comment
Share on other sites

Did some tweaking and I've got some of the domestic working. It's not complete.

 

Flat rate options, library, and BPM are not included.

 

All standard (pre-flat rate) domestic options are working - first class, media, parcel, priority, and express.

 

Besides what I already know isn't working or included, if anyone runs across bugs relative to what IS included, let me know.

 

And if anyone can get it working with ANY flat rate options, that would just be icing on the cake.

 

USPS Methods 5.0.1

 

All working!! :lol: :lol: Thanks for your good works.. :thumbsup:

Link to comment
Share on other sites

We are back up thanks for the contribution, you all rock. I did notice that we can't select international options from the admin panel anymore. Also notice that first class international is not showing up. Any help please. Thanks

Link to comment
Share on other sites

The _vti_cnf files were not meant to be added to contribution 5.0.0 and should not be uploaded.

 

The fix for first class shipping times is :

 

find:

 

                case 'First-Class Mail': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               					default:            $time = '';

 

replace with:

 

                case 'First-Class Mail': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               					default:            $time = '';
                                   break;
               case 'First-Class Mail Flat': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               					default:            $time = '';
                                   break;
               case 'First-Class Mail Letter': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               					default:            $time = '';
                                   break;
               case 'First-Class Mail Package': $time = 'Estimated 1 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
                                   break;
               					default:            $time = '';
                                   break;

 

@ getflocked: 5.0.1 fixed the domestic issue. Rates don't revert back to default at confirmation. The registered trademark string had to be stripped to stop the reversion. It does not fix the flat rate envelope and flat rate box reversion, but it does stop the reversion for standard shipping options. 5.0.1 also removed flat rate options until someone can find a way to get them working correctly.

 

Find:

 

        $http->Disconnect();
     } else {
       return false;
     }

 

ADD AFTER:

 

$body = str_replace('&lt;sup&gt;&amp;reg;&lt;/sup&gt;', '', $body);
$body = str_replace('&lt;sup&gt;&amp;trade;&lt;/sup&gt;', '', $body);

 

@ mabiem & jjvillarinc: The international options in the admin panel work fine for me. I've turned options on and off, uninstalled and reinstalled and have had no problems with it. Since it isn't replicating from my end, hopefully someone else can find the fix. Did you uninstall from admin panel before or after uploading the new files? Try reverting back to your old file (if you still have a copy), do the uninstall, and THEN upload the new files. It could be that options weren't cleared from your database correctly before you uploaded the new file. IDK, but it's a thought.

 

@ kieran_mullen: Handling fee is being added on my site for both international and domestic.

 

My bug is priority flat rate shipping. Anyone have any ideas for that?

Link to comment
Share on other sites

I also do not see the int'l options to check on and off with 5.0 or 5.1

 

Int'l did work but this version does not have seperate handling fees for int'l like the version I was using.

I commented out the lines for the rates I don't offer and that worked on the client side - but I never went through and finished checkout so I dont know if it was reverting.

 

HOWEVER ---

 

nothing I have been able to accomplish gives me anything on the domestic side.. as a matter of fact I get a totally blank screen, no errors, nothing..

 

I'm going to go back to square one on my dev cart and see what I can find there.. I suppose I was doing so much trial and error I foo-bar'd something bad..

 

The working version I had was:

USPS Methods 4.3.2 Fix international services Jan 8, 2010

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

Link to comment
Share on other sites

I found the problem for the options not showing up in admin it had to do with the database. The reason being the field "set_fuction" in the "configuration" table was set to varchar 255 and since we added more values it was only showing up to the 255 characters. I bumped it up to 1020 so the field looks like: set_function varchar(1020)

 

and now all the international options are displaying in admin and I'm able to select / deselect them.

 

-J

p.s. thanks for all your help. @full you pointed me in the right direction .. so thanks

Link to comment
Share on other sites

You need to change the 'set_function' field in the 'configuration' table to varchar 1020 originally it was set to varchar 255.

 

-J

 

I also do not see the int'l options to check on and off with 5.0 or 5.1

 

Int'l did work but this version does not have seperate handling fees for int'l like the version I was using.

I commented out the lines for the rates I don't offer and that worked on the client side - but I never went through and finished checkout so I dont know if it was reverting.

 

HOWEVER ---

 

nothing I have been able to accomplish gives me anything on the domestic side.. as a matter of fact I get a totally blank screen, no errors, nothing..

 

I'm going to go back to square one on my dev cart and see what I can find there.. I suppose I was doing so much trial and error I foo-bar'd something bad..

 

The working version I had was:

USPS Methods 4.3.2 Fix international services Jan 8, 2010

Link to comment
Share on other sites

I have installed 5.0.1 and everything seems to be working. The issue I have is the debug mail that gets generated on each query to USPS. It seems to be located in this area

if ($http->Connect($usps_server, 80)) {
       $http->addHeader('Host', $usps_server);
       $http->addHeader('User-Agent', 'osCommerce');
       $http->addHeader('Connection', 'Close');
       if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();
 mail('[email protected]','USPS rate quote response',$body,'From: <[email protected]>');
       if ($transit && is_array($transreq) && ($order->delivery['country']['id'] == STORE_COUNTRY)) {
         while (list($key, $value) = each($transreq)) {
           if ($http->Get('/' . $api_dll . '?' . $value)) $transresp[$key] = $http->getBody();
         }
       }
       $http->Disconnect();
     } else {
       return false;
     }

 

Can I just comment out the line with the mail function without adversely affecting anything? I'm getting flooded with bounces from the server...

Link to comment
Share on other sites

I had the same problem and I fixed it. All options domestic and international are showing up in both front end and control panel.

 

I've added 5.0.1 however I can no longer select the international shipping options. They all show up and in the admin panel the check boxes are missing.

 

There were there before.

 

Mike

Link to comment
Share on other sites

Try // and then test it.

 

I have installed 5.0.1 and everything seems to be working. The issue I have is the debug mail that gets generated on each query to USPS. It seems to be located in this area

if ($http->Connect($usps_server, 80)) {
       $http->addHeader('Host', $usps_server);
       $http->addHeader('User-Agent', 'osCommerce');
       $http->addHeader('Connection', 'Close');
       if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();
 mail('[email protected]','USPS rate quote response',$body,'From: <[email protected]>');
       if ($transit && is_array($transreq) && ($order->delivery['country']['id'] == STORE_COUNTRY)) {
         while (list($key, $value) = each($transreq)) {
           if ($http->Get('/' . $api_dll . '?' . $value)) $transresp[$key] = $http->getBody();
         }
       }
       $http->Disconnect();
     } else {
       return false;
     }

 

Can I just comment out the line with the mail function without adversely affecting anything? I'm getting flooded with bounces from the server...

Link to comment
Share on other sites

Ok setting the 'set_function' field in the 'configuration' table to varchar 1020 fixed my Admin Panel Int'l shipping options issue.

 

I'm having a new issue. I have a test account with a domestic and international address.

 

I backed everything back to yesterday and was getting the original issue everyone is getting. I installed 5.0.1 (just coping the two files nothing else) with the module uninstalled. I re-installed the module and everything appears to work well. Once I select shipping int'l shipping I go back and try to switch to a domestic address and my checkout page goes blank. Nothing fixes it except reinstalling the original usps module files.

 

Mike

Link to comment
Share on other sites

I found the problem for the options not showing up in admin it had to do with the database. The reason being the field "set_fuction" in the "configuration" table was set to varchar 255 and since we added more values it was only showing up to the 255 characters. I bumped it up to 1020 so the field looks like: set_function varchar(1020)

 

and now all the international options are displaying in admin and I'm able to select / deselect them.

 

-J

p.s. thanks for all your help. @full you pointed me in the right direction .. so thanks

 

I dont get where to make this change .. can you be more specific please?

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

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...