Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] - USPS Methods


Recommended Posts

Okay, well, that wasn't so bad. It hasn't been tested for everything imaginable, BUT, I know that all domestic and international options are working.

 

I removed some internationals. If all flat rate envelopes are the same price, then there is not need to list them all. It's just one flat rate envelope to the customer. Seller can ship in his choice.

 

4.3.2 has been merged with 5.0.1

 

Handling is working but only applies to domestic options. Insurance is working for US and Canada. I don't have other test countries set up, so I haven't checked any others. If you run into bugs, please post the bug and the fix. I'd like to get a bug free fully functional module and get it uploaded to contributions all in one shot.

 

OK great I will make a stab at this on my dev cart later and report in!

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

Link to comment
Share on other sites

Stab failed, int'l perfect IMHO except no handling fee, domestic produced blank white page. I did extensive compare between the original oscmax supplied working module, the ozeworks working module and fullvuscent's spitting white page module.

 

I found several differences that might point the finger in the right direction for all.. will communicate private with fulluvscent and report back!

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

Link to comment
Share on other sites

for those who didn't have the first class international, here is the fix:

 

AFTER

 

$body = str_replace('<sup>®</sup>', '', $body);
$body = str_replace('<sup>™</sup>', '', $body);


 

ADD

 

$body = str_replace('**', '', $body);

 

That will get rid of these two very useful stars that they added after the names (as usefull as the ®, haha!)

 

Well, that gave us some work to start the year, didn't it?

Link to comment
Share on other sites

When I try this I get a blank page in admin/shipping/modules.php. So I can't delete, add or edit the USPS shipping options.

 

I have never seen this before.

 

Anyone else experience this?

 

Okay, well, that wasn't so bad. It hasn't been tested for everything imaginable, BUT, I know that all domestic and international options are working.

 

I removed some internationals. If all flat rate envelopes are the same price, then there is not need to list them all. It's just one flat rate envelope to the customer. Seller can ship in his choice.

 

4.3.2 has been merged with 5.0.1

 

 

?>[/code]

Link to comment
Share on other sites

A couple changes to the code that I think will fix the white screen and also show the registered trademark symbol the way USPS intended to be.

 

This is working from the latest code that I posted (merging 4.3.2 with 5.0.1).

 

Find (line 58):

 

        'Global Express' => 'Global Express Guaranteed (GXG)**',
       'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular',
       'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular',
       'USPS GXG Envelopes' => 'USPS GXG Envelopes**',
       'Express Mail Int' => 'Express Mail International',
       'Express Mail Int Flat Rate Env' => 'Express Mail International Flat Rate Envelope',
       'Priority Mail International' => 'Priority Mail International',
       'Priority Mail Int Flat Rate Lrg Box' => 'Priority Mail International Large Flat Rate Box',
       'Priority Mail Int Flat Rate Med Box' => 'Priority Mail International Medium Flat Rate Box',
       'Priority Mail Int Flat Rate Small Box' => 'Priority Mail International Small Flat Rate Box**',
       'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope**',
       'First-Class Mail Int Lrg Env' => 'First-Class Mail International Large Envelope**',
       'First-Class Mail Int Package' => 'First-Class Mail International Package**',
       'First-Class Mail Int Letter' => 'First-Class Mail International Letter**'

 

Replace with:

 

        'Global Express' => 'Global Express Guaranteed (GXG)',
       'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular',
       'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular',
       'USPS GXG Envelopes' => 'USPS GXG Envelopes',
       'Express Mail Int' => 'Express Mail International',
       'Express Mail Int Flat Rate Env' => 'Express Mail International Flat Rate Envelope',
       'Priority Mail International' => 'Priority Mail International',
       'Priority Mail Int Flat Rate Lrg Box' => 'Priority Mail International Large Flat Rate Box',
       'Priority Mail Int Flat Rate Med Box' => 'Priority Mail International Medium Flat Rate Box',
       'Priority Mail Int Flat Rate Small Box' => 'Priority Mail International Small Flat Rate Box',
       'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope',
       'First-Class Mail Int Lrg Env' => 'First-Class Mail International Large Envelope',
       'First-Class Mail Int Package' => 'First-Class Mail International Package',
       'First-Class Mail Int Letter' => 'First-Class Mail International Letter'

 

