I’ve got the rating module set up on a site of mine. Here’s what I’m using to display the current rating:
{exp:rating:stats entry_id="{entry_id}" theme="default" scale="5"}
{stars_overall_avg}
Based on {overall_count} review{if overall_count !="1"}s{/if}
{/exp:rating:stats}
This all works just great once a rating has been recorded. The problem is when no rating as been recorded, no stars show at all. I was under the impression that if no rating had been received, it would simply show 5 (or 10) gray stars indicating that it had no rating yet.
I’ve got a post in over at Solspace where one of their support people said it’s not possible the current functionality, but I didn’t know if someone here had a slick work around? Seems like this would be pretty common.
Thanks
Hmmm, doesn’t seem to be doing anything. Here is what I’ve got (using this inside the weblog entries tag)
{exp:weblog:entries weblog="courses" disable="categories|pagination|trackbacks" require_entry="yes"}
<h1>{title}</h1>
<div id="coursesTop" class="clearfix">
<div id="ratingFavoriteInfo">
Course Rating:
{exp:rating:stats entry_id="{entry_id}" theme="default" scale="5"}
{if overall_count == "0" OR overall_count == ""}
{base_url}assets/images/design/themes/rating_themes/default/images/star-0.gif{base_url}assets/images/design/themes/rating_themes/default/images/star-0.gif{base_url}assets/images/design/themes/rating_themes/default/images/star-0.gif{base_url}assets/images/design/themes/rating_themes/default/images/star-0.gif{base_url}assets/images/design/themes/rating_themes/default/images/star-0.gif
{/if}
{stars_overall_avg}
Based on {overall_count} review{if overall_count !="1"}s{/if}
{/exp:rating:stats}
<a href="#" title="Add to Favorites List" class="favoriteIt">Add to Favorites List</a>
</div>
...more course info...
...rating form code....
You can check out the page here: http://www.kentuckygolfing.com/courses/details/kearney-hill-golf-links
and here’s the page after a rating is recorded: http://www.kentuckygolfing.com/courses/details/valhalla-golf-club
I actually have ran into another issue here.
Consider this code from the template:
{if overall_count == "0"}No reviews yet{/if}
Based on {overall_count} review{if overall_count !="1"}s{/if}
I’m sure you can see what I’m trying to do here. If no rating is present, show “no rating yet” otherwise show the regular “based on…” verbiage. The weird thing is that overall_count nor no_results will work in this matter (even though I just used no results to display gray stars when no rating was present. So, I really don’t understand that unless my conditional code is just plain wrong?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.