Getting the total count from a specific form
Posted: 02 August 2007 06:48 AM   [ Ignore ]
Newbie
Rank
Total Posts:  19
Joined  2006-10-16

I’m trying to get the number of ratings in a specific form, but I’m not having any luck:

{exp:weblog:entries weblog="articles"}
{exp
:rating:stats form_name="industryrelevance"}
{overall_count}
{
/exp:rating:stats}
{
/exp:weblog:entries}

It works when a specific entry_id is used, but I want the whole form not a specific entry.

Profile
 
 
Posted: 02 August 2007 07:46 AM   [ Ignore ]   [ # 1 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

I rather think this is intended behavior:

The rating stats tag takes an entry id as a parameter and returns rating statistics for the given blog post in the format you specify. You can use this function in any place that you can pass to it an entry id.

But:

The ‘entry_id’ parameter allows you to override the entry id or url title pulled from the url of the page. In those cases where your page shows a number of weblog entries, each of which you want to show stats, you should supply this parameter by feeding into it the entry_id variable from your weblog:entries tag. Like this entry_id="{entry_id}".

If that’s not what you meant, please clarify.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 August 2007 07:54 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  19
Joined  2006-10-16

That’s not what I meant.

I want the count for all ratings from a specific rating form.

My site has two forms “industry relevance” and “academic relevance” and I want a count of all ratings entered into each.

Profile
 
 
Posted: 02 August 2007 08:05 AM   [ Ignore ]   [ # 3 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

Well, {exp:rating:stats} is not the tag to use, then. But I still don’t follow. So you have two forms: You simply want to show the number of ratings, not the values?

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 August 2007 08:11 AM   [ Ignore ]   [ # 4 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

{overall_count} provides the number of ratings for a given entry_id, not the form as a whole. Your best bet would probably be a simple SQL query:

{exp:query sql="SELECT COUNT(rating_id) AS my_count FROM `exp_ratings` WHERE form_name='industry relevance'"}
{my_count}
{
/exp:query}

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 August 2007 08:15 AM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  19
Joined  2006-10-16

Ahh cool, that worked like a charm, thanks Ingmar!!

Profile
 
 
Posted: 02 August 2007 09:13 AM   [ Ignore ]   [ # 6 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

Great wink

 Signature 

Ingmar Greil

Profile