With the help at http://drupal.org/node/457886, I have managed to come as far as setting up the review system, consists of 2 node types (supplier, review) and 3 axis: Quality, Value, Reliability.

I was able to configure Views to display the average of votes on a view page. See screenshot: http://dropbox.akandatang.info/multi-axis.png

But now I'm faced with the new challenge: to display the average of overall votes (by summing up all 3 axis, then average.)

For example, given a voting scores like below:

First axis: Quality - 60%
Second axis: Value - 50%
Third axis: Reliability - 90%

Therefore the average of the above = (60+50+90)/3 = 66.67%

I was able to show the average on node page by using this code:

$overall_score = (($quality_rating[0]['value'])+($value_rating[0]['value'])+($reliability_rating[0]['value']))/3;
print theme('fivestar_static', $overall_score, '5');

But what I need now is to add a column to the views page and display the average. What should I do to achieve that?

Comments

deanloh’s picture

I had eventually found the solution to this. For the benefit of others who might be looking for this, the solution is by using http://drupal.org/project/views_customfield.

deanloh’s picture

Status: Active » Closed (fixed)
ctalley5’s picture

Thanks for posting this, that was definitely helpful.

When printing the fivestar... I've gotten it working with: print theme('fivestar_static', $avg, '5')

But what if I don't want to print stars... but instead I want to print either the average, or number of stars numerically?

Like either '80' or 4/5?

deanloh’s picture

Hello ctalley5

They might be better way, or you can use this:

Instead of...
print theme('fivestar_static', $overall_rating, '5');

use...
print ($overall_rating);
to display the average, i.e. '80'

or...
print ($overall_rating/20) . "/5";
to display number of stars i.e. '4/5'
note: if you are using 10 stars then you need to change "20" to "10" and "/5" to "/10" and so on.