Magento - How to insert product image in transactional email

Magento - How to insert product image in transactional email

July 19, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - How to insert product image in transactional email

Incorporating Product Images into Magento Transactional Emails

When it comes to enhancing customer experience in Magento, including product images in transactional emails like order confirmations can significantly improve visual appeal and clarity. Let’s dive into how you can effectively incorporate product images into your New Order Email.

Understanding the Process

The core of this process lies in leveraging Magento’s built-in email templates and its catalog image helper. The email/order/items/order/default.phtml file is where we’ll start, as it contains the main loop for rendering order items.

Fetching the Product Object

First, ensure you have retrieved both the item object ($_item) and the order object ($_order) within your template:

<?php $_item = $this->getItem() ?>
<?php $_order = $this->getItem()->getOrder() ?>

These objects will serve as our starting point for accessing product details.

Initializing the Image Helper

Next, we’ll initialize Magento’s catalog image helper within your template. This helper provides a convenient way to work with product images:

<?php $_product = Mage::helper('catalog/product')->getProduct($_item->getId()); ?>

In this line, we’re fetching the product object using the item ID from the email/order/items/order/default.phtml template. The Mage::helper('catalog/product') call retrieves the catalog helper, which then fetches the actual product object.

Resizing and Outputting the Image

Now that we have the product object, we can use it to output an image:

<?php $productImage = Mage::helper('catalog/image')
    ->init($_product, 'image')
    ->resize(250); ?>

<img src="<?php echo $this->escapeHtml($productImage) ?>" width="250" height="318">

This code does the following:

  • Mage::helper('catalog/image') fetches the catalog image helper.
  • The init($_product, 'image') call initializes the image for a specific product using the ‘image’ attribute set.
  • The resize(250) method resizes the image to a width of 250 pixels. You can adjust this value based on your email template’s design.

The resulting <img> tag outputs the resized product image within your New Order Email.

Conclusion

Incorporating product images into Magento transactional emails is a powerful way to enhance user experience and help customers better understand their orders. By leveraging Magento’s built-in helpers, you can easily integrate product images without needing to manually handle image paths or file management.

Remember, always ensure your email template designs are clean and mobile-friendly for optimal customer engagement.

For more advanced customizations and best practices in Magento development, feel free to explore the resources at Laravel Company.

Catalog Themes Email Orders

Our network