I have solved this issue of getting product URL and thumbnail that goes to customer mail this is my code:

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

$imageHelper  = $objectManager->get('\Magento\Catalog\Helper\Image');
$image_url = $imageHelper->init($product, 'product_page_image_small')->setImageFile($product->getFile())->resize($imagewidth, $imageheight)->getUrl();
for showing product url:    <div class="product-name"><a href="<?= $_item->getProduct()->getProductUrl(); ?>"> <?= $block->escapeHtml($_item->getName()) ?></a></div>
For showing Image:<?= $image_url ?>

Now this have been done from customer perspective. when the same mail goes to seller changes are not reflecting to their email.

So how to make changes so that seller can see product URL & Thumbnail in his/her email to or his/her end.


  • Where you are writing this code ? Commented Feb 23, 2017 at 8:31
  • for customers its already done and iam getting email as a customer having both product image & url i have used default.html in magento/module-sales/view/frontend/templates/email/items/order but in order to get achieve same result what to do from seller perspective Commented Feb 23, 2017 at 8:39
  • iam using magento/module-sales/view/frontend/templates/email/items/order and magento/module-sales/view/frontend/templates/email/ for both default.html & items.phtml Commented Feb 23, 2017 at 8:40
  • kindly reply please? Commented Feb 23, 2017 at 9:41
  • do i have to use like {{block class="Magento\Framework\View\Element\Template" order=$order name="order_sms" template="magento_sales::items.phtml" area="frontend"}} <-items.phtl is for showing content so do i have to use items.phtml here or default.phtml what to put in name field? Commented Feb 23, 2017 at 10:54

1 Answer 1


What you are doing is not a proper way. You have to go with Magento coding pattern.

First you have to create a order email template and assign this template as order email :

  1. Create New email template : Goto Admin -> Marketing -> EmailTemplates -> Click On add New Template
  2. Load Order Template : In Template Dropdown Select “New Order” and click Load Template. It will load Default Order email template
  3. Update Order Template : You can set / change your template name, subject and content as you want and save it.
  4. Set Order Template : Go To Admin -> Stores -> Sales -> Sales Email -> “New Order Confirmation Template” and “New Order Confirmation Template for Guest” Here you have to select your newly created template from dropdown for order email.

Now this template is ready for your order email. Now you have to add order content in this template. For this you have to create a block file and call that block file in template content which you created.

To Create Order detail HTML with image and link :

For this you have to create a module (or in existing module). In that module you have to create a model file like : app/code/[vendor]/[module]/view/frontend/templates/[filename].phtml.

In this file you can get the order object like : $order = $this->getData('order');

Now you can put all your HTML with order detail which you want to send in email.

Call this HTML in email Template :

Edit the order email template which you created in Admin -> Marketing -> EmailTemplates To Call this HTML inside Order email content you have to put this code inside content area of email : {{block class="Magento\Framework\View\Element\Template" order=$order name="order_sms" template="[vendor]_[module]::[filename].phtml" area="frontend"}}

  • well i have already done for customer perspective.so is there any alternate way to get this functionality by editing files in magento which are responsible to send email to seller. i will try this method when i live run live site..its now testing site so i want to implement the method to display product thumbnail and product url in seller emails Commented Feb 23, 2017 at 10:11
  • Email will be the same for customer and admin both, there is no change in email template. Commented Feb 23, 2017 at 10:15
  • so why seller are getting email which doest reflect changes..only customer can see product url & images but seller cant....iam not talking about admin sir iam talking about seller..so any idea? Commented Feb 23, 2017 at 10:17
  • ok sir i have created the template but how to add product thumbnail image & product url to it? Commented Feb 23, 2017 at 10:41
  • put your same code in file app/code/[vendor]/[module]/view/frontend/templates/[filename].phtml. Whichever html is there in this file will go in email Commented Feb 23, 2017 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.