Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34
  1. #11
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding Product Rating on Product Listing Page

    This is the page, only testing on 1st product in list, still a test site.

    This is where I am at as far as product_listing.php

    case 'PRODUCT_LIST_REVIEWS':
    $columns ++;
    $stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2);
    $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
    $products_id_current = (int)$listing->fields['products_id'];
    $lc_align = 'center';
    if ($reviews->fields['count'] > 0 ) {
    $lc_text = '<div>' . TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />' . TEXT_CURRENT_REVIEWS_RATING . ' <strong>' . $reviews_average_rating . '</strong> ' . zen_image(DIR_WS_TEMPLATE_IMAGES .
    'stars_' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating)) . '</div>';

    I have tried everything to pull the products review count, rating & rating stars (images).

    Any input would be appreciated.

  2. #12
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Adding Product Rating on Product Listing Page

    Looks like you have them in there ... is this working now? If so, what was the solution that worked for you?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #13
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding Product Rating on Product Listing Page

    Not working,

    It doesn't pull the review count or average rating,

  4. #14
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Adding Product Rating on Product Listing Page

    You do not appear to have the code from the add on for:
    /includes/modules/pages/product_info/main_template_vars.php

    I tried it by adding this code under the:
    case 'PRODUCT_LISTNAME':

    just below the $lc_text code to test it:
    Code:
        // 2P added BOF - Average Product Rating
        $reviews_query = "select count(*) as count from " . TABLE_REVIEWS . " r, "
                                                           . TABLE_REVIEWS_DESCRIPTION . " rd
                           where r.products_id = '" . (int)$listing->fields['products_id'] . "'
                           and r.reviews_id = rd.reviews_id
                           and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
                           $review_status;
    
        $reviews = $db->Execute($reviews_query);
        $reviews_average_rating_query = "select avg(reviews_rating) as average_rating from " . TABLE_REVIEWS . " r, "
                                                           . TABLE_REVIEWS_DESCRIPTION . " rd
                           where r.products_id = '" . (int)$listing->fields['products_id'] . "'
                           and r.reviews_id = rd.reviews_id
                           and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
                           $review_status;
    
        $reviews_average_rating = $db->Execute($reviews_average_rating_query);
        // 2P added EOF - Average Product Rating
    
      if ($reviews->fields['count'] > 0 ) {
        $lc_text .= TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
        $stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
        $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
        $lc_text .= TEXT_CURRENT_REVIEWS_RATING . ' <strong>' . $average_rating . '</strong> ' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));
      }
    maybe that will give you an idea of how this works ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #15
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding Product Rating on Product Listing Page

    I have wasted 2 days on this - thanks for your help but its time for me to move on.

  6. #16
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Adding Product Rating on Product Listing Page

    Just to see how this works, to add it beneath the Product Name, this is the full piece of the CASE statement:
    Code:
            case 'PRODUCT_LIST_NAME':
            $lc_align = '';
            $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
    
        // 2P added BOF - Average Product Rating
        $reviews_query = "select count(*) as count from " . TABLE_REVIEWS . " r, "
                                                           . TABLE_REVIEWS_DESCRIPTION . " rd
                           where r.products_id = '" . (int)$listing->fields['products_id'] . "'
                           and r.reviews_id = rd.reviews_id
                           and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
                           $review_status;
    
        $reviews = $db->Execute($reviews_query);
        $reviews_average_rating_query = "select avg(reviews_rating) as average_rating from " . TABLE_REVIEWS . " r, "
                                                           . TABLE_REVIEWS_DESCRIPTION . " rd
                           where r.products_id = '" . (int)$listing->fields['products_id'] . "'
                           and r.reviews_id = rd.reviews_id
                           and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
                           $review_status;
    
        $reviews_average_rating = $db->Execute($reviews_average_rating_query);
        // 2P added EOF - Average Product Rating
    
      if ($reviews->fields['count'] > 0 ) {
        $lc_text .= TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
        $stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
        $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
        $lc_text .= TEXT_CURRENT_REVIEWS_RATING . ' <strong>' . $average_rating . '</strong> ' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));
      }
            break;
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #17
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding Product Rating on Product Listing Page

    I got it to work, don't know exactly how but now I will play with it a little. Thanks

  8. #18
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Adding Product Rating on Product Listing Page

    Thanks for the update that you have this working now ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #19
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding Product Rating on Product Listing Page

    Ajeh you are the best when it comes to getting it done, thank you and I am sure many zenners will be thanking you as well, this is great!

  10. #20
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding Product Rating on Product Listing Page

    I have managed to play around with the code and got it to display the way I wanted it to, I would be interested to see what you think Ajeh? here is a link

 

 
Page 2 of 4 FirstFirst 1234 LastLast

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. v139a Adding Product Rating on Featured Listing Page
    By gal_op in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 6 Oct 2012, 06:17 AM
  3. Stars Rating under product listing page
    By ken0306 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Feb 2011, 01:46 AM
  4. Average Rating in Search Results or Product Listing
    By hungoveragain in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 26 Oct 2009, 10:11 AM
  5. Showing product rating on listing
    By jcastr in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Jun 2009, 05:34 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR