Forums / Templates, Stylesheets, Page Layout / Product Rating (stars) on home page

Product Rating (stars) on home page

Locked

Started by bigjoed on 10 Dec 2009, 2:18 AM · Views: 1,397

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
10 Dec 2009, 2:18 AM
#1
bigjoed avatar

bigjoed

Zen Follower

Join Date:
Apr 2006
Location:
Fort Bragg, North Carolina
Posts:
152
Plugin Contributions:
0

Product Rating (stars) on home page

I've been trying to look for a way to display the product ratings (stars) on the home page. For example as in under each product on the featured products section etc. I have been playing with the code but can't achieve the desired result. End up with "0 out of 5 stars" on all products or showing all five stars on all products displayed.

Is have not found a contribution that adds that functionality or any info in the forum.

Any Help?

10 Dec 2009, 3:27 PM
#2
bigjoed avatar

bigjoed

Zen Follower

Join Date:
Apr 2006
Location:
Fort Bragg, North Carolina
Posts:
152
Plugin Contributions:
0

Re: Product Rating (stars) on home page

In order to make this work, I have added the following to includes\modules\pages\index\header_php.php:

    $reviews_query = "select count(*) as count from " . TABLE_REVIEWS . " r, "
                                                       . TABLE_REVIEWS_DESCRIPTION . " rd
                       where r.products_id = '" . (int)$_GET['products_id'] . "'
                       and r.reviews_id = rd.reviews_id
                       and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
                       $review_status;

    $reviews = $db->Execute($reviews_query);

and the following code to includes]modules\MY_TEMPLATE\featured_products.php:

zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $reviews->fields['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $reviews->fields['reviews_rating']))

but all I get on the home page is "of 5 Stars!". I believe the problem has to do with the fact that I'm not giving a product id to the code above but I don't know where to place it. I have tried:

$featured_products->fields['reviews_rating']
``` and ```
$reviews->fields['products_id']

I imagine there is more coding involved. If anybody has any ideas...:no: