1

How to modify the tracking link on both admin and frontend so that when I click on the link track this shipment, it opens directly to carrier page ?

tracking information

I want it to open https://www.paket.id/is/MPMTD instead of magento/shipping/tracking/[...]

This is how I changed the carrier URL:

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

I have googled how to modify this pop-up but I didn't find any solution. And, is it possible to modify it?

1
  • I just changed the tracking URL to my custom carrier. I am wondering if it's possible to modify the pop-up target? I didn't find any solution for this, so I ask here
    – may
    Commented Sep 14, 2016 at 7:38

1 Answer 1

1

I had a bit of a struggle with this one, but I found how to do it.

Copy this file /app/design/adminhtml/default/default/template/sales/order/view/tab/info.phtml to your theme if you have one, or modify it directly (I'd advise against it).

Then around lines 60 you should see something like this:

<a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>

If you are using PHP >= 5.5 replace it with :

<?php  
      echo array_shift(
               Mage::getModel('shipping/info')->loadByHash(Mage::helper('core')->urlEncode("order_id:{$_order->getId()}:{$_order->getProtectCode()}"))->getTrackingInfo()
              )[0]->getData('status'); 
?>

if using PHP < 5.5 do this:

<?php 
    $firstTrack = array_shift(Mage::getModel('shipping/info')->loadByHash(Mage::helper('core')->urlEncode("order_id:{$_order->getId()}:{$_order->getProtectCode()}"))->getTrackingInfo());
    $trackLink = $firstTrack[0]->getData('status');
    echo $trackLink;
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.