0

i have created and implemented the code to call product thumbnail and product url for "New Order Confirmation Template" thats is use for customers.my code is below

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($_item->getProduct()->getId());
$imagewidth=30;
$imageheight=30;
//$_product = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getProductId());
$imageHelper  = $objectManager->get('\Magento\Catalog\Helper\Image');
$image_url = $imageHelper->init($product, 'product_page_image_small')->setImageFile($product->getFile())->resize($imagewidth, $imageheight)->getUrl();

    <div class="product-name"><a href="<?= $_item->getProduct()->getProductUrl(); ?>"> <?= $block->escapeHtml($_item->getName()) ?></a></div>
    <div class="sku"><?= /* @escapeNotVerified */  __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></div>
    <div class="sku"><a href="<?= $_item->getProduct()->getProductUrl(); ?>"> <img src="<?= $image_url?>"></a></div>

This is my code which iam using in module-sales/view/frontend/templates/email/items/order in default.html. now this template get called in module-sales/view/frontend/templates/email items.phtml to call default.phtml contents.

now my query is when i order something this customized mail along with product thumbnail and product url is going to customers but its not going to seller.

now what i have done is create an email template via sales configuration and callingthe same items.phtml block as below

Thank you{{config path="trans_email/ident_custom1/name"}} for your order.

{{block class="Magento\Framework\View\Element\Template" order=$order name="order_sms" template="module_sales::items.phtml" area="frontend"}}

when iam seeing my customized mail iam getting only Thank youCustom 1 for your order. and the block which i have mentioned at top is not reflecting. what is the issue and can please any body tell me what default email template is use to send out to new guest so that i can customize it accordingly confused.

  • so i want to add product thumbnail and product url in order_new_guest.html. how to achieve that sir? earlier you have told me about adding same coding in default.phtml and it worked but only for customer. how to add same thing in order_new_guest.html ?so that product thumbnail and product url is visible to seller also – Yogesh Raghav Feb 24 '17 at 5:53
0

This is path of email template magento-slaes/view/frontend/email/order_new_guest.html

the difference between the layout handles order_new_guest

{{layout handle="sales_email_order_items" order=$order}}

order_new

{{layout handle="sales_email_order_items" order=$order area="frontend"}}

Now adding the are in gues template and then check area="frontend"

{{layout handle="sales_email_order_items" order=$order area="frontend"}}
| improve this answer | |
  • so i want to add product url & product thumbail in that so that seller can see the same.how to ahieve this sir?ealier i have done in default.phtml and it worked but how to achieve the same using html file? i want to show same product thumbnail and product url in the email template goes to seller – Yogesh Raghav Feb 24 '17 at 5:55
  • @YogeshRaghav i added the possible solution for that – Qaisar Satti Feb 24 '17 at 5:56
  • where i suppose to add this code sir? in email-template content or directly in order_new_guest.html nad where to place it sir? – Yogesh Raghav Feb 24 '17 at 6:03
  • @YogeshRaghav yes change in the template html file and check the output – Qaisar Satti Feb 24 '17 at 6:04
  • sir i have changed the template as u said but seller is not getting the same email.product link and images are missing in that email. i have registered as seller ,assigned product and tried my self but as a customer i got email along with product link and images but when i logged in my emiam as a seller iam not getting mail along with images and product url. where is the issue sir? – Yogesh Raghav Feb 24 '17 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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