Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a view that is set to show the number of stars as a numeral, not as the graphic of stars. Instead of showing the number of stars it is outputting the percentage...ie: 100 instead of "5".
Comment | File | Size | Author |
---|---|---|---|
#6 | fivestar_views_star_count.patch | 2.51 KB | quicksketch |
Comments
Comment #1
riddleyw CreditAttribution: riddleyw commentedAlso, if i select (in Views2, fields options) to display the field as a percentage, it outputs the field label, but no value. Btw, works fine, if i just use the graphic.
Comment #2
quicksketchThis isn't a bug, it's the way VotingAPI displays vote data. I'll move this to a feature request to make the number of stars be a display option.
Comment #3
Junro CreditAttribution: Junro commentedsubscribe :)
Comment #4
Flying Drupalist CreditAttribution: Flying Drupalist commentedSubscribe.
Comment #5
BoobaaSubscribe.
Comment #6
quicksketchI added this feature with the attached patch.
Comment #8
prabhatjn CreditAttribution: prabhatjn commentedHi,
I am opening this issue for drupal 7. It need work there.
Thanks,
Perry.
Comment #9
calefilm CreditAttribution: calefilm commentedIf I'm not mistaken, I believe this is an ongoing problem in D7? Here are three similar 2 Open/1 Closed threads with people having similar issues:
https://www.drupal.org/node/1440566
https://www.drupal.org/node/1113172
https://www.drupal.org/node/2040303 (#1 doesn't make any sense)
Am I wrong but if this was resolved we'd be able to close all 4 of these threads?
Anyway, I cannot seem to figure out a way to simply display the star rating as 4 instead of 80. There is no option for this? I figured it out in Drupal 6 but 7 is different.
GOAL:
Output simply displays 80... I would like the option to display 4 (as in 4 of 5)
SETTINGS A:
RELATIONSHIPS
Relationship: Vote Results
-percentage
-choose tag
-average vote
FIELDS
Field: Votes Value (Value)
choose relationship
These settings yielded same results
SETTINGS B:
RELATIONSHIPS
Relationship: Vote Results
-percentage
-choose tag
-average vote
FIELDS
Content: fivestar field
choose vote results relationship
Formatter: As stars, Rating, Percentage (Neither of which gives me the '4')
These settings yielded same results
Comment #10
calefilm CreditAttribution: calefilm commentedHere is a 'fix' to my 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;