Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Make tracking number on receipt a link to carrier tracking info. 
 
Fortimir
Member
 
Total Posts:  35
Joined:  2009-05-09
 

Am I missing something, or is this a seriously simple oversight in usability?

This isn’t 2001 anymore, and when a customer clicks a tracking link, it should bring them the result at the carrier’s site.  I know it was a simple add-on in OScommerce, anyone done it here?

I wouldn’t be so irritated with this implementation, had they even bothered to include a link to the carrier’s website next to the tracking number.  As it stands, a customer must copy their tracking number, open a new tab or window, navigate to the carrier’s site manually, enter and submit their tracking info. For as slick as magento is, this is unacceptable.

 
Magento Community Magento Community
Magento Community
Magento Community
 
InitechDesign
Sr. Member
 
Total Posts:  88
Joined:  2008-11-12
 

I agree, are we missing something? Anybody???

 
Magento Community Magento Community
Magento Community
Magento Community
 
djsinestro
Jr. Member
 
Total Posts:  3
Joined:  2009-11-04
 

I was just playing with this and got it working, but this is a total hack. Works for UPS, FedEx, USPS, and DHL via Boxoh.com.

In app/design/frontend/default/default/template/email/order/shipment open “track.phtml”

Change line 81 from:

<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>

To:

<td align="center" valign="top" style="padding:3px 9px"><?php echo "<a href= 'http://boxoh.com/?t=".$_item->getNumber()."'>".$_item->getNumber()."</a>" ?></td>

This turns your tracking number into a link on Boxoh.

Hope it helps someone.

 
Magento Community Magento Community
Magento Community
Magento Community
 
2-czech
Member
 
Total Posts:  31
Joined:  2008-01-03
 

has this issue been ever solved?

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
GVal
Jr. Member
 
Total Posts:  15
Joined:  2009-03-05
 

I’m sure there is a better way to do this as I am not a programmer.  (I would have rather used a switch/case statement but couldn’t figure it out).  But is works for me.  It create a href for the tracking number.  I only use USPS and UPS so you will need to add link code for the others and/or more if statements for shipping types not listed.  I am also sure a for/loop would be better.  Maybe someone could expand.

Also if you are not using version 1.4 (which has pre-populates the shipping fields carriers) you will need to use consistent names when you send shipping confirmation an match to your IF statements.  Like I said, not elegant but it gets me through it smile

In app/design/frontend/default/default/template/email/order/shipment/track.phtml

at the bottom change:

<td align="left" valign="top" style="padding:3px 9px"><?php echo $_item->getTitle() ?></td>
<
td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
TO:

<td align="left" valign="top" style="padding:3px 9px"><?php echo $_item->getTitle() ?></td>
<?php if ($_item->getTitle()=='United States Postal Service'): ?>
     
<td align="center" valign="top" style="padding:3px 9px"><a href "http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
<?php else: ?>
            <?php 
if ($_item->getTitle()=='United Parcel Service'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php else: ?>
                <?php 
if ($_item->getTitle()=='DHL'): ?>
                     
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
                
<?php else: ?>
                    <?php 
if ($_item->getTitle()=='Federal Express'): ?>
                         
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
                    
<?php else: ?>
                        
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
                    
<?php endif; ?>
                <?php 
endif; ?>
            <?php 
endif; ?>
  <?php 
endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
jetsetter
Member
 
Total Posts:  33
Joined:  2008-06-29
 

For Fed Ex:

<a href="http://www.fedex.com/Tracking?tracknumbers=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a>
 
Magento Community Magento Community
Magento Community
Magento Community
 
brianb421
Sr. Member
 
Total Posts:  196
Joined:  2009-04-23
 

Thank you! Works like a charm.

FYI - if you use different titles, such as UPS instead of United Parcel Service, you’ll want to change these in the code.

Or.... you can insert a few new lines:

Find:

<?php if ($_item->getTitle()=='United Parcel Service'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php else: ?>

And add after it:

<?php if ($_item->getTitle()=='UPS'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php else: ?>

then, add <?php endif; ?> to the bottom of the code where the rest of the <?php endif; ?> are.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brianb421
Sr. Member
 
Total Posts:  196
Joined:  2009-04-23
 

How would I call the Carrier name instead of the Title.

Instead of
<?php if ($_item->getTitle()==\’UPS\’)

I want it to say:
<?php if ($_item->getCarrierNameGoesHere()==\’UPS\’)

I tried getCarrier and getShippingCarrier, but that didn\’t seem to work.

Any ideas on what the get command is?

And would i have to enter any other code to call it up?

 
Magento Community Magento Community
Magento Community
Magento Community
 
strobolus
Jr. Member
 
Total Posts:  14
Joined:  2008-10-03
 
brianb421 - 05 October 2010 09:53 PM

How would I call the Carrier name instead of the Title.

Instead of
<?php if ($_item->getTitle()==\’UPS\’)

I want it to say:
<?php if ($_item->getCarrierNameGoesHere()==\’UPS\’)

I tried getCarrier and getShippingCarrier, but that didn\’t seem to work.

Any ideas on what the get command is?

And would i have to enter any other code to call it up?

Have you tried:
getCarrierTitle

not sure but it should work
let me know how it goes!
smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
fstrube
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2010-10-04
Alexandria, VA
 

getCarrierCode may work as well

 
Magento Community Magento Community
Magento Community
Magento Community
 
L7TLLC
Jr. Member
 
Total Posts:  5
Joined:  2009-11-02
 

Thank you for the code.  I used it on the Admin Panel - Sales - Order - View page.

For DHL, use:

<a href="http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=<?php echo $_item->getNumber() ?>" target="_blank"><?php echo $_item->getNumber() ?></a>
 
Magento Community Magento Community
Magento Community
Magento Community
 
roberthenderson
Jr. Member
 
Total Posts:  7
Joined:  2010-11-22
 

Hey guys, thanks for all your help.  I condensed your original code down a little bit to this and it works well for all 4 carriers.  Any word on whether getCarrier() works? Haven’t tested it.

Thanks.

<td align="left" valign="top" style="padding:3px 9px"><?php echo $_item->getTitle() ?></td>
            
<?php if ($_item->getTitle()=='United States Postal Service'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href "http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php elseif ($_item->getTitle()=='United Parcel Service'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php elseif ($_item->getTitle()=='DHL'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php elseif ($_item->getTitle()=='Federal Express'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://www.fedex.com/Tracking?tracknumbers=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php else: ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
            
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
roberthenderson
Jr. Member
 
Total Posts:  7
Joined:  2010-11-22
 

Hey guys, if you don’t want to use the Carrier Title in your code, you can use getCarrierCode().  The four codes are usps, ups, dhl, and fedex.  See new code below:

<td align="left" valign="top" style="padding:3px 9px"><?php echo $_item->getTitle() ?></td>
            
<?php if ($_item->getCarrierCode()=='usps'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href "http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php elseif ($_item->getCarrierCode()=='ups'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php elseif ($_item->getCarrierCode()=='dhl'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php elseif ($_item->getCarrierCode()=='fedex'): ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><a href="http://www.fedex.com/Tracking?tracknumbers=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
            
<?php else: ?>
                 
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
            
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
haligonia
Sr. Member
 
Total Posts:  97
Joined:  2009-02-28
 

I want to add a shipping method that isn\’t in this list. It is a third-party shipping module. How do I determine the precise value or string to use with the getTitle function for another shipping module other that these ones?

 
Magento Community Magento Community
Magento Community
Magento Community
 
coolshop
Sr. Member
 
Total Posts:  121
Joined:  2009-08-28
 

This works great!. Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
plu_australia
Sr. Member
 
Total Posts:  132
Joined:  2010-04-20
 

What about if you wanted to extend on this by replacing the default carrier titles with ones you actually use?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2