我自己解决了这个问题。如果有人需要在发货电子邮件中添加价格,方法如下:
打开app/design/frontend/base/default/template/email/order/shipment/items.phtml并用这个替换所有代码:
<?php $_shipment = $this->getShipment() ?>
<?php $_order = $this->getOrder() ?>
<?php if ($_shipment && $_order): ?>
<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->__('Item') ?></th>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Price'); ?>:</th>
</tr>
</thead>
<?php $i=0; foreach ($_shipment->getAllItems() as $_item): ?>
<?php if($_item->getOrderItem()->getParentItem()) continue; else $i++; ?>
<tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
<?php echo $this->getItemHtml($_item) ?>
</tbody>
<?php endforeach; ?>
<tfoot>
<tr class="subtotal">
<td colspan="3" align="right" style="padding:3px 9px">
Subtotal
</td>
<td align="right" style="padding:3px 9px">
<span class="price"><?php echo $_order->formatPriceTxt($_order->getSubtotal()); ?></span>
</td>
</tr>
<tr class="shipping">
<td colspan="3" align="right" style="padding:3px 9px">
Delivery:
</td>
<td align="right" style="padding:3px 9px">
<span class="price"><?php echo $_order->formatPriceTxt($_order->getShippingAmount()); ?></span>
</td>
</tr>
<tr class="grand_total">
<td colspan="3" align="right" style="padding:3px 9px">
<strong>Total</strong>
</td>
<td align="right" style="padding:3px 9px">
<strong><span class="price"><?php echo $_order->formatPriceTxt($_order->getSubtotal() + $_order->getShippingAmount()); ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php endif; ?>
现在我们包含了总计,但我们需要在 tbody 中显示每种产品的价格。
所以打开app/design/frontend/base/default/template/email/order/items/shipment/default.phtml
之后
<?php $_item = $this->getItem() ?>
添加这个
<?php $_order = $this->getItem()->getOrder(); ?>
在关闭 tr 标记之前的代码末尾添加以下行:
<td align="center" valign="top" style="font-size:11px; padding:3px 9px;">
<?php echo $_order->formatPrice($_item->getPrice()); ?>