cancel
Showing results for 
Search instead for 
Did you mean: 

FedEx Saturday Shipping

FedEx Saturday Shipping

I can see Saturday Delivery in the WSDL but it doesn't show up in the Allowed Methods. Does this have to be added programmatically or is there an option somewhere that I'm missing?

3 REPLIES 3

Re: FedEx Saturday Shipping

For anyone else wondering how this works...

 

I was able to retrieve Saturday rates by modifying app\code\core\Mage\Usa\Model\shipping\Carrier\Fedex.php

In the _formRateRequest method, I added 'VariableOptions' => array('SATURDAY_DELIVERY') to the $ratesRequest array. (Yes, I know modifying core code is bad)

 

Now that Saturday rates are being returned, this presents a new problem... Fedex returns both standard and Saturday rates with the same code. For example, if the ShipTimestamp is Thursday the resulting ship date is Saturday. The web service response will have two FEDEX_2_DAY objects; one with the standard price, one with the standard price plus Saturday delivery surcharge.

 

The way Magento handles shipping rates returned from web service is to iterate through the returned shipping methods, check if each method is allowed and if it is, add it to an array: $costArr[$serviceName] = $amount. So, as Magento iterates through the shipping methods it first hits the standard 2 day shipping and $costArr["FEDEX_2_DAY'] = <standard shipping cost>. It then hits Saturday 2 day shipping and $costArr["FEDEX_2_DAY"] = <saturday shipping cost>. The standard value is over written by the Saturday value and the customer still has just 1 option. Worse, there's nothing that denotes the fact that the displayed shipping method is a Saturday delivery with a surcharge.

 

... less than impressed with Magento's implementation of shipping

 

Re: FedEx Saturday Shipping

Were you ever able to get this to work?

Re: FedEx Saturday Shipping

Yes, I was able to get Fedex Saturday Delivery Options to work. It's been a while and it's kind of wonky but this should get you started... 

 

You need to override a couple of methods in Mage_Usa_Model_Shipping_Carrier_Fedex

 

In the _formRateRequest($purpose) method, add 'VariableOptions' => array('SATURDAY_DELIVERY') to the $ratesRequest array. This will enable the inclusion of Saturday rates in the web service response from Fedex. 

 

Now for the wonky part... in the Fedex web service response, there isn't anything that specifically denotes that the returned rate is for Saturday Delivery. If you var dump the response what you see is the same shipping method defined twice. For example, FEDEX_2_DAY with cost $x.xx and then FEDEX_2_DAY a second time with cost $y.yy

 

The only method we're offering Saturday Delivery for is FEDEX_2_DAY.

So, in the the getCode($type, $code) method I've added 'FEDEX_2_DAY_SAT' => Mage::helper('usa')->__('2 Day (Saturday)') to the 'method' array in the $codes array. 

 

In the _prepareRateResponse($response) method you need to add code to detect the Saturday rate (the 2nd instance of a shipping method in the web service response) and change the type value to your custom type

 

find:

foreach($response->RateReplyDetails as $rate) {

$serviceName = (string)$rate->ServiceType;

 

add: if(isset($costArr[$serviceName])) {$serviceName.= "_SAT"; }

 

Make sure you select your custom method in the admin 'Allowed Methods'