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?