Search code examples
drupal-6ubercartfedex

How do you add Fedex SmartPost as a shipping option?


I am looking to add FedEx SmartPost as a shipping option. Any idea what I need to do to accomplish this? The only information I have found on it is here https://drupal.org/node/793124, but it seems no one has solved this issue. I am willing to modify the ubercart fedex module if needed.

So far what I have done:

  • Changed RateService_v10.wsdl to RateService_v14.wsdl
  • Added code to the uc_fedex_rate_request function:

    $request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail();
    function addSmartPostDetail(){
      $smartPostDetail = array( 
         'Indicia' => 'PARCEL_SELECT',
         'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE',
         'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION',
         'HubId' => 5087,
         'CustomerManifestID' => myid, 
       );
      return $smartPostDetail;
    }
    

In the uc_fedex_quote function, I have added a debug statement right after:

  $response = uc_fedex_rate_request($packages, $origin, $destination);
  drupal_set_message('<pre>'. print_r($response, TRUE) .'</pre>');

In the response I do not get SmartPost returned as an option.


Solution

  • This is what I had to do (note: I edited the uc_fedex.module directly):

    • You must get SmartPost approved for your account first
    • Get the updated wsdl file from https://www.fedex.com/us/developer/web-services/process.html?tab=tab1 and upload them to your server
    • Get a HubId from customer support (mine was 5185)
    • Get a CustomerManifestID from customer support
    • Change to RateService_v14.wsdl in the code (near $client = new SoapClient...)
    • Change the version to 14

      $request['Version'] = array( 'ServiceId' => 'crs', 'Major' => '14', 'Intermediate' => '0', 'Minor' => '0', );

    • Add the following code:

      $request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail(); function addSmartPostDetail(){ $smartPostDetail = array( 'Indicia' => 'PARCEL_SELECT', 'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE', 'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION', 'HubId' => yourhubid, 'CustomerManifestID' => yourmanifestid, ); return $smartPostDetail; }

    • Add the following to _uc_fedex_ground_services(): 'SMART_POST' => t('FedEx Smart Post'),

    • Go to admin/store/settings/quotes/methods/fedex and check 'FedEx Smart Post'