Jump to content
fulluvscents

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

Recommended Posts

@@mysalon Read up in this thread a bit -- I posted a fixed file.

 

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'm still trying to 'fix' the problem with the International Small Flat Rate Box which isn't showing up. I reinstalled the module and other than this one option, seems to be working fine. I'm attaching my revised xml file. I didn't see the International Small Flat Rate Box listed although there are several International small flat rate envelopes. Can I just switch one of these (rates are the same) to say International Small Flat Rate Box? If so, how? The usps.php file seems fine....

 

Thanks.

K.

new5.xml

Share this post


Link to post
Share on other sites

I only fixed the module for the changes that the USPS made in January. I didn't fix anything else, or add any services that were not already there.

 

If the Flat Rate service that you need isn't included, you'll have to add it. Sorry, but I don't have any more time to put into this right now.

 

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 have just uploaded an updated version of this mod for osC v2.2 users: http://addons.oscommerce.com/info/8702

 

Use the included upgrade.txt file.

 

Updates include:

 

Changed Parcel Post® to Standard Post®

Changed First-Class International Parcel to First-Class Package International Service™

Fixed Priority Mail® International Small Flat Rate Box

Fixed Commercial Rate for international rates

Fixed shipping weight round issue to 3 decimal places

Share this post


Link to post
Share on other sites

Okay, for anyone who's keeping an active eye on this thread, where can I find the most up-to-date and complete package for this contribution, please? There are all manner of updates on here, but reading 21 pages of posts and information for what's done, what's being done, etc., does not help me find the complete contribution. Can someone lay some bread crumbs, please?

Share this post


Link to post
Share on other sites

@@ostomyarmorwm

 

For this add on: http://addons.oscommerce.com/info/8327

 

I am using this version:

 

USPS Rate V4 Intl Rate V2 - v.1.7 - FIX and I've had no problems.

 

Except..the recent change by the post office requires a file modification that @@kymation provided recently in this topic, so you'll need to find that.


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

Hey all,

I've got the latest USPS installed on 2.3.3 and First Class doesn't show up, regardless of the weight I use.

 

I've followed this thread - and it's a long one - so I might have missed somethig. I *ONLY* ship National - no Int. - here in the US.

 

$5.00 Shipping for an $8 - $10 item seems a bit high. Stamps.com - for the exact same item shows First Class at like $2.

 

Ideas???


Chris Anderson

Co-Founder

Leander Knives

 

Share this post


Link to post
Share on other sites

I forgot to mention I found where ozs are used as fractions (1 oz = .01, etc) and I have made all weights to be the appropriate fractions, where needed.


Chris Anderson

Co-Founder

Leander Knives

 

Share this post


Link to post
Share on other sites

Hey all,

I've got the latest USPS installed on 2.3.3 and First Class doesn't show up, regardless of the weight I use.

 

I've followed this thread - and it's a long one - so I might have missed somethig. I *ONLY* ship National - no Int. - here in the US.

 

$5.00 Shipping for an $8 - $10 item seems a bit high. Stamps.com - for the exact same item shows First Class at like $2.

 

Ideas???

 

Make sure you use the fix posted by @@kymation earlier in this thread.


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 mention I found where ozs are used as fractions (1 oz = .01, etc) and I have made all weights to be the appropriate fractions, where needed.

 

i use 1 oz at 1/16 = 0.0625, but also check your package tare weight. admin>configuration>shipping/packaging. tare weight is added to the products weight for shipping purposes


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 tried finding it - what post number? or what page? I looked all through the 2013 - but again a TON of reading. :)


Chris Anderson

Co-Founder

Leander Knives

 

Share this post


Link to post
Share on other sites

I tried finding it - what post number? or what page? I looked all through the 2013 - but again a TON of reading. :)

 

this one is jims fix

 

it was for an international shipping issue i think though, so i'd focus on your oz calculations and tare setting in the shop. if they are ok and you have the above installed...not sure where else to tell you to look


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

OK - JUST to be sure, I took his latest test code he posted and added it. Still not First Class (Letter or Parcel). I've ensured that BOTH of those are selected... :(


Chris Anderson

Co-Founder

Leander Knives

 

Share this post


Link to post
Share on other sites

Tare Weight got me. I had set it to 5 during setup and testing and never set it back. Thank you TONS!!! :)


Chris Anderson

Co-Founder

Leander Knives

 

