Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

usps api shipping label, online labels integrated


goldencrown

Recommended Posts

It doesnt support International right now, but maybe I will work on that for you all if I get some time. I know myself and some of my clients do get international customers every now and then, so it might come in handy. Ill let you know how things progress.

 

Okay, I just looked at USPS.com and through the online service you can print Global Express Mail only. That will be too expensive for most people, but I still might work on it anyway.

 

If someone with more experiance then me could work on using the actuall Label APIs from USPS it would be possible to print other types of labels direct from oscommerce. I tried looking over the developers pack myself, and it looked greek to me. It was all XML and ASP and java, three languages I really dont know.

Edited by Goanna
Link to comment
Share on other sites

  • Replies 156
  • Created
  • Last Reply

Top Posters In This Topic

Okay, alot of people keep asking what the differance is between the two buttons. Well, here is the answer.

 

One button uses the customers information to fill out the shipping label form, the other uses the shipping address information to fill out the form. So if a customer places an order and specifies an address other then his own to ship to, then you use the "different shipping label" button. If it is going to the customers address, you use the "Customer Shipping label" button.

Link to comment
Share on other sites

Yes, there is another contribution that deals direct with the USPS API:

 

http://www.oscommerce.com/community/contributions,487

 

 

 

maybe you can integrate the international schemas from here and possibly have the button automatically go to the service type form -all filled in of course

Thats not the same thing. That is using the Shipping Calculation API. What I am looking for is something that uses the USPS Label API, which is different.

 

The Contribution already does take the information from the USPS shipping method and then enters weight into the appropriate feild on the service form.

Link to comment
Share on other sites

great contrib...

 

one problem on my MS1...

 

weight on all packages come out to zero pounds and 2 ouces no matter what reality is

 

                    <?php
   $shipping_weight_ot = substr($order->totals[1]['title'],strpos($order->totals[1]['title'],'x') + 1, (strpos($order->totals[1]['title'],'lbs') - strpos($order->totals[1]['title'],'x'))-1 );
     $shipping_weight = ($shipping_weight_ot < 0.1 ? 0.1 : $shipping_weight_ot);
     $shipping_pounds = floor ($shipping_weight);
     $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));

          ?>  

 

Any ideas on why that would be...I have to assume that its not pulling my weight variable but I cant tell how it would.

Link to comment
Share on other sites

Just two tweaks,

 

1. I'd like to be able to print just the address label. I can see from the Post Office Guide what needs to be passed to change the formatting, but does anyone know where the variables are stored?

 

2. I'd like the postage field to print as blank as opposed to "Postage Required" when I don't purchase postage from the Post Office.

 

