I am working on Magento2.2.1, I want to sort by rating. I have applied the below code but it's not working with Ajax neither Page load as well. Pagination is not coming.
$collection->getSelect()->joinLeft(
'rating_option_vote_aggregated',
'e.entity_id = rating_option_vote_aggregated.entity_pk_value',
array('vote_count' => 'SUM(rating_option_vote_aggregated.vote_count)'))
->group('e.entity_id')
->order('vote_count ' . $this->getCurrentDirectionReverse());
Can anyone please suggest
Best Answer
For pagination issue make plugin in your custom module like
create di.xml file under etc directory of your module
create plugin file