Add unit price to order email template


In the email sent to customer for order confirmation, product unit price does not show by default. It requires a little knowledge of Magento to make the customization. In this article, I will try to show you an easy way to do it.
Here is the result you will get after this customization:
There are 3 files you have to change, you should copy these files to the folder of your using theme.
1) app/design/frontend/base/default/template/email/order/items.phtml
Around line 32, find the following code:
<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="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
</tr>
and change into
<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="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Unit Price') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
<th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
</tr>
</thead>
2. app/design/frontend/base/default/template/email/order/items/order/default.phtml
Around line 48, below this line:
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
Add following code
<td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
<!-- Show Unit Price here -->
<?php
if ($this->helper('tax')->displaySalesPriceInclTax($_order->getStore())) {
$itemprice =  $this->helper('checkout')->getPriceInclTax($_item) ;
echo $this->helper('checkout')->formatPrice($itemprice);
} else {
echo $this->helper('checkout')->formatPrice($_item->getPrice()) ;
}
?>
<!-- END UNIT PRICE -->
</td>
3. app/design/frontend/base/default/layout/sales.xml
Open this file and search for "sales_email_order_items", it is around line 268. Find below line:
<action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>
and change it to
<action method="setLabelProperties"><value>colspan="4" align="right" style="padding:3px 9px"</value></action>
Upload all files and test an order to see the result. Happy coding!

Comments

Popular posts from this blog

Sort Products by popularity count in Magento

Category Name with Products in Cart Page Magento

Safe name of a file by php