Add tracking link to mail
-
16-10-2019 - |
Question
How do I add a tracking link to mail template?
Here is what I tried:
In System > Transactional Emails
I opened the template for Shipment Email Template for Guest (GLOBAL)
. I thought tracking numbers are included here:
{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml'
shipment=$shipment order=$order}}
So I copied email/order/shipment/track.phtml
into my template and added a tracking link but it does not show up in the email:
<td align="center" valign="top" style="padding:3px 9px"><a href="http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?></a></td>
Solution
The problem is that this is PHP code:
<td align="center" valign="top" style="padding:3px 9px">
<a href="http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=
<?php echo $_item->getNumber() ?>">
<?php echo $_item->getNumber() ?></a>
</td>
You can't execute PHP from inside of an email template - instead, look to a tutorial to implement:
Or an extension:
http://ecommerce.aheadworks.com/magento-extensions/mobile-order-tracking.html
This plugin has the following feature which sounds handy to insert into your transactional shipment email: "Ability to insert order tracking link via widget and CMS"