简体   繁体   中英

Adding custom product attribute to transactional emails in Magento 1.9

I need to print two text attributes below the item ordered in a magento new order template. I've searched and found multiple ways, but they do not seem to work for 1.9 as far as I tried. Perhaps I'm doing it wrong, but it never seems to be explained clearly.

Sample code as follows:

<tr>
    <td class="order-details">
        <h3>Your order <span class="no-link">#{{var order.increment_id}}</span></h3>
        <p>Placed on {{var order.getCreatedAtFormated('long')}}</p>
    </td>
</tr>
<tr class="order-information">
//preferably custom product attribute prints here
    <td>
        {{if order.getEmailCustomerNote()}}
        <table cellspacing="0" cellpadding="0" class="message-container">
            <tr>
                <td>{{var order.getEmailCustomerNote()}}</td>
            </tr>

I'm new to magento, but I'd like to get this right. Could anyone please point me in the right direction to get the two custom product attributes to print in the 1.9 email template?

//$order =order object
foreach($order->getAllItems() as $item){    
      $product=Mage::getModel('catalog/product')->load($item->getProductId());
      echo  Mage::helper('catalog/image')->init($product, 'small_image')->resize(50,50);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM