I have a problem that can't solve all day. I want to display a totals block in shipment email after ordered items like in invoice email. (When order status is changed from administration) Here is my code in 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>
in template\\email\\order\\shipment\\items.phtml I added this
<tfoot>
<?php echo $this->getChildHtml('invoice_totals'); ?>
</tfoot>
but nothing happend.
Can anyone help me?
I solve this problem by myself. If anyone need to add prices to shipment email here is the way:
Open app/design/frontend/base/default/template/email/order/shipment/items.phtml and replace all code with this one:
<?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; ?>
Now we are included totals, but we need to display the price for each product in tbody.
So open app/design/frontend/base/default/template/email/order/items/shipment/default.phtml And after
<?php $_item = $this->getItem() ?>
add this
<?php $_order = $this->getItem()->getOrder(); ?>
at the end of code before closing tr tag add this lines:
<td align="center" valign="top" style="font-size:11px; padding:3px 9px;">
<?php echo $_order->formatPrice($_item->getPrice()); ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.