0

Currently, reviews for each product only display assigned to one product. https://prnt.sc/rhmt1q

Any solution to display all opinions in this tab from the website and add above each opinion the name of the product to which the opinion relates?

We sell clothing, so the products change dynamically and are not likely to return the same models. That is why we want to display all opinions from the website.

  • You mean every product's review will display in that tab? – Sagar Parikh SGR Mar 17 at 9:32
1

Please override the file:

Magento/vendor/magento/module-review/Block/Product/View.php

Find:

public function getReviewsCollection()
{
    if (null === $this->_reviewsCollection) {
        $this->_reviewsCollection = $this->_reviewsColFactory->create()->addStoreFilter(
            $this->_storeManager->getStore()->getId()
        )->addStatusFilter(
            \Magento\Review\Model\Review::STATUS_APPROVED
        )->addEntityFilter(
            'product',
            $this->getProduct()->getId()
        )->setDateOrder();
    }
    return $this->_reviewsCollection;
}

and replace it with:

public function getReviewsCollection()
{
    if (null === $this->_reviewsCollection) {
        $this->_reviewsCollection = $this->_reviewsColFactory->create()->addStoreFilter(
            $this->_storeManager->getStore()->getId()
        )->addStatusFilter(
            \Magento\Review\Model\Review::STATUS_APPROVED
        )->setDateOrder();
    }
    return $this->_reviewsCollection;
}

you can see that I removed addEntityFilter for productId which is use for the validation.

Let me know if you need any further help

| improve this answer | |

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.