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') ) {
$specials_index_query = "select p.products_id, p.products_image, pd.products_name, p.master_categories_id, pd.products_description
from (" . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
where p.products_id = s.products_id
and p.products_id = pd.products_id
and p.products_status = '1' and s.status = 1
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
} 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
$specials_index_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id, pd.products_description
from (" . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
where p.products_id = s.products_id
and p.products_id = pd.products_id
and p.products_status = '1' and s.status = '1'
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id in (" . $list_of_products . ")";
}
}
if ($specials_index_query != '') $specials_index = $db->ExecuteRandomMulti($specials_index_query,10);
$count = 1;
while (!$specials_index->EOF) {
$products_name = '
' . substr(strip_tags($specials_index->fields['products_name']), 0, 110) . '';
$products_price = '
' . zen_get_products_display_price($specials_index->fields['products_id']) . '';
$products_butt = '
';
$products_revies = '
';
$products_img = (($specials_index->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '
' . zen_image(DIR_WS_IMAGES . $specials_index->fields['products_image'], $specials_index->fields['products_name'], 500, 500) . '');
if (!empty($_SESSION['compare']) && in_array($specials_index->fields['products_id'],$_SESSION['compare'])) {
$compare_display ='
';
}else{
$compare_display ='
'; }
$products_desc = substr(strip_tags($specials_index->fields['products_description']), 0, 20) . '...';
$count_stars_query = "select count(reviews_rating) as num, avg(reviews_rating) as aver from " . TABLE_REVIEWS . " where products_id = '" . (int)$specials_index->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 = ($specials_index_query == '') ? 0 : $specials_index->RecordCount();
?>
MoveNextRandom();
$count+=1;
if($count == 4) $count = 1;
} ?>