Skip to main content

protected $recentlyViewed;

public function __construct( ... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) { ... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){

protected $recentlyViewed;

public function __construct(
...
    \Magento\Reports\Block\Product\Viewed $recentlyViewed
) {
...
    $this->recentlyViewed = $recentlyViewed;
}

/**
 * Get recently viewed products for the customer
 *
 */
public function getMostRecentlyViewed(){

    return $this->recentlyViewed->getItemsCollection();

}

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set cacheable="false" for custom block. Please let me know if you still face same issue.

protected $recentlyViewed;

public function __construct( ... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) { ... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){

return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set cacheable="false" for custom block. Please let me know if you still face same issue.

protected $recentlyViewed;

public function __construct(
...
    \Magento\Reports\Block\Product\Viewed $recentlyViewed
) {
...
    $this->recentlyViewed = $recentlyViewed;
}

/**
 * Get recently viewed products for the customer
 *
 */
public function getMostRecentlyViewed(){

    return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set cacheable="false" for custom block. Please let me know if you still face same issue.

added 1 character in body
Source Link

protected $recentlyViewed;

public function __construct( ... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) { ... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){

return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set acheable="false"cacheable="false" for custom block. Please let me know if you still face same issue.

protected $recentlyViewed;

public function __construct( ... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) { ... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){

return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set acheable="false" for custom block. Please let me know if you still face same issue.

protected $recentlyViewed;

public function __construct( ... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) { ... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){

return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set cacheable="false" for custom block. Please let me know if you still face same issue.

added 4 characters in body
Source Link

protected $recentlyViewed;

public function __construct(

\Magento\Reports\Block\Product\Viewed $recentlyViewed

... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) {

$this->recentlyViewed = $recentlyViewed;

... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){ return $this->recentlyViewed->getItemsCollection();

return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set acheable="false" for custom block. Please let me know if you still face same issue.

protected $recentlyViewed;

public function __construct(

\Magento\Reports\Block\Product\Viewed $recentlyViewed

) {

$this->recentlyViewed = $recentlyViewed;

}

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){ return $this->recentlyViewed->getItemsCollection(); }

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set acheable="false" for custom block. Please let me know if you still face same issue.

protected $recentlyViewed;

public function __construct( ... \Magento\Reports\Block\Product\Viewed $recentlyViewed ) { ... $this->recentlyViewed = $recentlyViewed; }

/**

  • Get recently viewed products for the customer

*/ public function getMostRecentlyViewed(){

return $this->recentlyViewed->getItemsCollection();

}

This code is working and it'll return according to customer session.

If you disabled Full Page cache then it'll display recently viewed prdocuts.

You need to set acheable="false" for custom block. Please let me know if you still face same issue.

deleted 6 characters in body
Source Link
Loading
Source Link
Loading