* */ class Webshopapps_Tracker_Model_Order_Shipment extends Mage_Sales_Model_Order_Shipment { public function getTrackUrl($title,$trackref=null, $postcode=null) { if (empty($trackref)) { return; } $fullUrl=""; $carrierInstances = Mage::getSingleton('shipping/config')->getAllCarriers( $this->getStoreId() ); foreach ($carrierInstances as $code => $carrier) { if ($carrier->isTrackingAvailable()) { if ($carrier->getConfigData('title')==$title) { $manualUrl=$carrier->getConfigData('url'); $preUrl=$carrier->getConfigData('preurl'); if ($preUrl!='none') { $taggedUrl = $carrier->getCode('tracking_url',$preUrl); } else { $taggedUrl = $manualUrl; } if (strpos($taggedUrl, '#SPECIAL#')) { $taggedUrl=str_replace("#SPECIAL#","",$taggedUrl); $fullUrl=str_replace("#TRACKNUM#","",$taggedUrl); } else { $fullUrl=str_replace("#TRACKNUM#",$trackref,$taggedUrl); if ($postcode && strpos($taggedUrl, '#POSTCODE#')){ $fullUrl = str_replace("#POSTCODE#",$postcode,$fullUrl); } } break; } } } return $fullUrl; } }