Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Fort Bragg, North Carolina
    Posts
    153
    Plugin Contributions
    0

    Default 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?

  2. #2
    Join Date
    Apr 2006
    Location
    Fort Bragg, North Carolina
    Posts
    153
    Plugin Contributions
    0

    Default 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:

    Code:
        $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:

    Code:
    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:

    Code:
    $featured_products->fields['reviews_rating']
    and
    Code:
    $reviews->fields['products_id']
    I imagine there is more coding involved. If anybody has any ideas...

 

 

Similar Threads

  1. v150 How to add product rating (stars) to a product on main page
    By Dave1st in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 Jul 2015, 03:04 PM
  2. Stars Rating under product listing page
    By ken0306 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Feb 2011, 01:46 AM
  3. Review rating radio buttons are all 5 stars
    By Craft Magick in forum General Questions
    Replies: 5
    Last Post: 3 Apr 2009, 06:41 PM
  4. Product review rating stars not showing on....
    By bakdoor in forum General Questions
    Replies: 0
    Last Post: 19 Dec 2008, 12:20 PM
  5. Custom Stars Rating
    By DieuxSoldat_04 in forum Basic Configuration
    Replies: 4
    Last Post: 25 Sep 2008, 07:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg