Zen Cart Logo
Forums / All Other Contributions/Addons / Average Product Rating

Average Product Rating

Views: 1,118

Results 1 to 2 of 2
27 Oct 2010, 10:01 AM
#1
graphic_content avatar

graphic_content

New Zenner

Join Date:
Nov 2008
Location:
Gex, France
Posts:
71
Plugin Contributions:
0

Average Product Rating

Hi guys,

Can anyone tell me what to change to get 'Average Product Rating' in 1.3.9g?

It is displaying on the product page but no matter how many reviews are made the rating always says 0.

Thanks in advance
Matt

20 May 2011, 5:58 PM
#2
ogonju avatar

ogonju

New Zenner

Join Date:
Feb 2010
Posts:
2
Plugin Contributions:
0

Re: Average Product Rating

Graphic Content:

Hi guys,

Can anyone tell me what to change to get 'Average Product Rating' in 1.3.9g?

It is displaying on the product page but no matter how many reviews are made the rating always says 0.

Thanks in advance
Matt
Hi Matt,
If you haven't figure it out yet...
You need to merge the mod code from modules/pages/document_general_info/main_template_vars.php
modules/pages/document_product_info/main_template_vars.php
modules/pages/product_free_shipping_info/main_template_vars.php
modules/pages/product_info/main_template_vars.php
modules/pages/product_music_info/main_template_vars.php
to the new install one
the code you need to get is

  // 2P added BOF - Average Product Rating
    $reviews_average_rating_query = "select avg(reviews_rating) as average_rating 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_average_rating = $db->Execute($reviews_average_rating_query);
    // 2P added EOF - Average Product Rating

copy and paste to those 5 same files name on you ftp arround line 95
like so

$reviews = $db->Execute($reviews_query);
	
	   // 2P added BOF - Average Product Rating
    $reviews_average_rating_query = "select avg(reviews_rating) as average_rating 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_average_rating = $db->Execute($reviews_average_rating_query);
    // 2P added EOF - Average Product Rating

  }

  require(DIR_WS_MODULES . zen_get_module_directory('product_prev_next.php'));