1

In my store recently viewed products name only displayed, i need to visible images of recently viewed products.

enter image description here

1
  • check my code and comment me whether it is working or not please confirm me jeeva. thanks Mar 23, 2017 at 8:53

2 Answers 2

5

I have tried and got the solution add the below piece of code in the product_viewed.phtml in the specified path in between li tag

/app/design/frontend/base/default/template/reports/product_viewed.phtml

   <li class="item">
    <a href="<?php echo $_item->getProductUrl($_item) ?>">
    <span class="product-image">
    <img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" />
    </span>
    </a>
    <p class="product-name"><a href="<?php echo $this->getProductUrl($_item) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName() , 'name') ?></a></p>
   </li>
0

app/design/frontend/default/your_theme/template/reports/product_viewed.phtml.

Modified to add images

<?php if ($_products = $this->getRecentlyViewedProducts()): ?>
<div>
<div>
<strong><span><?php echo $this->__('Recently Viewed Products') ?></span></strong>
</div>
<div>
<ol id="recently-viewed-items">
<?php foreach ($_products as $_item): ?>
<li>
<p><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(50, 50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /> </p>
<p><a href="<?php echo $this->getProductUrl($_item) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName() , 'name') ?></a></p>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('recently-viewed-items');</script>
</div>
</div>
<?php endif; ?>

That’s it, you should now have product thumbnails above your product name, if not refresh your cache and then see if it works

11
  • There is no "reports" path in my root folder
    – Gem
    Sep 6, 2016 at 6:12
  • I f you have fresh magento installed check via rwd theme.
    – Arjun
    Sep 6, 2016 at 6:14
  • How can i use in my manual template
    – Gem
    Sep 6, 2016 at 6:15
  • I think you need to override product_viewed.phtml in your theme.
    – Arjun
    Sep 6, 2016 at 6:20
  • Am just replaced with your code, its not working,
    – Gem
    Sep 6, 2016 at 6:20

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.