The USPS Mailing Assistant software can pull off both of these tricks, other than writing the tracking number back to my database (okay, I can dream can't I?) I love this contribution.

Link to comment
Share on other sites

I'm getting the following error when clicking on the "USPS label shipping" button.

"Not Found

The requested URL /admin/FILENAME_ORDERS_diffrentshipping was not found on this server."

 

Any ideas?

Link to comment
Share on other sites

I'm getting the following error when clicking on the "USPS label shipping" button.

"Not Found

The requested URL /admin/FILENAME_ORDERS_diffrentshipping was not found on this server."

 

Any ideas?

Yes, the problem is in the text that was put in orders.php. This line:

 

<a href="' . tep_href_link(FILENAME_ORDERS_diffrentshipping, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_labelshipping.gif', IMAGE_ORDERS_diffrentshipping) . '</a>

 

Should be changed to:

 

<a href="' . tep_href_link(FILENAME_ORDERS_CUSTOMERSHIPPINGLABEL, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_labelcustomer.gif', IMAGE_ORDERS_labelcustomer) . '</a>
	 <a href="' . tep_href_link(FILENAME_ORDERS_DIFFERENTSHIPPING, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_labelshipping.gif', IMAGE_ORDERS_diffrentshipping) . '</a>

 

That should do it.

Link to comment
Share on other sites

I'm using the latest version (1.6) and found a minor bug. If the street name (and I'm guessing anything else like the customer's name) has a quote mark in it, then it drops everything after the quote.

 

For example, if you have a street address such as 888 O'Farrell St, then when it sends it to the USPS site, it will become 888 O. Or if you have a name like Joe O'Connor, it will become Joe O.

 

Also, the above post I made, the replacement should be:

 

  <a href="' . tep_href_link(FILENAME_ORDERS_DIFFERENTSHIPPING, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_labelshipping.gif', IMAGE_ORDERS_diffrentshipping) . '</a>

 

edit: I apologize for the double post. I saw the 'Edit' button after I made this post.

Edited by twinmoons
Link to comment
Share on other sites

I am almost there. These changes seemed to work but I am getting this: Access Denied

 

No Right Permission Access

 

?Please contact your Web Administrator to request

?more access or if you found any problem

 

Weird thing is - this is an OSCOMMERCE generated message from within the admin window. In other words, I am still on the admin page but this sort of like a frame within that page. The store works fine so why would there be a problem with the shipping module trying to access something???

Edited by Grey Ghost
Link to comment
Share on other sites

Weird thing is - this is an OSCOMMERCE generated message from within the admin window. In other words, I am still on the admin page but this sort of like a frame within that page.

 

 

what page are you on in admin?

Biscochitos almost as good as grandma

Link to comment
Share on other sites

I'm looking at a specific order: admin>Customers>Orders>(pick any order and click)edit>USPS Shipping Label Customer. This opens a new admin window that SHOULD be the shipping label. Instead, I get the error.

Link to comment
Share on other sites

  • 3 weeks later...
I'm looking at a specific order: admin>Customers>Orders>(pick any order and click)edit>USPS Shipping Label Customer. This opens a new admin window that SHOULD be the shipping label. Instead, I get the error

 

change your file Permission to 644 or higher

Biscochitos almost as good as grandma

Link to comment
Share on other sites

  • 4 weeks later...

I had the 1.3 version of this contribution working perfectly, but then did some site upgrades, and installed the 1.6 and now I am getting "session timed out" message from the usps website after I try to submit the address information....please help!?!!??

"Your focus is your reality"

Link to comment
Share on other sites

After you get the timed out message click on "Print Shipping Label page" this will take you to the start of the shipping page now click on "domestic shipping labels? the "go" button. This will start a new user session. Once the user session has been started. You can now click on the usps shipping label button and start printing out your shipping labels.

Biscochitos almost as good as grandma

Link to comment
Share on other sites

Anyone know of a way to get this to work WITHOUT logging in first? Or a way to auto-login? For me, it was better when I did not have to login, but also did not have the history.

 

Will my version 1.3 still work with the new changes done by USPS?

"Your focus is your reality"

Link to comment
Share on other sites

the reason I am thinking there must be a way to "auto-login" or fool the USPS server is because in v1.3, I had put my USPS web API username and password in the usps.php file like so - see bold text below (username and password changed for this post - this one is not valid):

 

 

if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) {

 

$request = '

 

<RateRequest USERID="932KCORK0956" PASSWORD="198RL87AC423" APPID="USPSSHIPASST" VERSION="2.2">

 

';

 

$services_count = 0;

 

 

 

if (isset($this->service)) {

 

$this->types = array($this->service => $this->types[$this->service]);

 

}

"Your focus is your reality"

Link to comment
Share on other sites

Shipping Labels 1.7 Released!!!

 

-Corrected errors on Diffrentshipping.php and Customershipping.php

-Corrected Syntax Errors in Included orders.php file

-Added Notes to the Configuration Areas for Proper Setup on Specialized Addresses.

-Fixed Broken Image Links

-Fixed Broken Javascript Links

-Included two new USPS buttons

-Fixed Weight Calculations

-Corrected Syntax Errors in Instructions

 

http://www.oscommerce.com/community/contributions,1498

Link to comment
Share on other sites

  • 2 weeks later...

After installing 1.7, I have found that the shipping weights on the USPS page are not correct. The page is showing 0 lb 2 ounces when the actual weight in my system is near 1.0 lb.

 

Any ideas on where to look?

--Jeff

Edited by snuff
Link to comment
Share on other sites

I also had noticed that originally, but it was only happening with my items that I listed with a weight of under 1lb. I then made a few test items with weights of over 1lb and it worked out fine on all of them.

 

The code that figures out the weight of the product is located in differentshipping.php and customershippinglabel.php towards the end of the files around line 908

 

here is the code,

                    <?php
   $shipping_weight_ot = substr($order->totals[1]['title'],strpos($order->totals[1]['title'],'x') + 1, (strpos($order->totals[1]['title'],'lbs') - strpos($order->totals[1]['title'],'x'))-1 );
    $shipping_weight = ($shipping_weight_ot < 0.1 ? 0.1 : $shipping_weight_ot);
     $shipping_pounds = floor ($shipping_weight);
     $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
          ?>

 

Then the variables $shipping_pounds and $shipping_ounces are put into the form using echo statements on lines 921 and 925.

Link to comment
Share on other sites

I'm still looking for a way to fix the permissions (as mentioned earlier in the thread). Any ideas what files I need to change?

Link to comment
Share on other sites

I also had noticed that originally, but it was only happening with my items that I listed with a weight of under 1lb. I then made a few test items with weights of over 1lb and it worked out fine on all of them.

 

The code that figures out the weight of the product is located in differentshipping.php and customershippinglabel.php towards the end of the files around line 908

 

here is the code,

 ? ? ? ? ? ? ? ? ? ?<?php
? ?$shipping_weight_ot = substr($order->totals[1]['title'],strpos($order->totals[1]['title'],'x') + 1, (strpos($order->totals[1]['title'],'lbs') - strpos($order->totals[1]['title'],'x'))-1 );
? ? $shipping_weight = ($shipping_weight_ot < 0.1 ? 0.1 : $shipping_weight_ot);
? ? ?$shipping_pounds = floor ($shipping_weight);
? ? ?$shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
? ? ? ? ? ?>

 

Then the variables $shipping_pounds and $shipping_ounces are put into the form using echo statements on lines 921 and 925.

If my weights are under or over 1 lb (some are 10 oz ranging up to 3 lbs), I still get the same output: 2 oz in the USPS page. Not knowing php enough to fix it, is it pulling individual weights and addidng them or is it taking the "order total" weight and using that?

Link to comment
Share on other sites

I'm still looking for a way to fix the permissions (as mentioned earlier in the thread). Any ideas what files I need to change?

 

File permissions are changed on the server. You will need to contact you web hosting company on how to make the changes. The files you want to make the change on is the files you are having problems with. So for example if you are having the error with the file "Diffrentshipping.php" you will need to change the permission for "Diffrentshipping.php"

Biscochitos almost as good as grandma

Link to comment
Share on other sites

is it pulling individual weights and addidng them or is it taking the "order total" weight and using that?

 

 

The total is coming from the order total.

Biscochitos almost as good as grandma

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