2

How to get customer recently viewed product collection, I am using below code but not working anyone has an idea for same... Bellow code always return Null or blank array

protected $recently_viewed;

    /**
     * @param \Magento\Catalog\Block\Product\Context $context
     * @param array $data
     */
    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Reports\Block\Product\Viewed $recently_viewed,
        array $data = []
    ) {
        $this->recently_viewed=$recently_viewed;
        parent::__construct($context, $data);
    }

public function getRecentProductCollection() {
        $collection=$this->recently_viewed->getItemsCollection();
        return $collection;
    }
  • Have u found a solution yet ? – Sarasranglt Jan 14 at 18:45
  • No, i left with this task , i tired a lots but not get anything – Navin Bhudiya Jan 16 at 4:00
  • +1 for I 'tired' ;) – Sarasranglt Jan 16 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.