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;
Bookmarks