0

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>
    <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>
                </a>
                <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') ?>
                        </a>
                    </p>
                </div>
                <?php echo $this->getPriceHtml($_item, true, '-new') ?>
            </li>
        <?php endforeach; ?>
        </ol>
        <script type="text/javascript">decorateList('recently-viewed-items');</script>
    </div>
</div>
<?php endif; ?>

enter image description here

6
  • Your code pls??
    – Sundar
    Aug 18, 2015 at 7:12
  • Please add your codes, what you've already done! Aug 18, 2015 at 7:13
  • check my updated question
    – Magento 2
    Aug 18, 2015 at 7:15
  • @Manojkothari where did you add this code ? Aug 18, 2015 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, 2015 at 7:22

1 Answer 1

1

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

i.e.,

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

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.