Jump to content
fulluvscents

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

Recommended Posts

Thanks Jim! This got rid of the <sup></sup> on my domestic and got me back my Intl rates. My only question, is there a way in this module to get rid of it displaying the weights to customers?

 

Answered my own question after some tinkering around.....Changed line 232 from

'module' => $this->title . ' ' . $this->pounds . ' lbs, ' . $this->ounces . ' oz',

to

'module' => $this->title . ' ',

Share this post


Link to post
Share on other sites

Thanks Jim! This got rid of the <sup></sup> on my domestic and got me back my Intl rates. My only question, is there a way in this module to get rid of it displaying the weights to customers?

 

yes and its quite simple actually:

 

FIND:

      $this->quotes = array (
       'id' => $this->code,
       'module' => $this->title . ' ' . $this->pounds . ' lbs, ' . $this->ounces . ' oz',

REPLACE WITH:

      $this->quotes = array (
       'id' => $this->code,
       //'module' => $this->title . ' ' . $this->pounds . ' lbs, ' . $this->ounces . ' oz',
       'module' => $this->title,

 


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

You can also check this file with a compare tool it is a bit different. Of course you would have to rename it.

As well as renaming the above file you will have to remove spaces at top and bottom or get an headers already sent error. I will attach the file without the spaces here. This is the 5.2 methods file already renamed.

usps.php

Share this post


Link to post
Share on other sites

Is there a way to add estimated shipping times in there? I normally have:

First Class Mail (2-5 Days)

Priority Mail (1-3 Days)

 

Would love to get those estimates back on there.

Share this post


Link to post
Share on other sites

 

I agree! Both these methods are open to more problems that use way more time to fix than I have. I am thankful for some really good coders out there that help me out. Your idea would be great if it can be done and be able to use it across the multiple versions of Oscommerce or Max.

 

Totally agree this method of attack makes perfect sense.. I could be very mistaken but I do believe Jetta fullUVSCENTS was working in that direction at one point.. it really is a shame Jetta disappeared, she was really good at making these things work and all the bells & whistles too.. I enjoyed testing for her


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

@@Jayman11

Probably. USPS is returning their alleged delivery times with some of the services, but it's embedded in the service name, so this module requires that we strip them out. What you would get is something like

Priority Mail 2-DayTM Small Flat Rate Box

I'm pretty much giving up on this module. It's just too much of a pain to hack it into anything like a reasonable solution. I'm going to go for a complete rewrite.

 

@@bkpie

@@wkdwich

I've decided to do it. I don't know how long it will take with everything else I have going, but I'm going to give it a shot. I'll probably borrow some of Jetta's code, since I like the way this module did the service selection etc. Everything else will be rewritten from scratch. It will probably require PHP 5.2 or higher, but should work with osC 2.2 and 2.3.

 

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, happy to test.. just let me know...


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

So, we set up 3 modules for zone rates, one for Standard Post, one for Priority Mail (both domestic and international in one module), and one for Express Mail (again, both domestic and international in one module). It took about an hour to define the prices by weight for each service/zone, but it's all loaded, working fine, each zone has our handling fee, and BEST OF ALL, we do not have to connect to the USPS for it to work! No matter what the USPS does in the

 

krdito, is there any possibility of you sharing?? I do have some very simple table rates set up and set to FALSE normally, so I can switch them on in times like this or when the USPS servers go down for days.. yours however sound much more intense :)

 

 


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

Thank you for this. I have to confess that I never bought into the contrib that this topic is based on and continued to use USPS Methods. fulluvscents did excellent work a couple of years ago - along with wkdwich, I might add, in fixing the annual

 

<bow> thanks..

Very curious though.. right now I am using:

http://addons.oscommerce.com/info/8327 USPS Rate V4 Intl Rate V2 - v.1.0

Jetta had a full hand in that one

then there is this one:

http://addons.oscommerce.com/info/8403 USPS Rates ServerV4 (for osc2.2)

which she also had a hand in

 

 

Then there is:

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

which jetta also had her mitts into :) this one contains both the 5.2x and the 6.1x versions..

 

so which one are you using??


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

I've started development on a revised USPS module that won't break every time USPS changes the services names. Anyone who is interested is welcome to visit this 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

I was running USPS Methods 5.2.0 and it was working for Domestic, but not for International. So luckily I wasn't scrambling too hard :)

 

I installed the file contained in the following post.

http://forums.oscommerce.com/topic/383307-usps-rate-v4-intl-rate-v2-official-support-thread/page__st__600#entry1677015

 

