Jump to content



Photo
- - - - -

Automated FedEx Labels


  • Please log in to reply
713 replies to this topic

#701   alexander_84

alexander_84
  • Members
  • 2 posts
  • Real Name:Alexander

Posted 02 February 2010 - 17:22

Hi guys,
Can u help me?
I should change FedEx labels module for international addresses. For example for shipment from USA to GB.
So, what things I should change in module? Currently it working only with USA & Canada addresses, giving olny 2 letters state etc.

Thanks.

#702   finjay

finjay
  • Members
  • 13 posts
  • Real Name:Jay
  • Gender:Male

Posted 05 March 2010 - 00:59

I inherited an osc site with this contribution installed and after a server move (php4to php5), the Fedex images are not working anymore. I would like to update teh version of the contrib, but I have no idea which version is installed. I have no readme or install file. Is there a way for me to check what version is installed?
Does anyone have an idea about why the images have stopped working?
thanks for your help!

#703   TheJackal

TheJackal
  • Members
  • 175 posts
  • Real Name:Jackal
  • Gender:Male
  • Location:San Francisco

Posted 15 March 2010 - 22:29

Warning: The current contribution APIs will not work after May 31, 2012.

Please see: http://fedex.com/us/.../migration.html

If anyone is working or would like to work on the migration, would appreciate if you post here so that we can support each other. Thanks.
- The Jackal

#704   willtor

willtor
  • Members
  • 17 posts
  • Real Name:William

Posted 21 March 2010 - 00:25

Hi all,

I have an issue with tracking as well. I couldn't find a similar problem on the forum.

- When trying to track a package from within the site by using the "track this shipment" link, the customer gets back to the home page, in logged off status

- In the email generated for the tracking/status info, when the customers uses the link provided to get the Detailed Invoice, he gets to the login page. After login in, he gets the home page. I'm not sure if the contribution is intended to work that way or if there is a bug somewhere.

Any help would be really really appeciated.

TIA

#705   TheJackal

TheJackal
  • Members
  • 175 posts
  • Real Name:Jackal
  • Gender:Male
  • Location:San Francisco

Posted 22 March 2010 - 22:31

No, it's not supposed to work that way. It's definitely a bug somewhere (either in your installation or this code).
- The Jackal

#706   arkane8

arkane8
  • Members
  • 26 posts
  • Real Name:Webmaster
  • Gender:Male

Posted 14 June 2010 - 15:09

I finally figured out how to do international shipping with this module. I know alot of people have been asking for this for the last 3 years, so here goes....

After about 7 hours of hacking, learning, and crunching, here is more or less the code you need to get it working. You will have to also update abbreviate.php in your catalog/admin/includes folder accordingly to abbreviate your countries into two letter formats for FedEx, and make sure your shipping addresses for international have the proper 'State/Province', or reprogram your OSC to allow blank 'State/Province' fields, or else FedEx might return an invalid state error.

Here is the vital piece of code you'll need to insert into ship_fedex.php in catalog/admin. It should be inserted right after the $shipData array.

