I have a requirement to replace the default value of SKU on all transactional emails with the products ID.
The only way I have found to achieve this is to modify the files associated with these transactions, one example is to perform the following modification on this file:
/store_root/app/code/design/frontend/default/store_template/template/email/order/items/order/default.phtml
Replacing this line:
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
<?php
echo $Custom_Var = Mage::getModel('catalog/product')->load($_item['product_id'])
->getData('Id') ?>
</td>
With this line:
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
<?php $product = Mage::getModel('catalog/product')
->loadByAttribute('sku', $_item->getSku(), array('Id'));
echo $product->getId(); ?>
</td>
While this does work to display the products ID, it negatively impacts the Taxes breakdown on the bottom of the page by showing incorrect tax values as well as multiple tax values on the emails that are sent to the client.
Is modifying these files the best way to replace SKU with the Product ID if so, is the best code to use?
Note: I am aware of the other files involved, I am using this one as an example.