Share this post


Link to post
Share on other sites

Hi, I'm new to oscommerce. I'm using 2.3.3. I'm having trouble with the shipping module. I tried adding it multiple times, followed all the instructions for this add-on but the shipping options don't show up when you go to checkout. Also, when registering with usps api, when it asks for which domain you will be using usps api, can i simply put, example, domain.com? or does it have to be domain.com/catalog? could that be the issue? please help, very lost as to why it won't show up.

Share this post


Link to post
Share on other sites

I was using the USPS Rate V2....v1.7 for the longest time. However, I have noticed that my customers aren't able to use the Domestic First Class option. The option is shown without any words beside it, and when selected the most expensive option is added instead. So I upgraded to http://addons.oscommerce.com/info/8702 today.

 

Here are my issues: A) the new files are WAYYYY smaller than the old files (yes, I double and triple checked them) B) the new files are giving me the following error.

Fatal error: Call to undefined function tep_cfg_usps_services()

 

I know this is basically saying that there is something missing, but I do not see anything that could be missing in the add on files.

 

Am I completely spacing this? I normally can pin point the error pretty quickly.

Share this post


Link to post
Share on other sites

@@simplebaby

 

I don't use that exact addon but in mine I had to add a function to admin/includes/functions/general.php. Sounds like you missed the part of the install referencing that new function.


Matt

Share this post


Link to post
Share on other sites

Found it. Everything was in the general.php file, but something got all wonky when I saved. It moved the start and end comment lines down and up one. Thus canceling out those statements.

Share this post


Link to post
Share on other sites

Some time ago I had version 1.7 of this module working just fine. Now when I select an Extra Service in Checkout (checkout_shipping.php) I get a JSON parse error. Safari indicates "JSON Parse error: Unrecognized token '<'".

 

I also had modified the handling of the radio buttons to use AJAX to save their state on the server so that they would not reset on a reload. That was also working, but now clicking a radio button also get the same JSON Parse error.

 

I'm not sure what might be causing this or where to look. Here's the javascript functions that perform the AJAX POST, checkboxSet and radioSet (modified from the original):

 

function checkboxSet()
{
 thisParent = $(this).parent().parent().parent();
 if (thisParent.attr('data-module') == 'usps')
   $.ajax(
   {
  url: window.location.pathname,
  cache: false,
  dataType: 'json',
  type: 'POST',
  contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  data: 'ajax=addUspsServices&shipping=' + thisParent.attr('data-module') + '_' + thisParent.attr('data-method') + '&' + decodeURIComponent($('[type=checkbox]', thisParent).serialize()),
  success: function (data)
  {
    $('#shippingCost', thisParent.parent()).html(data.cost);
  },
  error: function(XMLHttpRequest, textStatus, errorThrown)
  {
    if (XMLHttpRequest.responseText == 'session_expired') window.location = '';
    alert('Error: ' + textStatus + errorThrown);
  },
   });
}
function radioSet()
{
 $(this).parent().parent().siblings().removeClass('moduleRowSelected');
 $(this).parent().parent().addClass('moduleRowSelected');
 $('#shownString, #customerString, #shownStringHide, #customerStringHide, #shownStringInfo, #customerStringInfo, #shownStringShow, #customerStringShow', $(this).parent().parent().parent()).hide();
 $('#shownString, #customerString, #shownStringShow, #customerStringShow', $(this).parent().parent()).show();
 $('[type=checkbox]').bind('click', checkboxSet);
// save selected mod START
 thisParent = $(this).parent().parent().parent();
 $.ajax(
 {
   url: window.location.pathname,
   cache: false,
   global: false, // prevents #loader "Processing" dialog from displaying when radio button selected
   dataType: 'json',
   type: 'POST',
   contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
   data: 'ajax=radioSetShipping&' + decodeURIComponent($('[type=radio]', thisParent).serialize()),
   error: function(XMLHttpRequest, textStatus, errorThrown)
   {
  if (XMLHttpRequest.responseText == 'session_expired') window.location = '
';
  alert('Error: ' + textStatus + errorThrown);
   },
 });
// save selected mod END
}

 

