-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Description
If I haven't viewed any products in the current session, the recently viewed products block on the sidebar still appears but it only shows the title Recently Viewed Products
.
The problem originates from app/code/Magento/Reports/view/frontend/templates/product_viewed.phtml
This is the condition that checks if the block should appear
<?php if ($_products = $this->getRecentlyViewedProducts()): ?>
But $this->getRecentlyViewedProducts()
always returns an instance of Magento\Reports\Model\Resource\Product\Index\Viewed\Collection
that evaluates to true
even if there are no items in the collection. A getSize
or count
restriction should solve this (but you already know that).
Metadata
Metadata
Assignees
Labels
No labels