When a customer places an order they receive an order confirmation email. In that email – below where the line items are displayed – the Subtotal, Shipping & Handling and Grand Total are outputted.
What I'm trying to do is show that same thing on the shipping notification email. I'm a magento newb, so what I typically do is find the core template that handles this and copy it into my local folder to make the changes.
So I copied : app/design/frontend/base/default/template/email/order/shipment/items.phtml
to: app/design/frontend/default/mytheme/template/email/order/shipment/items.phtml
Here's what that file looks like (with some of my customizations already):
<?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">Item #</th>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item Name') ?></th>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px;text-align:center;">Unit <br />Price</th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px;text-align:center;">Shipped<br />Quantity</th>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px;;text-align:center;">UOM</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; ?>
</table>
<?php endif; ?>
When I look in the file app/design/frontend/base/default/template/email/order/invoice/items.phtml
which has the totals I want to display on the shipping template, it looks like the portion of code that controls it is here:
<tfoot>
<?php echo $this->getChildHtml('invoice_totals')?>
</tfoot>
So I've pasted that into my shipping items.phtml but the totals are not displaying. Can anyone point me in the right direction? I feel like I'm close but am still missing something.
Best Answer
Found out the issue. I should not have been using the code sample from
app/design/frontend/base/default/template/email/order/invoice/items.phtml
but should have used this snippet of codefrom here
app/design/frontend/base/default/template/email/order/items.phtml
In addition to that, my sales.xml file had to be modified, specifically the
<sales_email_order_shipment_items>
block to mimic what is found in<sales_email_order_items>
: