1

I need to implement ratings in my site. I have user five star rating and voting API module, I created a content_type with "beach", and created some field in the manage field settings, name, id, etc. And also I configured the five star module with tags like location ratings, beachratings, facilites ratings and overall (average ratings) ratings. I display all the rating stars in the page by using the code.

$bid=explode("/",$_GET['q']);
$node = node_load($bid['1']);// we get the node id here//
$fivestar = field_view_field('node', $node, 'field_overall_ratings');
echo render($fivestar);
$beachrating=field_view_field('node', $node, 'field_beaches_ratings');
echo render($beachrating);
$locationrating=field_view_field('node', $node, 'field_location_ratings');
echo render($locationrating);
$easyrating=field_view_field('node', $node, 'field_easy_to_get');
echo render($easyrating);

When I submit the ratings, they are stored in the database but the average is not updating. But I need to calculate the overall ratings when the user votes for the three section. Can anyone help me how can we implement this in my site?

0

Use fivestar_get_votes to get individual widgets average and get average of them to have average rating of the entire node.

  • hi nikhil , can send me some examples how can i use in the site and field , are alter the code code let me use that and check – Bala 007 Aug 9 '13 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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