So far so good! I have Domestic and International shipping options that hold all the way through checkout. :D

 

I notice that the Delivery Estimates are 'Scrubbed' from the responses before being displayed to the customer. Why is this? I prefer to show these.... Could someone comment on this?

Share this post


Link to post
Share on other sites

The new delivery times are stuffed into the middle of the Service names. Since these modules are using the Service names to select which services are shown to the customer, they had to be stripped out. Could probably be put back, but that's more work for little gain. I intend to fix that problem with my rewrite of this module, if you can wait around for that.

 

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

@@chrisytsma

the USPS Rate V4, Intl Rate V2 version you are running now does not have the transit time as an option to show or not.. that was in the 5.2 version. I did like it also, but found it caused a bit of confusion with my customers.. I padded the T&D a little and it helped.. but at some point I moved to this version and that's that.. poof its gone..


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

The new delivery times are stuffed into the middle of the Service names. Since these modules are using the Service names to select which services are shown to the customer, they had to be stripped out. Could probably be put back, but that's more work for little gain. I intend to fix that problem with my rewrite of this module, if you can wait around for that.

 

Regards

Jim

 

OK Jim, makes sense, USPS Stinks!! I'll keep an eye out on your development contrib. FYI, the USPS methods contrib had a lot of nice options available that this one does not, if you are looking for a baseline of available options to write into your contrib. Thanks for the help!!

Share this post


Link to post
Share on other sites

Please suggest the ones that you think are useful over in the development thread. I already have a features list going. I can't promise anything, but if people really want something I'll probably add it in.

 

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 am close to getting usps working, but not quite there yet.

 

There is a lot of confusion about which version to use, and to the best of my ability, I have steadfastly kept plugging away on this. I refer to it as USPS Methods 6.1c. Here are the lines at the top. It is the latest Methods 6.1c that uses USPS_methods_utility.php in the Admin folder.

 

<?php

/*

$Id: usps.php 6.1 by Kevin L Shelton on September 7, 2011

+++++ Original contribution by Brad Waite and Fritz Clapp ++++

++++ Revisions and Modifications made by Greg Deeth, 2008 ++++

Copyright 2008 osCommerce

Released under the GNU General Public License

//VERSION: 5.2.1 ALPHA LAST UPDATED: January 23rd, 2011 by Fulluv Scents

*/

 

// Incorporate the XML conversion library

if (PHP_VERSION >= '5.0.0') { // PHP 5 does not need to use call-time pass by reference

require_once (DIR_WS_CLASSES . 'xml_5.php');

} else {

require_once (DIR_WS_CLASSES . 'xml.php');

}

 

if ( !function_exists('htmlspecialchars_decode') ) {

function htmlspecialchars_decode($text) {

return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));

}

}

// Sets up USPS Class

class usps {

 

// Sets Variables

var $code, $title, $description, $icon, $enabled, $countries;

 

function usps() {

global $order, $packing;

$this->code = 'usps';

$this->title = MODULE_SHIPPING_USPS_TEXT_TITLE;

$this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION;

$this->icon = DIR_WS_ICONS . 'shipping_usps.gif';

$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);

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;

}

}

if ($check_flag == false) {

$this->enabled = false;

}

}

 

 

My shipping is simple, in that I only need one rate, Standard Post, and my problem is that I cannot get it to go to checkout_payment.php.

 

I think the reason is due to title not getting through, or even defined. In the first part of the code above

 

$this->title = MODULE_SHIPPING_USPS_TEXT_TITLE; is not in the configuration table. And neither is the next line

 

$this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION;

 

In the code there are several other spots where title is referenced, but when I check the values, they are empty.

 

One would think that by creating a new entry in the config table, problem solved, except that didn't work. The funny thing is that the fedexwebservices module also has very similar MODULE definitions and is also missing those entries in the config table, but it works. I have a feeling, that is the root of this problem.

 

I have managed to tweak this so that Standard Post with the requisite trade mark symbol gets written onto the webpage right where it is supposed to be, and still no luck. When I check that title value, it is empty.

 

When I look at all the other information, it is perfect. Name, addresses, weight, box size, and every thing else. The correct shipping rate!

 

The handling charge is disabled because it was giving out funny numbers, and the variable that sets the handling charge only seems to be able to process whole numbers. I tried hardcoding it to a decimal and it would round to the nearest whole number.

 

Here are the arrays from usps and Fedex for comparison.

 

USPS ARRAY

 

