Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] - USPS Methods


Recommended Posts

Hello,

 

I recently installed this and started to configure it, but I am increasingly getting the feeling that I may be duck hunting with a tank. I want to offer two flat-rate shipping options,

 

Option 1- USPS priority mail $0 additional cost

Option 2- USPS Express Mail $30 additional cost

 

But it doesn't seem like this is the right contribution.

 

If it is, can someone explain how I would set this up?

 

If it isn't, can you point me in the direction of the proper contribution?

 

/L

Link to comment
Share on other sites

I emailed USPS asking to switch the account to the production server. They asked for the specific API I needed but I wasn't sure. I'm assuming it's the rate calculator API. A confirmation on this would be appreciated.

 

Thanks,

-Alex

 

Did you tell them you are using osCommerce?

Edited by Chris.A
Link to comment
Share on other sites

Hello,

 

I recently installed this and started to configure it, but I am increasingly getting the feeling that I may be duck hunting with a tank. I want to offer two flat-rate shipping options,

 

Option 1- USPS priority mail $0 additional cost

Option 2- USPS Express Mail $30 additional cost

 

But it doesn't seem like this is the right contribution.

 

If it is, can someone explain how I would set this up?

 

If it isn't, can you point me in the direction of the proper contribution?

 

/L

 

You should use the built in Flat rate module, just change the title and stuff in the language folder - you can only do one of these though.

In order to add the other, download the flatrate files and change the names of the files, adjust the language file, re-upload and install, it should work, theoretically.

 

Scott

Link to comment
Share on other sites

I emailed USPS asking to switch the account to the production server. They asked for the specific API I needed but I wasn't sure. I'm assuming it's the rate calculator API. A confirmation on this would be appreciated.

 

Thanks,

-Alex

 

As Chris said, you just need to tell them to switch to production and that you use 3rd party software called OScommerce and they'll switch you over to production.

 

Scott

Link to comment
Share on other sites

  • 2 weeks later...

I am using 2.2 RC2a.

 

I am getting the same error on the checkout page:

 

United States Postal Service United States Postal Service

An error occured with the USPS shipping calculations.

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

 

I am using the same login id and pw I am using on another store, on another server.

 

I've gone through the install instructions, to the T. Is something wrong with the code in general.php, perhaps?

 

////
// Alias function for module configuration keys
 function tep_mod_select_option($select_array, $key_name, $key_value) {
reset($select_array);
while (list($key, $value) = each($select_array)) {
  if (is_int($key)) $key = $value;
  $string .= '<br><input type="radio" name="configuration[' . $key_name . ']" value="' . $key . '"';
  if ($key_value == $key) $string .= ' CHECKED';
  $string .= '> ' . $value;
}

return $string;
 }

// USPS Methods 2.9
// Alias function for Store configuration values in the Administration Tool
 function tep_cfg_select_multioption($select_array, $key_value, $key = '') {
for ($i=0; $i<sizeof($select_array); $i++) {
  $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
  $string .= '<br><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"';
  $key_values = explode( ", ", $key_value);
  if ( in_array($select_array[$i], $key_values) ) $string .= ' CHECKED';
  $string .= '> ' . $select_array[$i];
}
$string .= '<input type="hidden" name="' . $name . '" value="--none--">';
return $string;
 }

Link to comment
Share on other sites

I am using 2.2 RC2a.

 

I am getting the same error on the checkout page:

 

United States Postal Service United States Postal Service

An error occured with the USPS shipping calculations.

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

 

I am using the same login id and pw I am using on another store, on another server.

 

I've gone through the install instructions, to the T. Is something wrong with the code in general.php, perhaps?

 

-----------------------------

 

I experienced the same problem but don't recall exactly how it got resolved. One thing I distinctly remember is that trying to enter my USPS ID and PW from the osCommerce Administrator panel didn't work; I had to go into the database residing on my host server and enter them. While I was there, I made sure set_function was TEXT and not VARCHAR.

 

Also, did you follow the Troubleshooting Steps found in the installtion text file?

 

I'm referring to:

 

"1. You may need to run this SQL statement:

 

ALTER TABLE `configuration` CHANGE `set_function` `set_function` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;

 

2. If you are getting a "parse error" you may need to use phpMyAdmin to update the database -> configuration TABLE and CHANGE "set_function" to TEXT from VARCHAR.

 

3. If your International options are not showing in the admin with checkboxes:

A. Do number 2 above

B. Remove the USPS module in the admin

C. Re-install the USPS module in the admin

D. The options will appear"

Link to comment
Share on other sites

This is what I meant:

 

insert the following just before line 269 in usps.php it fixes the problem (in the with insurance version):

 

	  if (!class_exists('httpClient')) {
	include('includes/classes/http_client.php');
  }

 

Scott

Link to comment
Share on other sites

I ended up getting this to work. I didn't have to make that change in line 269, Scott.

 

if there was an error, could you post the fix? thanks...

 

Scott

Link to comment
Share on other sites

  • 2 weeks later...

First of all, thanks to everyone involved for this contribution. Now, on to my problem.

 

My USPS account is set to production and I believe everything is in order on my end per the installation instructions. USPS returns domestic shipping rates just fine (Priority, Express, Parcel), but NOTHING is showing for International USPS rates.

 

I turned on e-mailing of the XML response from USPS. These are returned when I test with a United States address, but with an Int'l address, no e-mail is sent.

 

Can anyone help?

Link to comment
Share on other sites

First of all, thanks to everyone involved for this contribution. Now, on to my problem.

 

My USPS account is set to production and I believe everything is in order on my end per the installation instructions. USPS returns domestic shipping rates just fine (Priority, Express, Parcel), but NOTHING is showing for International USPS rates.

 

