0

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">
        <h6>Dates</h6>
        Yes
    </td>
<?php endif; ?>

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

1
<?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">
    <h6>Dates</h6>
    <?php echo $this->__('Yes'); ?>
</td>
<?php endif; ?>

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.