I added recently viewed product block in home page it's fetching properly recent view product if i used same code in some other page it working fine. I don't know what is the problem can you please suggest

<?php if ($_products = $this->getRecentlyViewedProducts()): ?>
<div class="block block-list block-viewed">
    <div class="tittle_block">
<div class="tittle">Recently Viewed Product</div>
    <div class="block-content slideshow-container"> <!-- Added a class for parent container-->
        <ol id="recently-viewed-items"> <!-- Added a class for container-->
        <?php foreach ($_products as $_item): ?>
            <li class="item">
                <a href="<?php echo $this->getProductUrl($_item) ?>">
                    <span class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(185, 185)->setWatermarkSize('30x10'); ?>" width="185" height="185" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
                <div class="product-details">
                    <p class="product-name">
                        <a href="<?php echo $this->getProductUrl($_item) ?>">
                            <?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName() , 'name') ?>
                <?php echo $this->getPriceHtml($_item, true, '-new') ?>
        <?php endforeach; ?>
        <script type="text/javascript">decorateList('recently-viewed-items');</script>
<?php endif; ?>

enter image description here

  • Your code pls?? – Sundar Aug 18 '15 at 7:12
  • Please add your codes, what you've already done! – Rahul Kumar Das Aug 18 '15 at 7:13
  • check my updated question – Magento 2 Aug 18 '15 at 7:15
  • @Manojkothari where did you add this code ? – Rajeev K Tomy Aug 18 '15 at 7:17
  • I added in my theme /template/reports/product_viewed.phtml. After that i call in this way {{block type="core/template" template="reports/product_viewed.phtml"}} – Magento 2 Aug 18 '15 at 7:22

You have to call the recently viewed product in cms with block type reports/product_viewed


{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}

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.