0

i need a filter review by name or date and by sort in magento 2.3 product review tab , so customer can easily search best review how can implement this functionality?

2 Answers 2

1

You can use this free extension available and use it accordingly. https://landofcoder.com/advanced-magento-2-product-reviews.html

0
0

Please use the code to sort review.

This code is for sort by ratings.

$countColumn = new \Zend_Db_Expr("COUNT(*)");
$percentColumn = new \Zend_Db_Expr("SUM(percent)/".$countColumn );

$this->_reviewsCollection->getSelect()->joinLeft(
   ['rating_vote'=>$this->_reviewsCollection->getTable('rating_option_vote')],
   'rating_vote.review_id=main_table.review_id',
   ['sum' => 'SUM(percent)', 'count' => $countColumn, 'average' => $percentColumn]);

$this->_reviewsCollection->getSelect()->group('rating_vote.review_id');

$this->_reviewsCollection->getSelect()->order('average desc');

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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