Array (

[0] => Array (

[id] => usps [module] => United States Postal Service 

[methods] => Array ( [0] => Array (

[id] => Standard Post®

[title] =>

[cost] => 25.48 ) )

[icon] => <img src="images/icons/shipping_usps.gif" border="0" alt="United States Postal Service " title=" United States Postal Service  " width="50" height="13"> )

 

 

FEDEX ARRAY

 

[1] => Array (

[id] => fedexwebservices [module] => FedEx

[methods] => Array ( [0] => Array (

[id] => FEDEXGROUND

[title] => Fedex Ground

[cost] => 32.7 ) )

[icon] => <img src="images/icons/shipping_fedex.gif" border="0" alt="FedEx" title=" FedEx " width="50" height="13"> ) )

 

 

 

The other very odd thing is that the XML quote response is incomplete, with the last part seemingly left hanging. It might be the email system, but the FedEx one comes back complete. Here is an example.

 

 

<?xml version="1.0"?>

<RateV4Response><Package ID="0"><ZipOrigination>48195</ZipOrigination><ZipDestination>94591</ZipDestination><Pounds>8</Pounds><Ounces>7.2</Ounces><Container>RECTANGULAR</Container><Size>LARGE</Size><Machinable>TRUE</Machinable><Zone>8</Zone><Postage CLASSID="4"><MailService>Standard Post&lt;sup&gt;&#174;&lt;/sup&gt;</MailService><Rate>22.48</Rate><SpecialServices><SpecialService><ServiceID>9</ServiceID><ServiceName>Certificate of Mailing</ServiceName><Available>true</Available><AvailableOnline>false</AvailableOnline><Price>1.20</Price><PriceOnline>0</PriceOnline></SpecialService><SpecialService><ServiceID>1</ServiceID><ServiceName>Insurance</ServiceName><Available>true</Available><AvailableOnline>false</AvailableOnline><Price>1.95</Price><PriceOnline>0</PriceOnline><DeclaredValueRequired>true</DeclaredValueRequired><DueSenderRequired>false</DueSenderRequired></SpecialService><SpecialService><ServiceID>13</ServiceID><ServiceName>USPS Tracking&lt;sup&gt;&amp

 

Note how it is missing the closing tag. Every response is like that, so something is off.

 

I think Kymation's work and thoughts on writing the usps module from scratch are great, We need something that doesn't blow us up when the crats get creative. I am also intrigued by Krdoto's solution and setting up shipping zones and avoiding this frequent nightmare.

 

It has been a long 4 days and counting. Goodnight

Share this post


Link to post
Share on other sites

I was using 6.1c and went back to 5.2. Just changed the language file to the 5.2 and includes module file that I uploaded in this thread as well as in the USPS Methods contrib. found here http://addons.oscommerce.com/info/487 You may have to check your files and compare to the 5.2 install since this does not use the utility or xml if you want that. But All seems to work so far.

Share this post


Link to post
Share on other sites

OSC Version 2.2 and won't install.. hit install no options.. Can'e un-install.. In store go to checkout shipping white screen

Share this post


Link to post
Share on other sites

I was using 6.1c and went back to 5.2. Just changed the language file to the 5.2 and includes module file that I uploaded in this thread as well as in the USPS Methods contrib. found here http://addons.oscommerce.com/info/487 You may have to check your files and compare to the 5.2 install since this does not use the utility or xml if you want that. But All seems to work so far.

