0

My order mail.phtml

 $_item = $block->getItem();
$_order = $_item->getOrder();
<tr>
    <td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>">
     <a href=<?php echo $_item->getProduct()->getProductUrl() ?>>
        <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>
        <p class="sku"><?= /* @escapeNotVerified */  __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p>
         <?php if($block->getConfig('sales_email/imageconfig/enabled')):?>
        <p class="sku">
            <img src="<?=$productImage?>" title="<?= $block->escapeHtml($_item->getName()) ?>" alt="<?= $block->escapeHtml($_item->getName()) ?>" />
        </p>
        <?php endif;?>

        <?php if ($block->getItemOptions()): ?>
            <dl class="item-options">
            <?php foreach ($block->getItemOptions() as $option): ?>
                <dt><strong><em><?= /* @escapeNotVerified */  $option['label'] ?></em></strong></dt>
                <dd>
                    <?= /* @escapeNotVerified */  nl2br($option['value']) ?>
                </dd>
            <?php endforeach; ?>
            </dl>
        <?php endif; ?>

here i were added getProduct()->getProductUrl() ?>>

this line for product link but not showing link in order mail

  • here how i can add product image (in email) – prabhakaran7 Mar 4 at 14:34
1

I think you miss the trick, use quotation mark in href

<a href="<?php echo $_item->getProduct()->getProductUrl() ?>">

I hope this will help

1

Try this:

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

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.