how to add order tracking link on the order confirmation email
I want to send a order tracking link on the confirmation email that magento sends when a customer places an order,that link should take customer to main page or the tracking page of the courier company. can someone guide me
say for example i'm using a dhl for shipping of the orders placed by the customer & i want to add the field something like this on the confirmation email that magento sends to the customer when tha oredr is placed....
Track your Shipment at http://ww开发者_开发问答w.dhl.com/trackorder?trackingId=DC00392903
I've always wondered why Magento doesn't add a link to track shipments by default in the transactional emails, especially given that it provides this functionality on the site.
To add the shipping link to the Magento transactional emails, you can edit the block in your theme that generates that section. It's here: <theme>/template/email/order/shipment/track.phtml
Replace: (line 41)
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
With:
<?php $url = $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>
<?php if ($url): ?>
<td align="center" valign="top" style="padding:3px 9px"><a href="<?php echo $url ?>"><?php echo $_item->getNumber() ?></a></td>
<?php else: ?>
<td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getNumber() ?></td>
<?php endif; ?>
and voila, your emails now link to the Magento order tracker on your site. Granted, it's using the pop-up version in a full-screen, but it's better than nothing.
Or if you want it to go to the courier's page, you could use the code that's provided in this magentocommerce board post
If you want to add a link directly to the shipper's tracking:
base/default/template/email/order/shipment/track.phtml
Replace line 41 with this:
<?php $trackInfo = $_item->getNumberDetail()->getData(); ?>
<td align="center" valign="top" style="padding:3px 9px"><a href="<?php echo $trackInfo['url']; ?>"><?php echo $this->escapeHtml($_item->getNumber()); ?></a></td>
You can easily change and create e-mail templates under System - Transactional Mails. There you can create a new e.g. order confirmation mail and you can add your general tracking link there. You can find an overview over the variables you can use in the mail here. Afterwards, you can define to use the new mail template under System - Configuration - Sales - Sales Mails.
If you need an individual one, you first have to tell us where the tracking number is saved...
For package tracking you need to integrate with label printing. For FedEx, when you print the label you can provide a reference number which can be used to track "on demand" on FedEx.com. FedEx.com has recently added a new feature to also allow "event based tracking", user's automatically receive an email from FedEx.com when certain events occur, like package delivery, delivery failure, etc..
This extension fully integrates Magento with FedEx.com webservices: http://cobbconsulting.net/magento-fedex-extension.html
The extension allows you to print official FedEx shipping labels, with bar code.
It sends an email to the customer automatically with reference/tracking number when the package is shipped (it can also be customized to send when the order is placed for those who ship products on the same day it was ordered).
Finally, it also allows you to utilize "event based" tracking. Please see website for screenshots.
精彩评论