Based on http://www.webspeaks.in/2011/06/customize-new-order-email-template-in.html and http://www.magentocommerce.com/boards/viewthread/43928/ I created a custom email template.
However after many hours I can't figure out how to get the item's custom options to display in the email.
In the default email code (located at \app\design\frontend\base\default\template\email\order\items\order\default.phtml) there're these lines:
<?php if ($this->getItemOptions()): ?>
<dl style="margin:0; padding:0;">
<?php foreach ($this->getItemOptions() as $option): ?>
<dt><strong><em><small><?php echo $option['label'] ?></small></em></strong></dt>
<dd style="margin:0; padding:0 0 0 9px;">
<?php echo (isset($option['print_value']) ? $option['print_value'] : nl2br($this->escapeHtml($option['value']))) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
But using that code in my .phtml dosn't show anything.
Here's my code:
<?php $_order = $this->getOrder() ?>
<?php $i=0; foreach ($_order->getAllItems() as $_item): ?><?php if($_item->getParentItem()) continue; else $i++; ?>
<?php echo $this->__('(') ?><?php echo $_item->getQtyOrdered()*1 ?><?php echo $this->__(') ') ?>
<strong><?php echo $this->htmlEscape($_item->getName()) ?></strong>
<?php echo $this->__('$') ?><?php echo number_format($_item->getRowTotal(), 2) ?>
<br />
<?php if ($this->getItemOptions()): ?>
<?php foreach ($this->getItemOptions() as $option): ?>
<strong><em><small><?php echo $option['label'] ?></small></em></strong>
<?php echo (isset($option['print_value']) ? $option['print_value'] : nl2br($this->escapeHtml($option['value']))) ?>
<?php endforeach; ?>
<?php endif; ?>
<?php echo $this->__("-------------------") ?>
<br />
<?php endforeach; ?>
<br />
<?php echo $this->__('Subtotal: $') ?><?php echo number_format($_order->getSubtotal(), 2) ?>
<br />
<?php echo $this->__('Tax: $') ?><?php echo number_format($_order->getTaxAmount(), 2) ?>
<br />
<strong><?php echo $this->__('Grand Total: $') ?><?php echo number_format($_order->getGrandTotal(), 2) ?></strong>
I tried using $_item->getItemOptions()) but didn't help.
I'd really appreciate if anyone can help with the correct syntax (I hope that's all I'm missing).
Thank you.