Skip to main content
Notice removed Authoritative reference needed by CommunityBot
Bounty Ended with Aditya Shah's answer chosen by CommunityBot
Updated content
Source Link
Jaimin Sutariya
  • 11.1k
  • 5
  • 36
  • 71

Product Image in invoice email template

I triedam trying to get imageproduct images for invoice email template. I used below code. Just i'mBut I am only getting magentoMagento placeholder image in email template.

<td>
        <?php 
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $product_id = $_item->getOrderItem()->getProduct();
        $product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

        $_imagehelper = $objectManager->get('Magento\Catalog\Helper\Image');
        $image_url = $_imagehelper->init($product, 'cart_page_product_thumbnail')->getUrl();

        ?>
          <img src="<?php echo $image_url; ?>" alt="<?php echo $product->getName(); ?>" />
    </td>

Please help to solve this solution.

Thank you.

Image in invoice email template

I tried to get image for invoice email template. I used below code. Just i'm getting magento placeholder image in email template.

<td>
        <?php 
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $product_id = $_item->getOrderItem()->getProduct();
        $product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

        $_imagehelper = $objectManager->get('Magento\Catalog\Helper\Image');
        $image_url = $_imagehelper->init($product, 'cart_page_product_thumbnail')->getUrl();

        ?>
          <img src="<?php echo $image_url; ?>" alt="<?php echo $product->getName(); ?>" />
    </td>

Please help to solve this solution.

Thank you.

Product Image in invoice email template

I am trying to get product images for invoice email template. I used below code. But I am only getting Magento placeholder image in email template.

<td>
    <?php 
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $product_id = $_item->getOrderItem()->getProduct();
    $product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

    $_imagehelper = $objectManager->get('Magento\Catalog\Helper\Image');
    $image_url = $_imagehelper->init($product, 'cart_page_product_thumbnail')->getUrl();

    ?>
      <img src="<?php echo $image_url; ?>" alt="<?php echo $product->getName(); ?>" />
</td>
Tweeted twitter.com/StackMagento/status/1116627184045551616
Notice added Authoritative reference needed by Priya
Bounty Started worth 100 reputation by Priya
Source Link
Priya
  • 589
  • 5
  • 31

Image in invoice email template

I tried to get image for invoice email template. I used below code. Just i'm getting magento placeholder image in email template.

<td>
        <?php 
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $product_id = $_item->getOrderItem()->getProduct();
        $product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

        $_imagehelper = $objectManager->get('Magento\Catalog\Helper\Image');
        $image_url = $_imagehelper->init($product, 'cart_page_product_thumbnail')->getUrl();

        ?>
          <img src="<?php echo $image_url; ?>" alt="<?php echo $product->getName(); ?>" />
    </td>

Please help to solve this solution.

Thank you.