Hello,
I have created a multi-rating system using the rating plugin 5 times in a list. I want to calculate "Overall Rating" using Calc Element, by taking the average of all ratings for the current item.
To calculate the overall rating I need devise a query like the following with dynamic values of "listid" and "row_id":
Please assist me to find the values of listid and row_id dynamically to be used on Calc Element, thanks.
I have created a multi-rating system using the rating plugin 5 times in a list. I want to calculate "Overall Rating" using Calc Element, by taking the average of all ratings for the current item.
To calculate the overall rating I need devise a query like the following with dynamic values of "listid" and "row_id":
Code:
$db =& JFactory::getDBO();
$query = "SELECT AVG(rating) FROM `fabrik_ratings` WHERE listid = XX and row_id = XX";
$db->setQuery($query);
return $db->loadResult();
Please assist me to find the values of listid and row_id dynamically to be used on Calc Element, thanks.