We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Are you a Solspace Rating Module Jedi? I need your help!

Development and Programming

Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

I’ve got it sorted out I believe. I ended up using {if no_results} outside of the weblog:entries tag and it seems to work.

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

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?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.