This question already has an answer here:

How to get a random collection of related products, using the below code,

protected function _prepareData() 
    $product = $this->_coreRegistry->registry('product');
   /* @var $product \Magento\Catalog\Model\Product */

   $this->_itemCollection = $product->getAlsoboughtProductCollection()->addAttributeToSelect(
    if ($this->moduleManager->isEnabled('Magento_Checkout')) {


    foreach ($this->_itemCollection as $product) {
    return $this;

marked as duplicate by Raphael at Digital Pianism, Qaisar Satti, Murtuza Zabuawala, Rajeev K Tomy, Khoa TruongDinh Nov 14 '16 at 13:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You can try with this line,

  • Sorry, No change still getting the same result – Krishnakumar C Nov 11 '16 at 11:25
  • Have you clear cache? remove var folder and check. – Rakesh Jesadiya Nov 11 '16 at 11:28

try this

$products = $this


$products = $products->getItems();

Not the answer you're looking for? Browse other questions tagged or ask your own question.