$order_qty_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $order . "'");
$count = mysql_num_rows($order_qty_query);
		$i=1;
		if (tep_db_num_rows($order_qty_query)) {
      		while (($order_qtys = tep_db_fetch_array($order_qty_query)) && ($i <= $count)) {
        	$products_id = $order_qtys['products_id'];
				$products_weight_query = tep_db_query("select * from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
				if (tep_db_num_rows($products_weight_query)) {
					$products_weights = tep_db_fetch_array($products_weight_query);
					$order_weight = $order_weight + ($order_qtys['products_quantity'] * ($products_weights['products_weight']));
				}
				$shipData['79-' . $i] = $order_qtys['products_name']; // description of commodity
				$shipData['80-' . $i] = $senders_country; // country of manufacture of commodity
				$shipData['81-' . $i] = '<insert harmonized tariff code here>'; // HS tariff code (10 digits) of commodity
				$shipData['82-' . $i] = $order_qtys['products_quantity']; // quantity of the commodity
				$shipData['1407-' . $i] = number_format($products_weights['products_weight'], 1, '.', '');
				$shipData['1408-' . $i] = $order_qtys['products_price'] . '00' ; // price per commodity
				$shipData['414-' . $i] = 'PCS'; // unit of measurement for how your commodities are counted
			$i++;
			}
		}

You'll need to lookup the HS tariff code for your products (you should be able to google it) and replace it accordingly in the example above, and you'll need to designate how your items are measured. For the example above, I used 'PCS' for pieces. You might want to look up what yours is in the FedEx API manual. FYI, you can't just write any unit mesaurement, it has to be abbreviated in the FedEx API format.

So this is the most vital section of code to allow you to be able to ship internationally. It will automatically count the number of line items in your order and send it over to be declared in FedEx international shipments. If anyone can build this code into the contrib and release it as an entire package (and if you can credit me) the entire community would be appreciated. I'd do it myself, but I've customized my Fedex contrib code so much that it's unusable by the general public.

Good luck.

If you still get any shipping errors from Fedex, just let me know -- I may have left out one or two API's that's somewhere else in my code.

Edited by arkane8, 14 June 2010 - 15:23.


#707 ONLINE   greasemonkey

greasemonkey
  • Members
  • 463 posts
  • Real Name:Scott
  • Gender:Male

Posted 13 May 2011 - 01:55

Hi all, any one using this mod along side Canada Post Automatic labels?

I'm just starting to install and the second edit will take out some of Can Post Labels. In admin/orders.php... it says to:

Find this:

<td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

Replace with this:

<td colspan="2" align="right">
<?php
    // begin fedex label mod
    // determine whether this is on the test or production server
    $value_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FEDEX1_SERVER'");
    $value = tep_db_fetch_array($value_query);
    $fedex_gateway = $value['configuration_value'];

    $orders_query_raw = "select orders_id, fedex_tracking, orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int)$HTTP_GET_VARS['oID'] . "'";
    $orders_query = tep_db_query($orders_query_raw);
    if (tep_db_num_rows($orders_query)) {
        $fedex_orders = tep_db_fetch_array($orders_query);
    }

    // check for a fedex tracking number in the order record
    // if yes tracking number, show "fedex label," "track" and "cancel" options
    $fedex_tracking = $fedex_orders['fedex_tracking'];

    if ($fedex_tracking) {
        // display the label
        echo '<a href="fedex_popup.php?num=' . $fedex_tracking . '&oID=' . $HTTP_GET_VARS['oID'] . '">' . tep_image_button('button_fedex_label.gif', IMAGE_ORDERS_FEDEX_LABEL) . '</a>';
        // cancel the request
        echo '<a href="' . tep_href_link(FILENAME_SHIP_FEDEX, 'oID=' . $HTTP_GET_VARS['oID'] . '&num=' . $fedex_tracking . '&action=cancel&fedex_gateway=' . $fedex_gateway) . '" onClick="return(window.confirm(\'Cancel shipment of order number ' . $order->orders_id . '?\'));">' . tep_image_button('button_cancel_shipment.gif', IMAGE_ORDERS_CANCEL_SHIPMENT) . '</a>';
    }
    elseif ($fedex_orders['orders_status'] != 3) {          // if the order has not been manually marked "delivered,"
	// display the "ship" button
	echo '<a href="' . tep_href_link(FILENAME_SHIP_FEDEX, 'oID=' . $HTTP_GET_VARS['oID'] . '&action=new&status=3') . '">' . tep_image_button('button_ship.gif', IMAGE_ORDERS_SHIP) . '</a>';
    }
    // end fedex label mod

  echo
   '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a>' .
   '<a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>' .
   '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>';
?></td>

Problem is mine looks like this (modified for Can Post Automatic Labels):

<td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_SHIP_CANADAPOST, 'oID=' .(int)$HTTP_GET_VARS['oID'] . '&action=new&status=3') . '">' . tep_image_button('button_ship_canadapost.gif', IMAGE_ORDERS_SHIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

Any idea's how I can modify this code to work? Thanks in advance...

#708 ONLINE   greasemonkey

greasemonkey
  • Members
  • 463 posts
  • Real Name:Scott
  • Gender:Male

Posted 15 May 2011 - 11:59

Hi all, after a bunch of trial and error I managed to get this contibution printing labels on the test server. I getting the following errors
Warning: fopen(/shop/images/fedex/205262410000114.png) [function.fopen]: failed to open stream: No such file or directory in /home/flournet/public_html/osc_admin/includes/fedexdc.php on line 251

Warning: fwrite(): supplied argument is not a valid stream resource in /home/flournet/public_html/osc_admin/includes/fedexdc.php on line 252

Warning: Cannot modify header information - headers already sent by (output started at /home/flournet/public_html/osc_admin/includes/fedexdc.php:251) in /home/flournet/public_html/osc_admin/includes/functions/general.php on line 22

After going through all 36 pages of the forum 2 twice... and trying to change lines 251 and 252 in admin/includes/fedexdc.php to the absolute path I finally found the problem. What I needed to change to the direct path was admin/includes/configure.php

Changed this:
define('DIR_WS_FEDEX_LABELS', DIR_WS_IMAGES . 'fedex/');
To This;
define('DIR_WS_FEDEX_LABELS', '/home/******/public_html/osc_admin/images/fedex/');

Off to the shop tomorrow to try it on the thermal printer and then see if it works on the product server. After reading through everything I'm still not 100% clear if I need to still call to get approval to use the production server.

Thanks everyone who help create this time saving mod!

Now, is anyone working on the update to work with Fedex's new Web Services API? I was able to get the Web Services v9 Fedex quotes working... bug there are a bunch of bugs and I lack the (any) skills in figuring out the code. As I understand it... this contribution will go dark on May 2012...

#709   DriWashSolutions

DriWashSolutions
  • Members
  • 237 posts
  • Real Name:John Skurka
  • Gender:Male
  • Location:Ithaca, NY

Posted 17 May 2012 - 18:08

Anyone got this contrib to work with the new FedEx WebServices?
John Skurka

#710   yocompia

yocompia
  • Members
  • 48 posts
  • Real Name:Jacob

Posted 29 May 2012 - 21:09

Anyone got this contrib to work with the new FedEx WebServices?


john,

looks like someone has bid it out

http://www.freelance...oscommerce.html

i would really like to get this before May 31st...

cheers,
jake

#711   imagixx

imagixx
  • Members
  • 98 posts
  • Real Name:Martin B.
  • Gender:Male

Posted 09 June 2012 - 06:09

Got somewhere with suggestions at:

http://forums.oscomm...labels__st__240

1. Installed
FedEx - Web Services v9 for real time quotes.

2. Change server reference, and the suggestions by Joel.

But all I get is a broken "Astra Barcode."

Hope this motivates someone.

#712   imagixx

imagixx
  • Members
  • 98 posts
  • Real Name:Martin B.
  • Gender:Male

Posted 13 June 2012 - 00:43

Got somewhere with suggestions at:

http://forums.oscomm...labels__st__240

1. Installed
FedEx - Web Services v9 for real time quotes.

2. Change server reference, and the suggestions by Joel.

But all I get is a broken "Astra Barcode."

Hope this motivates someone.



#713   devoidofodors

devoidofodors
  • Members
  • 17 posts
  • Real Name:Steven
  • Gender:Male
  • Location:Portland

Posted 10 July 2012 - 19:04


I had a recent problem that might shed some light on the problem. One of my client's stores had an improperly configured FedEx Real Time Quotes shipping module, with the account number being different. Thinking that FedEx had finally given up support of the labels, I changed the fedex server configuration (fedexdc.php) and I got to the broken Astra Barcode screen you were talking about.

ship_fedex.php has a very interesting debug feature that you can use to see if your information is being passed to the final label creation stage. if you set it to 1, you will see what the shipping manifest's array looks like.
// debugging
// setting to 1 displays the array of all shipping
// and manifest data when a ship request is made
$debug = 0;
Later on around line 317
	 if ($debug) {
	  $shipData[1400] = $total_weight;
	  $package_weight = $HTTP_POST_VARS['package_' . $i . '_weight'];
	  $package_weight = sprintf("%01.1f", $package_weight);
	  $shipData[1401] = $package_weight;
	  echo SHIPMENT_REQUEST_DATA . $i . ':<br><pre>';
	  print_r($shipData);
	  echo '</pre>';
	  $manifest_data['tracking_num'] = 'master_trackNum';
	  echo MANIFEST_DATA . $i . ':<br><pre>';
	  print_r($manifest_data);
	  echo '</pre>';
	  }
	 else {
	  $shipData[1400] = $total_weight;
	  $package_weight = round($HTTP_POST_VARS['package_' . $i . '_weight'],1);
	  $package_weight = sprintf("%01.1f", $package_weight);
	  $shipData[1401] = $package_weight;
	  $master_trackNum = tep_ship_request($shipData,$ship_type,$order);
	  $manifest_data['tracking_num'] = $master_trackNum;
	  }
	 }

I then checked some of the other stores and they were all printing out labels perfectly. Hmm... I went back and put the original server address back in, configured the FedEx Real Time Quotes and FedEx Web Services to have the same credentials and it worked.

tl;dr: check to see if your modules are configured with the same credentials (the new ones you got from FedEx for the Web Services modules).

#714 ONLINE   greasemonkey

greasemonkey
  • Members
  • 463 posts
  • Real Name:Scott
  • Gender:Male

Posted 14 July 2012 - 00:37

I have uploaded an UPGRADE... just now. And suggested moving support to; http://forums.oscomm...eb-services-v9/

See the webservice-v9 link for details...