I was going to try this myself, but my hosting services has had my site down for most of the day, today. :(

 

I went to USPS Methods 6.1a back in February in response to the last changes. Are you saying all that needs to be updated is the usps.php in languages/english and then the usps.php in modules/shipping? I'm not sure how I can actually go backwards to 5.2. I had 5.0.2 before.

 

BTW, I've had to manually punch the settings into the database ever since 6.1a, anyway.

Edited by TomB01

Share this post


Link to post
Share on other sites

I tried 5.2 without success and the other night went so far as to try Rate V4, that is now being abandoned. It would install OK, but a test buy made the page disappear. Hours were spent trying to get it to go.

 

I like 6.1c due to the way I can define the packages by size.

 

I have zeroed in on why it won't get past the checkout_shipping.php page with usps, and it has to do with a missing piece of information called title.

 

This is the line in checkout_shipping.php that calls for it.

 

<td class="main vam" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>

 

 

Here is the html from firebug that shows the two shipping modules (usps and fedex) . The fedex module works properly and has the value "FedEx Ground" for title.

 

The html above the <DOCTYPE definition comes from variable print commands inserted into the fedexwebservices.php and usps.php files

 

<!-- <pre>FedEx</pre> --> variable $quote['id'] from fedexwebservices.php this is used for the heading to the left of the FedEx logo

<!-- <pre></pre> --> variable $shiptitle from usps.php

<!-- <pre>Standard Post®</pre> --> variable $quote['id'] from usps.php In usps, I think this should be "United States Postal Service", but there is a glitch. On the webpage it reads United States Postal Service, but this variable here is

Standard Post®

 

<!-- <pre></pre> --> variable $title from usps.php

<!-- <pre>16.58</pre> --> variable $cost from usps.php this is correct.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

<tr class="moduleRow" onclick="selectRowEffect(this, 0)" onmouseout="rowOutEffect(this)" onmouseover="rowOverEffect(this)">

<td width="10">

<td class="main vam" width="75%">Fedex Ground</td> This is the result of the line referenced above in checkout_shipping.php

<!-- <pre></pre> --> variable $j['title']

<!-- <pre>Array ( [0] => Array ( [id] => FEDEXGROUND [title] => Fedex Ground [cost] => 24.6 ) ) </pre> --> variable $quotes['i']['methods']

<!-- <pre>2</pre> --> variable $n - counts the number of shipping modules

<td class="main vam">$24.60</td>

<td class="main vam" align="right">

<td width="10">

</tr>

 

<tr class="moduleRow" onclick="selectRowEffect(this, 1)" onmouseout="rowOutEffect(this)" onmouseover="rowOverEffect(this)">

<td width="10">

<td class="main vam" width="75%"></td> This is the result of the line referenced above in checkout_shipping.php

<!-- <pre></pre> --> variable $j['title']

<!-- <pre>Array ( [0] => Array ( [id] => Standard Post® [title] => [cost] => 16.58 ) ) </pre> --> variable $quotes['i']['methods']

I think it should read Array ( [0] => Array ( [id] => United States Postal Service [title] => Standard Post® [cost] => 16.58 ) )

 

<!-- <pre>2</pre> --> variable $n - counts the number of shipping modules

<td class="main vam">$16.58</td>

<td class="main vam" align="right">

<td width="10">

</tr>

 

I will keep trying to make it work, but if someone has already solved this, I would love to read about it.

Share this post


Link to post
Share on other sites

I was going to try this myself, but my hosting services has had my site down for most of the day, today. :(

 

I went to USPS Methods 6.1a back in February in response to the last changes. Are you saying all that needs to be updated is the usps.php in languages/english and then the usps.php in modules/shipping? I'm not sure how I can actually go backwards to 5.2. I had 5.0.2 before.

 

BTW, I've had to manually punch the settings into the database ever since 6.1a, anyway.

I followed the install instructions on fullofscents 5.2 version and found most the code was already in the files correctly. I think I had to change one thing, If you have the code by Deeth in their you may be ok. I did not test it with 6.1a I reuploaded a new file to the contribution site as ridexbuilder made me aware I grabbed the wrong file and it was in caps. He also cleaned it up Go back to the link above and download the cleaned up one and try it. Just back up your current module file and language file.

Share this post


Link to post
Share on other sites

OSC Version 2.2 and won't install.. hit install no options.. Can'e un-install.. In store go to checkout shipping white screen

If you are trying to uninstall your usps module then in your browser when logged into your store try this (substitute your store address and directories you use). https://www.yoursitenamehere.com/admin/modules.php?set=usps&action=remove

Edited by bkpie

Share this post


Link to post
Share on other sites

OSC Version 2.2 and won't install.. hit install no options.. Can'e un-install.. In store go to checkout shipping white screen

 

You probably have left over entries in the database -> configuration table

so a simple search should show you if there are or are not any entries there.. if there are none, then you have another issue going on.. but exactly what you are saying is what happened to me and the search ten removal of the left over entries worked wonders.


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

I wish everyone who is trying to use USPS Methods 5.2.1 and later, would post to Add-Ons - General Add-Ons Support -

[Contribution] - USPS Methods this would eliminate so much confusion because this is the proper thread for USPS Methods. Where is the moderator to move people into the proper thread?

 

With that being said, before I write anymore on this, will those kind individuals who work on the 5.2.1 contribution, post to the proper thread? This way we can concentrate our efforts without having to read other people's posts regarding a separate module. And they will not need to read our situation confusing them.

 

Thank you all

Alan

Edited by spiritalan

Production:
osCommerce V. 2.3.4BS
VPS Box

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

×