douyan8772 2016-07-07 16:42
浏览 35

交易电子邮件中的php变量/对象

I have a transactional email which resides here: System > Transactional Emails > Shipment Update

Here is what is inside of 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"}}

I have a block type and file which correlates with the email above and it's located here: /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; ?>

I store the track_number in our DB. Please see image below.

enter image description here

My question is how do i set my variables in the on the end of this URL which will be going to a third party site.

<a href="https://mystore.narvar.com/mystore/tracking/fedex?tracking_numbers=<?php echo $this->escapeHtml($_track->getTrackNumber()) ?>">Find tracking here</a>.
  • 写回答

1条回答 默认 最新

  • duanba7653 2016-09-05 15:54
    关注

    Try this:

    $order = $this->getData('order');
    

    As written in http://www.webspeaks.in/2011/06/customize-new-order-email-template-in-magento.html

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序