...and here is the php code for the server side (again modified from the original):

 

 if (isset($_POST['ajax']))
{
 if ($_POST['ajax'] == 'radioSetShipping')
 {
   $shipping_id = $_POST['shipping'];
   list($module, $method) = explode('_', $shipping_id);
   if (isset($_SESSION['shipping_quotes']))
   {
  foreach ($_SESSION['shipping_quotes']['quotes'] as $shipping_quote)
  {
    if ($shipping_quote['id'] == $module)
    {
	  foreach ($shipping_quote['methods'] as $shipping_method)
	  {
	    if ($shipping_method['id'] == $method)
	    {
		  if ($shipping_id == 'free_free')
		  {
		    $shipping_method['title'] = FREE_SHIPPING_TITLE;
		    $shipping_method['cost'] = '0';
		  }
		  $shipping = array('id' => $shipping_id,
'title' => (($free_shipping == true) ? $shipping_method['title'] : $shipping_quote['module'] . ' (' . $shipping_method['title'] . ')'),
'cost' => $shipping_method['cost']);
		  break;
	    } // end if ($shipping_method['id'] == $method)
	  } // end foreach ($shipping_quote['methods'] as $shipping_method)
	  break; // found shipping quote in session
    } // end if ($shipping_quote['id'] == $module)
  } // end foreach ($_SESSION['shipping_quotes']['quotes']...
   }
   exit;break;
 } // if ($_POST['ajax'] == 'radioSetShipping'
 elseif ($_POST['ajax'] == 'addUspsServices')
 {
   if (!tep_session_is_registered('uspsServices')) tep_session_register('uspsServices');
   $uspsServices = 0;
   foreach($_POST as $val)
  if (is_numeric($val)) $uspsServices += $val;
   if (isset($shipping['cost']))
  $return['cost'] = $currencies->format($shipping['cost'] + $uspsServices);
   echo json_encode($return);
   exit;break;
 }
} // if (isset($_POST['ajax']

 

Anyone have any ideas?

Edited by DrGlitch

Share this post


Link to post
Share on other sites

I have installed the USPS module and create an account through USPS and went live with it and I am able to on get library mailing options and can't get quotes for canada I have tried several things without success. all canada gives me is a blank screen no quote and doesn't allow me to go to checkout screen. Please help spent 3 days trying to fix. have even restore my database and website and started over but didn't fix issue.

Share this post


Link to post
Share on other sites

I am getting this error message after installing the latest usps shipping module discussed here. None of my modules, shipping, order total even show up. What is causing this error message and possible fix?:

 

Fatal error: Call to a member function on a non-object in /home/chuck/htdocs/store/admin/modules.php on line 17


- Chuck

External links are not allowed on the osC forum. Thanks

Share this post


Link to post
Share on other sites

I am not sure if thiss issue has been resolved or addressed in this forum. If it has I apologize, in advance.

 

I have been very frustrated by simple misunderstandings in setting up shipping with the USPS shipping module that was initially part of Oscommerce 2.3 and then again after installing the updates for the changes that USPS has made and all the confusion about Methods and the different versions.

 

I finally settled on trying to update using this Addon and was once again confused by the simplest of issues which would have been made much simpler if there was some error messages returned by the new USPS module.

 

I spend many hours trying to figure out why I did not get any results returned after installing the updates and registering with the new USPS registration process and trying to test some simple orders.

 

All of my problems were fairly simple in nature, but either I was too stupid to read the directions and setup carefully or the information was not clear enough for my simple brain to understand.

 

Even after I got the module to return shipping charges for some orders, other orders just returned a blank shipping section for USPS, while other flat rate and per item pricing worked fine. I finally found a very short line in the forum that said the "USPS errors were silent" meaning that if an error occurred you had to go into the code and enable a little known line of code that would email a confusing block of information to the store owners email.

 

I decided that something had to be done to make it possible to have the customer understand that they might have entered their zip code incorrectly or the store owner neglected to put in their shipping zip code or some similar error. So I think I figured out a fairly simple addition to the usps.php module to return some error information when it fails to process the request correctly.

 

Anyway, I hope that maybe this little piece of code can be added to the original / updated addon package or that other users find it useful to add to their stores usps.php module so they and their customers can see when a usps shipping request does not correctly process a pricing request.

 

This is the change to be made to the usps.php module to add error message display for

USPS Rate V4 Intl Rate V2 - v.1.7

 

 

In the program usps.php replace the following two lines between the --- lines

 

---

$uspsQuote = $this->_getQuote();

if (isset($uspsQuote['Number'])) return false;

---

 

It is possible that the 2nd line might not be there depending on the version of usps.php you have installed. Either way replace it

