Calc element using star ratings

Todcan

New Member
Hello,
I have the need to average some star ratings.
Using the calc element plugin I have enabled ajax and have the following calculation.

$wts = (int)'(fab_gymhit___weights_raw)';
$cdo = (int)'(fab_gymhit___cardio_raw)';
$cla = (int)'(fab_gymhit___classes_raw)';
$kcl = (int)'(fab_gymhit___Kids_Club_raw)';
$sst = (int)'(fab_gymhit___sauna_steam_raw)';
$spt = (int)'(fab_gymhit___sports_raw)';
$poo = (int)'(fab_gymhit___rating_raw)';

$ts = $wts + $cdo + $cla + $kcl + $sst + $spt + $poo;
return "Score = $ts";

Each item is a star rating. All I get is an output of 'score=0'
do star ratings not store in the database as a number?
Thanks in advance.
 
Thanks for the reply.
I now have

calculation
$wts = (int)'{fab_gymhit___weights_raw}';
$cdo = (int)'{fab_gymhit___cardio_raw}';
$cla = (int)'{fab_gymhit___classes_raw}';
$kcl = (int)'{fab_gymhit___Kids_Club_raw}';
$sst = (int)'{fab_gymhit___sauna_steam_raw}';
$spt = (int)'{fab_gymhit___sports_raw}';
$poo = (int)'{fab_gymhit___rating_raw}';

$ts = $wts + $cdo + $cla + $kcl + $sst + $spt + $poo;
return "Score =" .$ts;

Ajax
{fab_gymhit___weights}
{fab_gymhit___cardio}
{fab_gymhit___classes}
{fab_gymhit___Kids_Club}
{fab_gymhit___sauna_steam}
{fab_gymhit___sports}
{fab_gymhit___rating}

Which I think is returning only the last rating, but honestly the stars aren't behaving right either. my understanding is that as users click on star ratings they are cumulatively collected and the average is displayed?
Either way sometimes I click on 2 stars now and it displays 3?

http://todcandev.com/gymhit/index.php/facilities
 
Is the Ajax the observe field? Hover over and look at the tooltip, they need to be comma delimited.
 

Members online

No members online now.
Back
Top