Pages

Thursday, July 4, 2013

Magento: Show “track your order” in frontend – My Orders

It is always required for the customer to track their order. The shipping carriers can be anything: Aramex, Bluedart, DHL, First Flight, Federal Express, etc.. Navigate to My Account and place a button in My Orders section there “Track Order”. Paste the code below to link it to tracking popup that you can also see in backend Shipments area.
   

<?php
if($_order->hasShipments()) {
    $show = true;
    foreach($_order->getTracksCollection() as $k=>$v) {                           
        if($v['carrier_code'] == 'custom' || $v['carrier_code'] == '')
            $show = false;
    }
    if($show) {?>
        <span class="separator2">&nbsp;</span>

        <a class="askTrackBtn" href="javascript:;" onclick="popWin('<?php echo Mage::helper('shipping/data')->getTrackingPopUpUrlByOrderId($_order->getId()) ?>', 'tracking the order', 'scrollbars=yes,width=800,height=600,resizable=yes');return false;"><span><?php echo $this->__('Track Order') ?></span></a>
       <?php
    }
}?>

No comments:

Post a Comment