<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>

This code suppose to output the recently viewed products on category page or product page (by inserting the code in .phtml files). and this has been always working for me on my Magento sites.

However I have experienced that for one site (Magento, this code isn't working at all. and for this site, the widget to show recently viewed product doesn't work either.

Any ideas what can cause the "recently viewed products" isn't working?

  • 1
    This code looks good, not sure why not working for you.
    – Sohel Rana
    Apr 28, 2019 at 16:21
  • @SohelRana Can it be the custom themes that cause the issue, or this code will output the recently viewed products regardless the theme? Apr 28, 2019 at 19:53
  • This code is not depends on theme. But if your module overwrite template or something this would be problem.
    – Sohel Rana
    Apr 29, 2019 at 4:51
  • @SohelRana This code is working now, without I've done anythong. It's wierd. Can cron job effect this? May 10, 2019 at 8:18

1 Answer 1


Please Check whether your static block is whitelisted in admin panel, this could be one of the reasons the widget content might not be showing up in the frontend.

Refer the below link

Static Block Whitelist issue

  • Just checked. Everything is set to allowed under system -> permissions -> blocks Apr 27, 2019 at 8:55

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.