Closed (won't fix)
Project:
Fivestar
Version:
6.x-1.14
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2007 at 15:36 UTC
Updated:
10 Apr 2016 at 09:54 UTC
Jump to comment: Most recent
Comments
Comment #1
vzey commentedI really need this, but don't know how to make it work.
What if there was a way to use the 10 star option, and have each alternative star show up as half, and just put each pair close together to give the illussion of having five stars? There must be some smart cookie out there who can make this happen :)
Comment #2
quicksketchYup, there's an 'even' and 'odd' CSS class put on every star, so you just have to write the css necessary to display the first half of a star on every odd star and the second half of a star on the second have and then you'll have voting in halves.
Comment #3
moshe weitzman commentedyou can setup a 1-10 schema with css as quicksketch suggests. so it will look like you can vote with half stars. but unless you fiddle some more, your ratings will be recorded as with scores up to 10, and not 5. so appearance fiddling is not enough I think. needs some code changes.
Comment #4
domesticat commentedAgreed. This would be useful to me as well. I'm considering offering to help someone convert his movie-reviews site to drupal, and he rates in half-star increments. I fear this not having this feature will be a deal-breaker.
Comment #5
quicksketchAll results are stored in VotingAPI from 1-100, so the number of stars you use doesn't affect the data storage. In a 5 star system, 1 star is stored as 20. In a 10 star system, 2 stars are stored as 20 (3 stars as 30). No code changes should be necessary other than CSS changes.
Comment #6
Anonymous (not verified) commentedThe module would have to be modified if you wanted to use half star ratings. Using Css you can successfully change the stars to look like half stars and it functions pretty well but the first problem I ran into is when the average is calculated for the stars. When the average is calculated the fivestar.js adds a style="width: 50%" which will make your stars 1/2 smaller and when they are already 1/2 smaller it will make them 1/4 the size destroying appearance. Also you would have to change the code that displays the averages because using a css only method would store the vote as an 8 when it is supposed to be a 4. And a vote of 4.5 would be stored as a 9 and when 8 and 9 are average together the average that is displayed is 8.5.
Comment #7
Flying Drupalist commentedI haven't tried this yet but this sounds like a big problem: When the average is calculated the fivestar.js adds a style="width: 50%" which will make your stars 1/2 smaller and when they are already 1/2 smaller it will make them 1/4 the size destroying appearance.
Anyone have some css to share in general?
Comment #8
angusmccloud commentedLast night i ended up implementing this.
What I did was create two different sets of stars (the right half and the left half) -- then I used the Craft stars as a base because they were the only one that was using different images for each star. I then changed which images are referenced so all the odd numbers use the left side, the even numbers use the right side. (there was a little more with changing the width so they're all the same, etc).
Pretty simple once I figured out what I was trying to do...
Comment #9
Sotek commentedHello everyone,
It seems that it only takes a modification of the .css to get half star increments.
I use it for reviewing books and movies, so user don't vote.
May you please be so kind as to share the code that should be changed or added in the .css ?
It would be very much appreciated!
Thank you.
Comment #10
paganwinter commentedSubscribing...
Have done this... Will post the css tomorrow, if anyone's still interested.
Comment #11
paganwinter commentedThis did the trick for me.
Used 10 stars for rating my nodes (stars as cck field), but wanted visitors to see just 5.
Haven't yet seen what happens on stars that are already half (avg.) because I am using this as a CCK field, and not for rating by users, yet...
Assuming your images are of size 16x16 (each star - on, off, hover) (Ref: http://drupal.org/node/234391)
Comment #12
buzzman commentedHi angusmccloud:
If possible, can you plz share the code with which you were able to achieve this?
cheers
Comment #13
fitter commentedSubscribing as well. A possible solution may be the way the node author inputs the rating (instead of selecting stars, the node author can input a integer value out of /100, as it seems all the ratings are converted to a 100 point scale in the long run [I could be wrong?]). However this will be an ugly solution for viewer ratings, and being able to actually select half stars would be a proper solution.
Comment #14
gtsongi commentedCan someone give a detailed explanation how to do this?? It's urgent!
Comment #15
izmeez commentedsubscribing
Comment #16
silencery commentedSubscribing
Comment #17
fitter commentedWould treating the CCK rating field as a multi axis rating (i.e. giving it a axis name of overall) work? What I mean is setting the stars as 10 for the CCK field then outputting that field on the theme with only 5 stars.
Like so:
$rating = votingapi_select_results(array('content_id' => $node->nid, 'tag' =>'overall', 'function' => 'average'));
print theme('fivestar_static', $rating[0]['value'], '5');
Right now this isn't displaying anything form me and it could just be my code.
Any ideas?
*EDIT*
Doing the above didn't work for me, but doing the below did.
Fixed it for my instance.
Using a 10 star CCK field rating then outputting it on the theme as:
print theme('fivestar_static', $node->field_rating[0]['rating'], '5');
Where $node->field_rating is your CCK field's name and where 5 is the number of stars you want
It essentially just halves the 10 star rating to fit 5 stars. :-) This doesn't mess with CSS due to the fact that if I did the CSS solution it would destroy my user ratings that I have on my site that are already half ratings.
Comment #18
quicksketchNo matter how many stars you use, Fivestar ALWAYS converts them to a score of 100. If displaying 5 stars, each star is worth 20. If displaying 10 stars, each one is worth 10. Setting the main configuration to 10 stars and then theming it to display 5 is in no way different from just configuring it to display 5 stars to begin with. You can always convert from 5 to 10 stars at any time and the stars will automatically be adjusted, since no matter what they're always working with a score out of 100 anyway.
I've said it before. There is NO REASON why you can't have half-star increments right now. Apparently no one knows how to write CSS anymore. Look at how star sets like "Craft" already have separate icons for every star. All you need is to theme one half of the star on "odd" classes and the other half on "even" ones. That's it.
Comment #19
fitter commentedWouldn't that mess with user ratings which are already half stars via average?
Comment #20
quicksketchSeems paganwinter already added some CSS above. His approach is just what I meant. You shouldn't need to do any PHP to accomplish half-stars. Set the number of stars to 10 and then add the above CSS to a custom fivestar.css file.
Comment #21
fitter commentedWhen applying the solutions CSS does not effect user vote averaging for anyone also trying to do this. CSS would be the best solution as quicksketch says.
Comment #22
rahadgp commentedThe css is not working for me. the html structure is like :
Please help...
Comment #23
xbrianx commentedThe issue here for me is not CSS, but what if you are creating your own personal ratings so there is only 1 vote, but you want to display a rating of 8.5. I don't see an option of how to set ratings such as this.
Comment #24
GemVinny commentedDid anyone come up with a solution for this?
I have a taxonomy page thats listing stars - the css works but it only properly works for 1.5 stars.
If there's anymore then it shows as star / half star / start /half star - where obviously only the half should show at the end.
I suppose we need a bit of js for this?
Comment #25
GemVinny commentedI tried something like this:
I was going to do something like that and hide if it wasn't the last one, but that didn't work so back to square one.
Comment #26
dahousecat commentedI've created a module to alter Fivestar to allow voting with half stars.
I'm currently going though the review process to get access to release full projects so it is only a sandbox project at present:
Halfstar
I hope it should provide a definitive solution to this problem.
Comment #27
whiteph commentedSorry, Drupal 6 is end of life, and is no longer supported.