Sort Category Listing by number of reviews

Hello everyone,

I have been trying to sort the category listing by number of reviews, I mean, if for example one of the products in the category listing has 10 reviews then it should appear first and then the ones with less reviews, 9, 8, 7 and so on. And if the product does not have reviews, then display the best seller.

Can someone explain me how to achieve that?

I was checking the code:

{foreach $sArticles as $sArticle}
  {include file="frontend/listing/box_article.tpl"}
{/foreach}

Trying to find a way to sort it but as I am new working with Shopware, didn’t have an idea.

Thanks in advance,

Daniel.

Hi Daniel,

in the smarty template you only get one page of articles. So if you sort this array you would miss articles which might be on another page with a higher ranking. You need to extend the SearchBundle according to this tutorial: https://developers.shopware.com/developers-guide/shopware-5-search-bundle/#list-of-conditions-and-sortings

You need to add a new sorting => Add a new sorting and implement a sorting handler.

Best regards

@simkli schrieb:

Hi Daniel,

in the smarty template you only get one page of articles. So if you sort this array you would miss articles which might be on another page with a higher ranking. You need to extend the SearchBundle according to this tutorial: https://developers.shopware.com/developers-guide/shopware-5-search-bundle/#list-of-conditions-and-sortings

You need to add a new sorting => Add a new sorting and implement a sorting handler.

Best regard

Thanks for your help simkli, the only problem I have is, that as I am new working with shopware, I don’t have idea how to proceed. Do you have a link where I can read about how to extend the SearchBundle for newbies?

Hi Daniel,

first you should get the gist about

Then you can read about"How to extend an existing service in shopware".

I know it’s a lot to read but you need to know this in order to realize your idea. Otherwise you can contact a partner agency https://en.shopware.com/partner/list

Best regards