Magento - 如何在交易电子邮件中插入产品图片 [英] Magento - How to insert product image in transactional email
本文介绍了Magento - 如何在交易电子邮件中插入产品图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,我想将产品图片包含在订购产品时发送的新订单电子邮件。
Basically I would like to include the product image to the New Order Email sent when ordering a product.
我开始在电子邮件/订单/项目/订单/默认.phtml这个代码
I started in email/order/items/order/default.phtml with this code
<?php $_item = $this->getItem() ?>
<?php $_order = $this->getItem()->getOrder() ?>
如何使用此代码获取图像?
How do I use this code to fetch the image?
Mage::helper('catalog/image')->init($_product, 'image')->resize(250)
感谢您的帮助:)
推荐答案
由于我早点找到了答案,所以我应该把它发贴到这里,以帮助其他需要的人.. ..)
Since I found the answer early I should post it here to help other s in need.. :)
<?php //added for sending image with order
$product = Mage::getModel('catalog/product')
->setStoreId($_item->getOrder()->getStoreId())
->load($_item->getProductId());
?>
<p align="center"><img src="<?php echo Mage::helper('catalog/image')->init($product, 'image')->resize(50); ?>" width="50" height="50" alt="" /></p>
只需将此代码段放在
<?php $_item = $this->getItem() ?>
<?php $_order = $this->getItem()->getOrder() ?>
注意:对于Gmail用户,请勿忘记启用显示图像..:)
NOTE: For gmail users, don't forget to enable Display Image.. :)
希望这有帮助!
这篇关于Magento - 如何在交易电子邮件中插入产品图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文