我有一个问题整天都解决不了。我想在订购项目后,在发货电子邮件中显示总额块,如在发票电子邮件中。(订单状态从管理更改时)这是我在sales.xml 中的代码
<sales_email_order_shipment_items>
<block type="sales/order_email_shipment_items" name="items" template="email/order/shipment/items.phtml">
<action method="addItemRender"><type>default</type><block>sales/order_email_items_default</block><template>email/order/items/shipment/default.phtml</template></action>
<block type="sales/order_invoice_totals" name="invoice_totals" template="sales/order/totals.phtml">
<action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>
<action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
<block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml"/>
</block>
</block>
<block type="core/text_list" name="additional.product.info" />
</sales_email_order_shipment_items>
在template''email''order''shipping''items.html中,我添加了这个
<tfoot>
<?php echo $this->getChildHtml('invoice_totals'); ?>
</tfoot>
但什么也没发生。
有人能帮我吗?
我自己解决这个问题。如果有人需要在发货电子邮件中添加价格,这里是方法:
打开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/shipping/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()); ?>