with the following group of lines between the --- lines

 

 

---

// billv BEGIN fix USPS error information for the checkout_shipping.php error display

//

 

if (isset($uspsQuote['Number']) || isset($uspsQuote['Package'][0]['Error']) )

{

$uspsQuote['module']="United States Postal Service";

if (isset($uspsQuote['Number']))

{$usps_msg = $uspsQuote['Description']; }

else

{$usps_msg = $uspsQuote['Package'][0]['Error']['Description'];}

$uspsQuote['error']= $usps_msg;

return $uspsQuote;

}

// billv END Error msg changes 3/25/13

---

Share this post


Link to post
Share on other sites

Hello,

 

I have installed this module, but only after doing so did I realize that it somehow did not install correctly and the original USPS module was what was showing up.

 

I'm a coder, not on Jetta's level, but I know PHP pretty well, I read and re-read the installation instructions and proceeded with the installation.

 

In the instructions, it says this:

 

"For install on fresh OSC - open Drop_On_Top and do your thing

For install on modified OSC..."

 

Well, what sort of modifications make a 'modified OSC'? Specifically, the only modifications I have done to my store are visual changes. Background color, logos, styling to make the store look more like the website in which it resides. I have NO 3rd party modules installed on this store, for instance.

 

So given that, I used the files in the, 'Drop_On_Top' folder and installed them as they are. I looked through the instructions (which need to be written in a clearer manner, IMO. The tech writer in me was puzzled on a number of occasions) and compared the files in the 'Drop_On_Top' folder to the code changes in the instructions, and unless I'm missing something, the changes are already part of the files in the, 'Drop_On_Top' folder. Am I wrong about this?

 

At any rate, I realized the module was not correctly installed when I noticed no shipping options, just 'Library shipping'.

 

PLEASE NOTE: I followed the instructions regarding uninstalling the existing USPS module in the admin panel. I did that, then copied all of the files in the, 'Drop_On_Top' folder into their appropriate locations, and all said and done...the new module was not in place.

 

Perhaps I'm daft and am missing some really obvious thing here...any help would be greatly appreciated.

 

Thanks!!!

 

Cheers,

 

DesertCoder

Edited by DesertCoder

Share this post


Link to post
Share on other sites

Hi, I'm new to oscommerce. I'm using 2.3.3. I'm having trouble with the shipping module. I tried adding it multiple times, followed all the instructions for this add-on but the shipping options don't show up when you go to checkout. Also, when registering with usps api, when it asks for which domain you will be using usps api, can i simply put, example, domain.com? or does it have to be domain.com/catalog? could that be the issue? please help, very lost as to why it won't show up.

 

Just enter 'domain.com' the subfolder for /catalog/ (I rename mine as I prefer store) isn't necessary. Also, the phone number the USPS provides in the email is the best way to go. Just call them give them your ID and tell them you are using OSC and they switch you over to the production servers. The people are SUPER polite and helpful and will explain everything to you.

 

Hope that helps!

 

Cheers,

 

DesertCoder

Share this post


Link to post
Share on other sites

This is regarding the contribution “USPS Rate V4 Intl Rate V2 - v.1.7 - FIX”, uploaded Feb. 12, 2012. Can someone explain to me why the changes in the readme.txt file for /checkout_shipping.php are not the same as in the checkout_shipping.php files found in Files_to_Modify and Drop_On_Top folders for the catalog directory? This is very confusing.

 

I have been working on my new OSC 2.3.3 store in development to take the place of my 2.2RC2a store but after working for about 3 days in trying to make this USPS contribution work I have come to the end of my wits. I have used the Drop_On_Top files, it does not work. I have used the new files and Files_to_Modify by comparing originals and modifying them and it still does not work. I have followed the readme.txt file to the letter and modifying original files and it still does not work. I have taken files from another with the same contribution from a friend, (whose store is working with this USPS contribution) with the update of January 2013 and replaced my files with them and I still receive on checkout a blank page. HELP!!!

 

I removed the existing USPS Module in Admin, then upload proper files, then install new module, then configure the module. The best response that I have gotten is when I manually make the modifications of the originals using the readme.txt file. At least I can configure it in Admin, but on the Front end on checkout I get a blank screen.

 

I know there is more than one question in this post. Please help. I am an OSC veteran user and cut and paster but not a coder.

 

Thanks, 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

×