Custom Shipping Method – Show Tracking Link

ee-1.13programmingshipping

We defined a custom shipping method by extending Mage_Shipping_Model_Carrier_Abstract.

There is a method

public function isTrackingAvailable()
{
    return true;
}

But after we enter a tracking number for an order, the tracking popup is empty.

Screenshot of tracking popup

Which method has to be implemented to display tracking links in the popup?

Best Answer

getTrackingInfo has to return an object with the url field defined. The variable $tracking contains the tracking number.

public function getTrackingInfo($tracking)
{
    $track = Mage::getModel('shipping/tracking_result_status');
    $track->setUrl('http://www.example.com/' . $tracking)
        ->setTracking($tracking)
        ->setCarrierTitle($this->getConfigData('name'));
    return $track;
}