Hi,

I'm not sure to understand the "Voting axis" field when you create a CCK fivestar field.

I'm using fivestar with nodecomment to make a powerfull review system, and I need to have several votes on each comment. Do I have to fill something in that field to make it work ?

Comments

quicksketch’s picture

No, you may (and probably should) leave the field blank if you're only interested in one "overall" rating for the target node. The axis field makes it possible for you to rate on multiple categories (quality, reliability, value, or whatever you like). If you leave the field blank Fivestar will use the default 'vote' axis, which is common among most modules that rate things.

zmove’s picture

Ah ok,

So if I create 4 fivestar field, with an unique axis each. On my node, I will see 4 note (1 by axis)

If Icreate 4 fivestar field but without axis, on my node, I will see one overall note ? it's that ?

So a last question,

If I want to create 4 fivestar field and, on my target node, I want to see overall rate for each field (so 4 overall rate) + 1 global overall rate that make the average of the 4 overall rate.

Do I have to specify an axis for each field, and, with custom code in my node-.tpl.php file, I get the last field that is the (sum of the 4 average / 4) ? It is the way to go ?

thank you for your future answers ?

quicksketch’s picture

Oh sorry, I didn't mean to imply that there was functionality to display the "average of all axis" if you leave the field blank. I meant that leaving the field blank (or entering the axis "vote") is a good idea for your "overall" rating because it's the general tag used for voting by default. Everything else you've mentioned is correct however.

There isn't an easy way yet to display these average ratings though, you'll probably need to do custom theming something like this:

  $results = votingapi_get_voting_results('node', $node->id);

  foreach ($results as $result) {
    if ($result->value_type == 'average') {
      $star_display = theme('fivestar_static', $result->value, $stars);
      $text_display = $text_display == 'none' ? NULL : theme('fivestar_summary', $user_value, $result->value, $count_value, $stars);

      print theme('fivestar_static_element', $star_display, $title, $text_display);
    }
  }

Note this is totally untested. But it's the general idea.

zmove’s picture

Ok, thank your for you very great support.

So, if I have to choose, on the target node, I prefer to have one note by axis instead of one general note that make the average of all axis. So, if I understand well, for that case I have to create 4 axis.

If I would make one general note on the target node that make the average of all the fivestar field I add, I would specify no axis (or votre axis).

Thank you so much for your answers !!

quicksketch’s picture

Everything is correct except I'd like to say again that Fivestar (and VotingAPI) have no support for a "average of all axis" tallying. You'd need to actually compute this manually once you've gotten all the results from votingapi_get_voting_results().

Specifying no axis is the same as using the "vote" axis. There is nothing special about this axis other than it is the default axis used by Fivestar.

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after 2 weeks with no activity.

crea’s picture

Status: Closed (fixed) » Active

I have 4 axis voting system with fivestar as cck fields. So I need to calculate additional average 'vote' axis after submitting (or updating) review node (it will just use average of 4 axis values).
What would be the best place to do it ? If it's hook_nodeapi, what 'op' is the best ? or maybe use some fancy hook of votingapi itself ?
Sorry for being noobish here :)

The thing I worry about most is will current vote values ( values of current vote's other axis) available to me when I update additional axis ? Is it just matter of module weights or something ?

quicksketch’s picture

Status: Active » Closed (fixed)

crea, your question is different from the original request. See the discussion in #335493: Vote-averaging for multi-axis