I want to display a specific code in the order email, when a product attribute got the value yes.

Therefore I add the following code to my transactional e-mail:

{{block type='core/template' area='frontend' template='email/order/delivery.phtml' order=$order}}

In the specific email/order/delivery.phtml template I added the following code:

<?php $_item = $this->getItem() ?>
<?php $_product = Mage::getModel('catalog/product')->load($_item->getProductId()) ?>
<?php $_order = $this->getItem()->getOrder() ?>

<?php if ($this->escapeHtml($_item->getProduct()->getDates())== "Yes"): ?>
    <td class="method-info">
<?php endif; ?>

But sadly that does not work, what am I missing?

<?php $productId = $_item->getProduct()->getId(); ?>
<?php $product   = Mage::getModel('catalog/product')->load($productId); ?>
<?php $_order    = $this->getItem()->getOrder() ?>
<?php if ($product->getDates()) == "Yes"): ?> // check if you have well your dates attribute
<td class="method-info">
    <?php echo $this->__('Yes'); ?>
<?php endif; ?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.