I have added tracking link to default carrier by adding the following code to [mytheme]/template/email/order/shipment/track.phtml

<?php $i=0; foreach ($_shipment->getAllTracks() as $_item): $i++ ?>
    <tr <?php echo $i%2?'bgcolor="#F6F6F6"':'' ?>>
        <td align="left" valign="top" style="padding:3px 9px"><?php echo $this->escapeHtml($_item->getTitle()) ?></td>
        <td align="center" valign="top" style="padding:3px 9px"><a href="https://sporing.posten.no/sporing.html?q=<?php echo $this->escapeHtml($_item->getNumber()) ?>" ><?php echo $this->escapeHtml($_item->getNumber()) ?></a></td>
<?php endforeach ?>

However.. my tablerate shipments are shipped with another carrier, and should have another url. How can I edit the above code to use different tracking url for tablerate shipments? I kind of know what to do, but not how to code it correctly...

But something like this (Pseduo code):

For each shipment;
 if shipment method is tablerate
   use tracking url http://my_tablerate_carrier+tracking number
 else if shipment method is all others
   use tracking url http://my_current_carrier+tracking number

All help appreciated, thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.