New Zenner
- Join Date:
- Apr 2008
- Posts:
- 82
- Plugin Contributions:
- 0
Reviews on category page
Hello!
I would be very grateful if somebody could help me with the sql query to display reviews on categories pages. Right now I am using the dgReviews module which is awesome but I would like to change it a bit and display not just any reviews but only reviews from products in that category. I am not a php coder but as far as I understand I need to use the products_to_categories table, but how I have no idea.
Here is the query on how to display latest ten reviews, could somebody point me what changes needed to do what I am asking above?
$review_status = " and r.status = '1'";
/* This is where you change the parameter value to output 1000 charaters or equivelent */
$reviews_query_raw = "select r.reviews_id, r.customers_name, r.reviews_rating, p.products_id, p.products_image, pd.products_name,
substring(reviews_text, 1, 70) as reviews_text
from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, "
. TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
where p.products_status = '1'
and p.products_id = r.products_id
and r.reviews_id = rd.reviews_id
and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
$review_status . "
order by r.reviews_id desc limit 10";
Thank you very much for your help!
Dan