Find (line 456):

 

$body = str_replace('<sup>®</sup>', '', $body);
$body = str_replace('<sup>™</sup>', '', $body);

 

Replace with:

 

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

 

Find (line 484):

 

	  		$service = htmlspecialchars_decode($regs[1]);
  		$service = preg_replace('/\<sup\>\&reg;\<\/sup\>/', '<sup>®</sup>', $service);

 

Replace with:

 

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

 

Find (line 652):

 

	  $time = ' (' . $time . ') ';

 

Add this code AFTER:

 

               $service = str_replace('**','',$service);

 

So, it will look like this:

 

	  $time = ' (' . $time . ') ';
              $service = str_replace('**','',$service);

 

This will eliminate the ** at the end of international methods. It will add the R symbol where it should be in the domestic methods. It will eliminate the decode command, and it should eliminate any white screen issues.

Link to comment
Share on other sites

Progress my good man.. no more white blank on the domestic side.. but now we are not getting handling fees and now international is spitting

An error occured with the USPS shipping calculations.

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

 

The order is 1.5lbs so thats not an issue.. left as is (intn'l rates checked) the first time with .8lb and got the same error. Added something heavier in and got the error, unchecked all but express & priority and got the error.. we are getting very close here

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

Link to comment
Share on other sites

When I try this I get a blank page in admin/shipping/modules.php. So I can't delete, add or edit the USPS shipping options.

 

I have never seen this before.

 

Anyone else experience this?

 

 

Do you have .bak files in there?? no extra files in that folder.. that might be your problem

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

Link to comment
Share on other sites

Progress my good man.. no more white blank on the domestic side.. but now we are not getting handling fees and now international is spitting

 

 

The order is 1.5lbs so thats not an issue.. left as is (intn'l rates checked) the first time with .8lb and got the same error. Added something heavier in and got the error, unchecked all but express & priority and got the error.. we are getting very close here

 

Ha ha ha. I told you it would get rid of the whitescreen.

Link to comment
Share on other sites

Jetta, and I apologize for calling you a "good man" :)

 

Installed your version with no change..

 

Domestic

all rate quotes come up

handling charges not being added

weight displayed

no transit times being displayed

 

International

produces no rate quotes An error occured with the USPS shipping calculations.

 

 

Turned on reporting and received what looks like a very valid, no error response in there at all

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

Link to comment
Share on other sites

So does anyone have the international shipping working without errors with USPS shipping yet. My domestic is fine but international shows errors ?

 

Amit

 

 

I am at a point with fulluvscent that domestic is working, no handing fee, no transit times, but now international is producing the: An error occured with the USPS shipping calculations

 

Just did soe major comparing and testing, hopefully she (yes she!) can help me out here.. if it works on her server and mine we may have a winner..

Edited by wkdwich

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

Link to comment
Share on other sites

What was your test weight? If it was over 64 ounces, then that would be one reason 1st class international wouldn't work. Just a thought.

Test weight was 1 ounce, which should get any First-Class to work. I think it's a server side issue. No other explaniation I can think of as to why it works with one host and not another. Gonna try poking at the code some more over the weekend.

Link to comment
Share on other sites

Can someone tell me definitively if Flat Rate should be:

Flat Rate

or

Flat-Rate

 

I am comparing 2 files of 4.3x ALPHA they behave well for both people, neither completely behave for me

 

also while I am at it.. the silly ** - required?? not required?? one has it, then strips it, the other doesnt have it at all

Edited by wkdwich

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

Link to comment
Share on other sites

Debbie or Jetta,

 

If I send you my usps.php file can you tell me where to start. I feel i might have done manual updates everytime a chance came and might have an older version. I want to know if I should just go ahead and update to it 5.0.1 and start talking the same language that you guys are talking. I do have the domestic rates working at this time its just the international rates that are not working.

 

Thanks

 

Amit

 

I am at a point with fulluvscent that domestic is working, no handing fee, no transit times, but now international is producing the: An error occured with the USPS shipping calculations

 

Just did soe major comparing and testing, hopefully she (yes she!) can help me out here.. if it works on her server and mine we may have a winner..

Link to comment
Share on other sites

Can someone tell me definitively if Flat Rate should be:

Flat Rate

or

Flat-Rate

 

I am comparing 2 files of 4.3x ALPHA they behave well for both people, neither completely behave for me

 

also while I am at it.. the silly ** - required?? not required?? one has it, then strips it, the other doesnt have it at all

 

Flat rate didn't work for me until I removed the hyphens. There should be no hyphens in flat rate, and I also had to change the container and size settings to get the boxes to work.

 

USPS is sending you the **. If your script can't read it and match what you have, then it will fail in the API call. So, you either need to have it so it matches the USPS call (by having ** show in your text), or if you don't have (or show) it, then you need to keep the USPS from sending it to you by stripping it before it compares to what you have. I've sent and posted scripts that do both. It'll give you rates either way.

 

Same thing goes for the trademark symbol. Show it or don't, but make sure that what you have matches what the USPS is sending you (or what you allow it to send you). The difference though is that the symbol isn't on the end of all of the methods. For some, it is in the middle, so if you simply strip it, then USPS cannot communicate anything past the mark (that means all flat rate options). And that is why flat rate options aren't working in some of the attempts. In my opinion, if you can't receive all of the options (whether or not you want to), then the script isn't doing what it's supposed to do. A properly functioning script will read all the options available and allow you to choose which ones you want to use. It won't dictate what you can or can't use due to missing functionality.

 

I chose to strip the ** and leave the trademark symbol. For me everything is working 100% perfectly and I like it better than the 4.3.2 version that I previously had. And so I have accomplished what I've set out to do (except that I would like to add international handling). Tomorrow, I will try to get together my existing files and upload a final full package contribution as an update to 5.0.1. To those still having problems, keep at it. The answer is within the scripts and the forums. You just have to find it. I am not a coder and beyond getting the calls to go through by following API documentation and making the adjustments necessary for those symbols, I would be totally stumped. I have no idea why the script would work in my oscommerce site and not someone else's (except possibility of installation error, server differences, etc.).

 

If anyone wants to see what my final script is working like on my site, the checkout does not require customers to be logged in, so you can see it in action without registering. Just add something to the cart and go to checkout and enter an address. The website is fulluvscents.com.

 

Have a great day (or night if that is the case).

Link to comment
Share on other sites

Debbie or Jetta,

 

If I send you my usps.php file can you tell me where to start. I feel i might have done manual updates everytime a chance came and might have an older version. I want to know if I should just go ahead and update to it 5.0.1 and start talking the same language that you guys are talking. I do have the domestic rates working at this time its just the international rates that are not working.

 

Thanks

 

Amit

 

Amit, 5.0.1 is not a fully functioning version. I posted a fuller and better script a few posts back and THEN I posted modifications to that script.

 

I'm going to try to get a full package added to the contributions tomorrow. Hopefully, it'll work as well for others as it does for me.

Link to comment
Share on other sites

Amit, 5.0.1 is not a fully functioning version. I posted a fuller and better script a few posts back and THEN I posted modifications to that script.

 

I'm going to try to get a full package added to the contributions tomorrow. Hopefully, it'll work as well for others as it does for me.

I guess I will wait for the full package then and just do a clean install. Until then I have domestic working.

 

Will be checking.

 

Amit

Link to comment
Share on other sites

I guess I will wait for the full package then and just do a clean install. Until then I have domestic working.

 

Will be checking.

 

Amit

I think I will do the same. I've been copying all of these interim updates - especially the "special html characters" fix in my case. However, I've been a bit intimidated at the prospect of organizing all of this and trying to keep it straight, but still maintain a clean rollback if it doesn't work (my Domestic is still doing business).

 

Now that I read that fulluvscents is still working on a complete contrib, I will wait. Thank you, Jetta - you are a godsend!

Link to comment
Share on other sites

So does anyone have the international shipping working without errors with USPS shipping yet. My domestic is fine but international shows errors ?

 

Amit

 

I have had it working in production for 1 full day with no problems. I am using some of the domestic and some of the international shipping methods successfully.

 

Previously I was running 3.0.2. I upgraded to "USPS Methods 5.0.1 - bug fix" by copying just the usps.php file to the catalog/includes/modules/shipping directory. I checked to make sure no other usps module was in the directory.

 

At first I had the problem with the htmlspecialchars_decode failing and I fixed it as follows:

 

Before:

  $service = htmlspecialchars_decode($regs[1]);

 

After:

  if ( !function_exists('htmlspecialchars_decode') )
 {
  function htmlspecialchars_decode($text)
  {
return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
  }
 }
 $service = htmlspecialchars_decode($regs[1]);

 

The other files specified to be modified in USPS Methods v3.0.2 were not changed They remain as modified in USPS Methods v3.0.2.

 

This may be of help to some people who need to get back up quickly while waiting for the wizzards to come up with a working v5.0 with all the bells and whistles. I will probably install that version when it is stable.

Link to comment
Share on other sites

perfect.. let me gather every thing now.. the only thing I see and it is just going to take some testing is the handling boxes don't really conicide with the rates.

 

 

Express Mail -- added $5 - that was correct

Express Mail Flat Rate Envelope -- added $4 it added it to Priority Package

Priority Mail -- ZERO -

 

I am getting rates, transit times, handling being added everything showing to click and unclick in admin.. wooohoooo

 

THANKS EVERYONE!!!

:lol: :D

Edited by wkdwich

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

Link to comment
Share on other sites

Thank you THANK YOU everyone!! Together we conquered the world - well USPS for right now anyway..

 

I have redone the install file, adding notes from various older installs, and ALL needed modifications. As noted in the readme - you may or may not have to do these changes.. be very careful.. make copies of your files and BACKUP your database before hitting this project.

 

I do belive this set of files is the very best of all worlds, and will function for everyone (fingers crossed here)

 

Mod loaded to:

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

USPS methods 5.0.2

 

peace - out - bed now :)

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

Link to comment
Share on other sites

I can't ever leave well enough alone :)

 

I cleaned up the modules/shipping/usps.php to make it easier for me to read.

 

I fooled with and straightened out the handling fee issue - now the boxes absolutely correspond with the rate options

 

I moved the transit time to the language file because I want to say how long it will take to get there not the PO :)

 

I also forgot to change the version number in the file, so I did that

 

will upload to the contribution file now, again as a full package

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

Link to comment
Share on other sites

I can't ever leave well enough alone :)

 

I cleaned up the modules/shipping/usps.php to make it easier for me to read.

 

I fooled with and straightened out the handling fee issue - now the boxes absolutely correspond with the rate options

 

I moved the transit time to the language file because I want to say how long it will take to get there not the PO :)

 

I also forgot to change the version number in the file, so I did that

 

will upload to the contribution file now, again as a full package

 

WOW, WOW!

 

Thanks Debbie for all your hard work!

 

I'll wait a little for the dust to settle because my current setup works for my limited number of shipping methods, but I am looking forward to installing your update. It's wonderful to know that we are getting through the 2011 USPS changes. I dread the 2012 changes, but that's a whole year from now!

Edited by pbolyn
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...