I turned on e-mailing of the XML response from USPS. These are returned when I test with a United States address, but with an Int'l address, no e-mail is sent.

 

Can anyone help?

 

See the bottom of the troubleshooting section #1 - this may be the culprit.

 

otherwise, it could be that usps.php was corrupted when uploaded. Try removing, reuploading and reinstalling (after the database is updated)

 

Scott

Link to comment
Share on other sites

See the bottom of the troubleshooting section #1 - this may be the culprit.

 

otherwise, it could be that usps.php was corrupted when uploaded. Try removing, reuploading and reinstalling (after the database is updated)

 

Scott

Sorry, Scott, I wasn't clear. I can see all of the International and Domestic options in the OSC admin (I actually have them all checked for testing purposes), but at checkout_shipping.php in the checkout process, the only shipping calculations that are returned in my testing are Domestic rates. Int'l never shows.

 

I did make sure to update the set_function field in my database.

Edited by MeatBunMike
Link to comment
Share on other sites

Sorry, Scott, I wasn't clear. I can see all of the International and Domestic options in the OSC admin (I actually have them all checked for testing purposes), but at checkout_shipping.php in the checkout process, the only shipping calculations that are returned in my testing are Domestic rates. Int'l never shows.

 

I did make sure to update the set_function field in my database.

 

Thanks for clarifying... Did you make sure that the address you are using internationally actually is shipped to by USPS for the Intl options you've chosen? You can verify this on the USPS website to confirm...

 

Scott

Link to comment
Share on other sites

Thanks for clarifying... Did you make sure that the address you are using internationally actually is shipped to by USPS for the Intl options you've chosen? You can verify this on the USPS website to confirm...

 

Scott

Well, I'm simply using the addresses of businesses (Electronic Arts, Sega) in Canada and the UK. They do appear to be valid. I've tested them in the Print Shipping Labels app on USPS.com and they appear to be fine.

 

(Two things I should point out that are not "stock" installs. I'm using the PayPal WPP contribution as my payment solution and have United States SELECTED by default in the countries drop down list from the html_output.php include.)

 

Not sure if these two things could have an impact, but just thought I'd mention.

Link to comment
Share on other sites

Well, I'm simply using the addresses of businesses (Electronic Arts, Sega) in Canada and the UK. They do appear to be valid. I've tested them in the Print Shipping Labels app on USPS.com and they appear to be fine.

 

(Two things I should point out that are not "stock" installs. I'm using the PayPal WPP contribution as my payment solution and have United States SELECTED by default in the countries drop down list from the html_output.php include.)

 

Not sure if these two things could have an impact, but just thought I'd mention.

 

 

I'm unsure, but it seems to me that the html_output.php could be an issue; however, if you are able to choose another option as a customer and it is chosen, that wouldn't be the issue...

 

Are you using 3.0?

 

Scott

Link to comment
Share on other sites

I'm unsure, but it seems to me that the html_output.php could be an issue; however, if you are able to choose another option as a customer and it is chosen, that wouldn't be the issue...

 

Are you using 3.0?

 

Scott

Yeah, I can change my country just fine, and removing the SELECTED from US in the list didn't fix it.

 

I am using 3.0. Just grabbed the most recent version earlier this week. I'm going to triple check my settings in the OSC admin.

 

Thanks for being so helpful! :)

Link to comment
Share on other sites

Yeah, I can change my country just fine, and removing the SELECTED from US in the list didn't fix it.

 

I am using 3.0. Just grabbed the most recent version earlier this week. I'm going to triple check my settings in the OSC admin.

 

Thanks for being so helpful! :)

 

Glad to serve - I wish I had more input - I get fine results on a couple of my websites - I wonder if there could be a server issue (this is a stab in the dark because it doesn't make sense as to why domestic actually works!)

 

Scott

Link to comment
Share on other sites

Glad to serve - I wish I had more input - I get fine results on a couple of my websites - I wonder if there could be a server issue (this is a stab in the dark because it doesn't make sense as to why domestic actually works!)

 

Scott

Doh!

 

I had, for some reason, selected California as my Shipping Zone in the USPS methods module.

 

Works perfectly without that! I'll just slink away in embarrassment...

 

Thanks again. Sorry to have wasted your time! :\

Link to comment
Share on other sites

Doh!

 

I had, for some reason, selected California as my Shipping Zone in the USPS methods module.

 

Works perfectly without that! I'll just slink away in embarrassment...

 

Thanks again. Sorry to have wasted your time! :\

 

Well, it wasn't a waste of time, because your problem was fixed!

 

Scott

Link to comment
Share on other sites

  • 2 weeks later...

Hello Scott,

I have this problem,

in /checkout_shipping.php

 

An error occured with the USPS shipping calculations.
If you prefer to use USPS as your shipping method, please contact the store owner.

 

 

On email i receive dump:

<?xml version="1.0"?>

do you have any solution? 

<Error><Number>-2147219085</Number><Source>Rate_Respond.;SOLServerRates.Rate_Respond</Source><Description>Invalid XML Element cannot be empty according to the DTD/Schema.

</Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error>

 

Do you have any solution?

Edited by moda
Link to comment
Share on other sites

I notice one thing,

In Admin => Modules => Shipping=> USPS

then I select (check) Domestic Shipping Methods, and Int'l Shipping Methods that I will offer,

and click update.

Then I click EDIT. The methods I select Before is not selecting (NOT CHECKED), for Me its looks like I no offer any methods. All of this method suppose to be in database somewhere right? However I dont remember running any SQL with addition this fields.

Please let me know where verify this array , witch methods are checked.

Link to comment
Share on other sites

Scott, please ignore previous 2 posts,

Problem been fixed

 

Solution: I missed the part of installation process.

 

Thank you very much, for Great contribution.

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