Jump to content

Fedex.com Labels

Recommended Posts

Cool. Very Handy.



   if ($order->delivery['residence_id'] == "Residential"){


replace with

   if (($order->delivery['residence_id'] == "Residential") || ($order->delivery['company'] == '')){


worked better for me.


Declared value and reference field are not working for me.


Share this post

Link to post
Share on other sites

I took it a bit further


The declared value is not working (probably not good to have anyway unless you only ship 1 item every time)

The Billing reference fileds are not working either... not sure why


* fedex.com Ship Auto-Fill Contrib
*  v 0.5
global $db;
$oID = (int)tep_db_prepare_input($HTTP_GET_VARS['oID']);
include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);
//Gets the return & billing address two digit state code
$shipping_zone_query = tep_db_query("select z.zone_code from " . TABLE_ZONES . " z, " . TABLE_COUNTRIES . " c where zone_name = '" . $order->delivery['state'] . "' AND c.countries_name = '" . $order->delivery['country'] . "' AND c.countries_id = z.zone_country_id");
$shipping_zone = tep_db_fetch_array($shipping_zone_query);
$shipping_zone_code = ($shipping_zone['zone_code'] == '' ? $order->delivery['state'] : $shipping_zone['zone_code']);  // if the query result was empty, then use the state name

$contents_value = ceil(substr(strip_tags($order->totals[0]['text']),1));
$send_value = (USPS_SEND_VALUE_OVER > $contents_value ? '' : $contents_value);
   // set residental or commericial
   $res_com = "false";
   if (($order->delivery['residence_id'] == "Residential") || ($order->delivery['company'] == '')){
   $res_com =  "true";
<script type="text/javascript">
function ParseIt() {
<form name="Fedex_labels" target="_self" method="post" action="https://www.fedex.com/shipping/shipEntryAction.do?origincountry=us&locallang=us&urlparams=us" id="LabelInformationAction">
  <input type="hidden" name="form.submitControl" value="NewLabel">
<input type="hidden" name="fromData.addressData.countryCode" value="US" id="fromData.countryCode.hidden">
<input type="hidden" name="toData.addressData.contactName" value="<?php echo $order->delivery['name']; ?>" id="toData.contactName">
<input type="hidden" name="toData.addressData.companyName" value="<?php echo $order->delivery['company']; ?>" id="toData.companyName">
<input type="hidden" name="toData.addressData.addressLine1" value="<?php echo $order->delivery['street_address']; ?>" id="toData.addressLine1">
<input type="hidden" name="toData.addressData.addressLine2" value="<?php echo $order->delivery['suburb']; ?>" id="toData.addressLine2">
<input type="hidden" name="toData.addressData.city" value="<?php echo $order->delivery['city']; ?>" id="toData.city">
<input type="hidden" name="toData.addressData.stateProvinceCode" value= "<?php echo $shipping_zone_code;?>" id="toData.stateProvinceCode">
<input type="hidden" name="toData.addressData.zipPostalCode" value="<?php echo $order->delivery['postcode']; ?>" id="toData.zipPostalCode">
   <input type="hidden" name="toData.addressData.phoneNumber" value="<?php echo $order->customer['telephone']; ?>" id="toData.phoneNumber">
   <input type="hidden" name="toData.addressData.residential" value="<?php echo $res_com; ?>" id="toData.residential">

   <input type="hidden" name="psdData.mpsRowDataList[0].carriageValue" value="<?php echo $send_value; ?>" id="psd.mps.row.declaredValue.0">
   <input type="hidden" name="psdData.declaredValueCurrencyCode" value="USD" id="psdData.declaredValueCurrencyCode">

   <input type="hidden" name="billingData.referenceData.yourReference" value="<?php echo $order->delivery['name']; ?>" id="billingData.yourReference">
   <input type="hidden" name="billingData.referenceData.purchaseOrderNumber" value="<?php echo $order->customer['purchase_order_number']; ?>" id="billingData.purchaseOrderNumber">
   <input type="hidden" name="billingData.referenceData.invoiceNumber" value="<?php echo (int)$oID; ?>" id="billingData.invoiceNumber">
   <input type="hidden" name="billingData.referenceData.departmentNumber" value="<?php echo (int)$oID; ?>" id="billingData.departmentNumber" >

   <input type="hidden" name="notificationData.recipientNotifications.email" value="<?php echo $order->customer['email_address']; ?>" id="notificationData.recipientNotifications.email">
   <input type="hidden" name="notificationData.recipientNotifications.shipmentNotificationFlag" value="false" id="notificationData.recipientNotifications.tenderedNotificationFlag">
   <input type="hidden" name="notificationData.recipientNotifications.tenderedNotificationFlag" value="false" id="notificationData.recipientNotifications.tenderedNotificationFlag">
   <input type="hidden" name="notificationData.recipientNotifications.exceptionNotificationFlag" value="true" id="notificationData.recipientNotifications.exceptionNotificationFlag">
   <input type="hidden" name="notificationData.recipientNotifications.deliveryNotificationFlag" value="true" id="notificationData.recipientNotifications.deliveryNotificationFlag">
<input type="submit" value="Ship a Fedex Package" />


Share this post

Link to post
Share on other sites

from your instructions... I changed to:




if you want to overwrite the existing fedex.com tab/window with each click of the button:


<a href="' . tep_href_link(FILENAME_ORDERS_FEDEX_SHIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="new">' . tep_image_button('button_fedex_shipping.gif', 'Ship with Fedex') . '</a>


if you want a new tab/window with each click:

<a href="' . tep_href_link(FILENAME_ORDERS_FEDEX_SHIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_fedex_shipping.gif', 'Ship with Fedex') . '</a>


to the list of buttons at the top or bottom



The first method TARGET="new" behaves better for my needs... personal preference though


Share this post

Link to post
Share on other sites

Hey Dave, from my testing it I could not get any field other than the ship to address to be filled in, though I did not try them all. Normally I only post finished contributions but this one had me stuck. I am hoping someone else will have interest and figure it out and let everyone know.


The declared value should be giving the order total value. To get around things not showing up I would test them on the name field to make sure I got the output I expected. (not that it matters since I cannot get FedEx to take it in the proper field.)

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