Question

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

Was it helpful?

Solution

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

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

I hope this will help

OTHER TIPS

Try this:

<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
      $product = $objectManager->create('Magento\Catalog\Model\Product')->load($_item- 
                  >getProduct()->getId());
       $product_url = $product->getProductUrl(); ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top