Salvo Posted March 28, 2005 Posted March 28, 2005 Hi all, I like to give an overall rating for a product given by customers ie: reviewer 1 rates product A 4 reviewer 2 rates product A 3 reviewer 3 rates product A 5 I Like to shw the OverAll Rating 4 of 5 How do I add select and add the 4 + 3 + 5 for product A? Thanks Salvo PS: I tried a few times, but I can't add up the three product
Salvo Posted March 30, 2005 Author Posted March 30, 2005 Just in case I did't make myself understood, here what I like to do: reviwes_id ------------ products_id------------ reviews_rating 1------------------------2----------- -------------4 2------------------------ 2----------- -------------3 3------------------------ 3------------------------ 4 4------------------------ 3------------------------ 2 Overall rating for product 2--------------4.5 of 5 Overall rating for product 2--------------3 of 5 How do I do this? what fanction should I use and how I am sorry, but I haven't used this kind of function before.. Thanks Salvo
Salvo Posted April 1, 2005 Author Posted April 1, 2005 I have managed to have a CUSTOMERS OVERALL RATING... to be place in the product_info.php. I have it under the image.. saying: This products has an overall rating of 4 of 5 stars The 4 is made up by: the total rating/number reviews and using round() to round it up/down. This is very useful if someone has many revews for the same products. Interested? I will post the code Salvo
fat_dog Posted September 11, 2009 Posted September 11, 2009 Hi Salvo, Could you post the code please? I've been looking for this but can't find anything anywhere to do this. I have managed to have a CUSTOMERS OVERALL RATING... to be place in the product_info.php. I have it under the image.. saying: This products has an overall rating of 4 of 5 stars The 4 is made up by: the total rating/number reviews and using round() to round it up/down. This is very useful if someone has many revews for the same products. Interested? I will post the code Salvo
spooks Posted September 11, 2009 Posted September 11, 2009 It can all be done in the query!! $reviews_query = tep_db_query("select AVG(reviews_rating) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$_GET['products_id'] . "'"); Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.