I have a ReviewCollection, im trying to each "Review/Product" get a product image so i can pass on and display on template file:

public function getCollection()
    $collection = $this->_reviewsColFactory->create()->addStoreFilter(

    $arr = array();
    foreach ($collection as $_review) {
        $days = $this->returnDays($_review);
        if ($days <= $this->_days) {
            if (!isset($arr[$_review->getSku()])) {
                $arr[$_review->getSku()]['cont'] = 1;
            } else {
            $arr[$_review->getSku()]['productUrl'] = $_review->getProductUrl();
            $arr[$_review->getSku()]['productName'] = $_review->getName();
            $arr[$_review->getSku()]['productImg'] = $_review->getImage();
    // arsort($arr);

    return $collection;

In that case is every $_review a Model/Product ? Ty

  • Please confirm whether you want to get the reviews collection by product sku ? – Nagaraju K Aug 11 '17 at 11:48

I found out that a review from \Magento\Review\Model\ResourceModel\Review\Product\CollectionFactory method getId returns the productID that i load ProductRepositoryInterface as follow :


Then i get ImageURL with Magento\Catalog\Block\Product\ListProduct as follow :

$imageBlock =  $this->getLayout()->createBlock('Magento\Catalog\Block\Product\ListProduct');
$productImage = $imageBlock->getImage($product, 'category_page_grid');

I have uploaded my code on GitHub if one needed, a review of my code would be nice. Ty.

Your Answer

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

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