I have a view which show a content with a Fivestar field (votes). The problem is that the field is shown as the percentage of votes, not like the stars, or the number (in fact I need to show the number instead of percentage).

I mean, my Fivestar field has 10 stars. Well then if, for example, a node has 7 stars, rather than see the 7 stars or the number of stars (7) is shown the percentage, 70.

What I have to do to show the number (in my example "7")?


I found a solution for my question: Hide your vote field in views ("Exclude from display"); then, add a Global field, the "global math expression", and in this field add a replacement token of your exclude field, in my case [value]. Finally add the mathematical expression to divide by 10 the number: [value]/10. Apply and save the view.


Here is a 'fix' to the issue: "How to show number of stars instead of percentage." I realized I could just as easily change the label of the formatter in fivestar.theme.inc, i.e. "4" instead of "4/5"

Step 1: In Views, edit your field. Set formatter to "Rating"
Step 2: Go to fivestar.theme.inc and edit line 137

Instead of $output = $rating . '/' . $stars;

I used

$output = $rating;

My full issue can be seen here: https://www.drupal.org/node/421800#comment-11792403


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.