0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
$new_products_query = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name,r.customers_name,
substring(reviews_text, 1, 120) as reviews_text
from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, "
. TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = r.products_id
and r.reviews_id = rd.reviews_id
and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
$review_status;
} else {
// get all products and cPaths in this subcat tree
$productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);
if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
// build products-list string to insert into SQL query
foreach($productsInCategory as $key => $value) {
$list_of_products .= $key . ', ';
}
$list_of_products = substr($list_of_products, 0, -2); // remove trailing comma
$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, pd.products_description,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id in (" . $list_of_products . ")";
}
}
if ($new_products_query != '') $new_products = $db->ExecuteRandomMulti($new_products_query, 3);
while (!$new_products->EOF) {
$products_name = '
' . $new_products->fields['products_name'] . '';
$products_price = '
' . zen_get_products_display_price($new_products->fields['products_id']) . '';
$products_butt = '
' . zen_image_button(BUTTON_IMAGE_GOTO_PROD_DETAILS, BUTTON_GOTO_PROD_DETAILS_ALT) . '';
$products_butt2 = '
' . zen_image_button(BUTTON_IMAGE_ADD_TO_CART2, BUTTON_IN_CART_ALT) . '';
$products_img = (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '
' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'],300, 300) . '');
$products_desc = '
' . zen_trunc_string(nl2br(zen_output_string_protected(stripslashes($new_products->fields['reviews_text']))), 300) . '';
$count_stars_query = "select count(reviews_rating) as num, avg(reviews_rating) as aver from " . TABLE_REVIEWS . " where products_id = '" . (int)$new_products->fields['products_id'] . "'";
$count_stars = $db->Execute($count_stars_query);
$starnum = round($count_stars->fields['aver']);
$star = array("
","
","
","
","
");
if($count_stars->fields['num']>=1){
$reviews_display =''. $star[$starnum-1] .'';
}else{
$reviews_display ='
';
}
$num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount();
?>
fields['customers_name'])); ?>
MoveNextRandom();}?>