0

Today I configured the Recently Viewed products in my local website, It is showing When Customer Login in front store otherwise it's not showing.

Is it Customer Session based or It will shown every Customer (Guest, General..etc)?

enter image description here

I want to show Recently Viewed products to everyone how can I configure this?

Any help?

5
  • where you have addred recently viewed product widget ? where you want to show it ? Commented Feb 7, 2017 at 6:53
  • @ManthanDave I want to show category List pages, My account pages, Home Page and Shopping Cart Page.
    – Bojjaiah
    Commented Feb 7, 2017 at 6:56
  • 1
    then go to that cms block and add recently viewed product widget over there .. it will show for all users Commented Feb 7, 2017 at 6:57
  • @ManthanDave Yes I have created Block with widget. Now how can I display this block on sidebar of above listed pages?
    – Bojjaiah
    Commented Feb 7, 2017 at 7:01
  • For few pages you can add from backend and for few pages you need to override template and need to add widget in that paritcular overrided template Commented Feb 7, 2017 at 7:09

2 Answers 2

1

Lets take an example for homepage. if you want to show "Recently Viewed Products" on your homepage follow below steps :

  1. Login to your admin panel
  2. Click on content - > Blocks - > Find Homepage Block

  3. Click on Homepage Block and edit then toggle show/hide editor , You will see insert widget option there

  4. Click on insert widget select "Recently Viewed Products" from dropdown , add number of product to display (ex - 5)

  5. Select template from dropdown then click on insert widget

  6. Click on save Block then go to the front side on homepage . View any product
  7. Back to the homepage you will see "Recently Viewed Product" over there.
3
  • I have followed your steps, still not showing {{widget type="Magento\Reports\Block\Product\Widget\Viewed" page_size="3" template="widget/viewed/column/viewed_default_list.phtml"}}
    – Bojjaiah
    Commented Feb 7, 2017 at 7:16
  • @magentotwo have you added it on homepage? its working fine for me by following above steps Commented Feb 7, 2017 at 8:06
  • If i extend this block, Magento\Reports\Block\Product\Widget\Viewed, It show constructor compatibility error
    – Jaisa
    Commented May 19, 2018 at 10:07
0

Recently viewed products shows visited products by one single visitor. Yes, it is bind by each visitor. If you made it work for all users without changing any code, most likely it is false. The block you say you added on homepage may be full page cached and homepage may look the same for all users.

I guess you could try to make a plugin on function Magento\Reports\Controller\Adminhtml\Report\Product\Viewed::getItemsCollection() This function has this:

if ($this->getCustomerId()) {
  $this->_collection->setCustomerId($this->getCustomerId());
}

You could try to setCustomerId(null) on recently viewed block.

Or create your block and inherit from Magento\Reports\Controller\Adminhtml\Report\Product\Viewed class or just from class Magento\Reports\Block\Product\AbstractProduct.

If your block gets cached in full page cache type, than it's another issue but can be done.

1
  • Yes, I think so, I will get back after I tried.
    – Bojjaiah
    Commented Feb 7, 2017 at 8:31

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.