I have a load of restaurant reviews. Each review provides rating of 4 different criteria - food, service, ambience and value. I wanted to make a page showing a table showing the top 5 restaurants for each of these criteria. Looking at the modules documentation the following should work:
{exp:rating:rankings form_name="restaurants" orderby="avg_food_rating" sort="desc" limit="5"}
But it would appear that you cannot do orderby="some_custom_rating_field", as stated in the docs.
Thanks to another post on this forum I eventually solved this by hacking mod.rating.php.
I changed the following (found at about line 844) from:
$q = array(
'overall_count' => 'count',
'overall_sum' => 'sum',
'overall_avg' => 'avg'
);
to:
$q = array(
'overall_count' => 'count',
'overall_sum' => 'sum',
'overall_avg' => 'avg',
'avg_food_rating' => 'avg_4',
'avg_service_rating' => 'avg_5',
'avg_ambience_rating' => 'avg_6',
'avg_value_rating' => 'avg_7'
);
So that problem was fixed. Then I noticed another oddity. I want the top 5 restaurants in the table so I had used limit="5" but I only get 4 results. Whatever number I put in limit="x" I always get one less than I should.
Best regards
Martin
