Skip to content

Recently viewed products sidebar issue #659

@tzyganu

Description

@tzyganu

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
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions