percent rating is calculated incorrectly

Description

If You have many reviews to the this same product percent rating is calculated incorrectly.
example:
product TEST with reviews_id 1 and reviews rating 5
product TEST with reviews_id 2 and reviews rating 5
product TEST with reviews_id 3 and reviews rating 4 - and you clik on this reviews then You see 90% (must be 80%) because in reviews_average_query is product_id instead reviews_id
so it will calculate the review of the product to the first found the product id

to fix go to admin/reviews.php and find code
$reviews_average_query = tep_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$reviews['products_id'] . "'");
change to:
$reviews_average_query = tep_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where reviews_id = '" . (int)$reviews['reviews_id'] . "'");

Environment

None

Steps to reproduce

None

Assignee

Giles Marshall

Reporter

greg

Labels

None

Severity

Minor

Components

Fix versions

Affects versions

Priority

Configure