• Resolved michie21

    (@michie21)


    Hi,

    Thanks for the great plugin.

    I have an issue. When I select “Sort by rating” via AJAX-filtering. Items are sorted by average rating and after that on standard order.

    When I refresh the page: https://shinyrating.com/?orderby=rating, the correct order is shown (besides some minor mistakes based on low review count).

    I want the items to be sorted on:
    – 1. Average rating
    – 2. Number of reviews

    I understand this is not standard function, but can u please provide some information about where and how the sorting of rating is handled?

    Thanks in advance!

    EDIT:

    I found this in /modules/woofilters/controller.php, this seems to be the correct code snippet. How to add “meta_rating_count”?

    case ‘rating’:
    $args[‘meta_key’] = ‘_wc_average_rating’; // @codingStandardsIgnoreLine
    $args[‘orderby’] = array(
    ‘meta_value_num’ => ‘DESC’,
    ‘ID’ => ‘DESC’,
    );

    • This topic was modified 3 years, 8 months ago by michie21.
    • This topic was modified 3 years, 8 months ago by michie21.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Sort by rating AND rating count not working’ is closed to new replies.