【发布时间】:2016-07-07 16:42:33
【问题描述】:
我有一封交易电子邮件,位于此处: System > Transactional Emails > Shipment Update
这是 Shipment Update 的内容:
{{block type="core/template" template="email/header.phtml"}}
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{htmlescape var=$order.getCustomerName()}},</h1>
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
Your order # {{var order.increment_id}} has been shipped and now has a status of <strong>{{var order.getStatusLabel()}}</strong>.
</p>
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by
<a href="https://mystore.narvar.com/mystore/tracking/fedex?tracking_numbers=<?php echo $this->escapeHtml($_track->getTrackNumber()) ?>">Find tracking here</a>.
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p>
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
{{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}
</p>
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}
</p>
<p style="font-size:12px; line-height:16px; margin:0;">
If you have any questions, please feel free to contact us at
<a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a>
or by phone at {{config path='general/store_information/phone'}}.
</p>
{{block type="core/template" template="email/footer.phtml"}}
我有一个与上面的电子邮件相关的块类型和文件,它位于:/email/order/shipment/track.phtml
<?php $_shipment=$this->getShipment() ?>
<?php $_order=$this->getOrder() ?>
<?php if ($_shipment && $_order && $_shipment->getAllTracks()): ?>
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Shipped By') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Tracking Number') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Tracking URL') ?></th>
</tr>
</thead>
<tbody>
<?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"><?php echo $this->escapeHtml($_item->getNumber());//getConsignmentNumber()) ?></td>
<?php $trackUrl = "https://mystore.narvar.com/mystore/tracking/fedex?tracking_numbers=";?>
<td align="center" valign="top" style="padding:3px 9px"><a href="<?php echo $trackUrl. $_item->getNumber();?>" target="_blank"><?php echo $trackUrl. $_item->getNumber();?></a></td> </tr>
<?php endforeach ?>
</tbody>
</table>
<?php endif; ?>
我将 track_number 存储在我们的数据库中。请看下图。
我的问题是如何在此 URL 末尾设置我的变量,该 URL 将转到第三方站点。
<a href="https://mystore.narvar.com/mystore/tracking/fedex?tracking_numbers=<?php echo $this->escapeHtml($_track->getTrackNumber()) ?>">Find tracking here</a>.
【问题讨论】:
-
你的最后一行到底有什么问题?在不知道特定于您的实现的信息的情况下,在 HTML 标记中添加 应该可以工作。您收到错误消息了吗?
-
Magento 交易变量不能这样工作。 =\
-
你能说得更具体点吗?你能在 Magento 中提取变量吗?你的代码到底是怎么回事?
标签: php email magento templates