我有一个无法解决的问题。我想在发票电子邮件中的订购商品后显示发货邮件中的总计块。 (当订单状态从管理更改时) 这是我在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 \ shipment \ items.phtml中我添加了这个
<tfoot>
<?php echo $this->getChildHtml('invoice_totals'); ?>
</tfoot>
但没有任何事情发生。
任何人都可以帮助我吗?
答案 0 :(得分:2)
我自己解决这个问题。如果有人需要为发货邮件添加价格,请按以下方式进行:
打开 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()); ?>