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 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_status = 1 order by p.products_id desc "; } 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->Execute($new_products_query, MAX_DISPLAY_SEARCH_RESULTS_FEATURED); $row = 0; $col = 0; $list_box_contents = array(); $title = ''; $num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount(); // show only when 1 or more if ($num_products_count > 0) { if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 0 ) { $col_width = floor(100/$num_products_count); } else { $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS); } while (!$new_products->EOF) { if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']); $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'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . ''); $products_name = '

' . $new_products->fields['products_name'] . '

'; $products_desc = substr(strip_tags($new_products->fields['products_description']), 0, 60) . '...'; $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_CART, BUTTON_IN_CART_ALT) . ''; $img_col_w = IMAGE_PRODUCT_NEW_WIDTH + 43; $count_stars_query = "select count(reviews_rating) as num, avg(reviews_rating) as aver from " . TABLE_REVIEWS . " where products_id = '" . (int)$featured_products->fields['products_id'] . "'"; $count_stars = $db->Execute($count_stars_query); $starnum = round($count_stars->fields['aver']); $star = array("stars_1.gif","stars_2.gif","stars_3.gif","stars_4.gif","stars_5.gif"); if($count_stars->fields['num']>=1){ $reviews_display =''.$count_stars->fields['num'].' '.TABLE_HEADING_BEST_PRODUCT2.''; }else{ $reviews_display ='0 '.TABLE_HEADING_BEST_PRODUCT2.''; } if (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS > 1 && $num_products_count > 1) { if ($col > 1 && $col < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS) { $tm_param = 'style="margin-left:1px;"'; } elseif ($col > 0 && $col < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS){ $tm_param = 'style="margin-left:1px; margin-right:1px;"'; } else { $tm_param = ''; } $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:19.99%;"', 'text' => '
' . $products_img . '
' . $products_name . '
' . str_replace(' ', '', $products_price) . '
' . $reviews_display . '
' ); } else { $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:24.9%;"', 'text' => '
' . $products_img . '
'.$products_desc.'
' . $products_name . '
' . str_replace(' ', '', $products_price) . '
' . $products_butt2 . '
' . $products_butt . '
' ); } $col ++; if ($col > (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS - 1)) { $col = 0; $row ++; } $new_products->MoveNext(); } if ($new_products->RecordCount() > 0) { if (isset($new_products_category_id) && $new_products_category_id != 0) { $category_title = zen_get_categories_name((int)$new_products_category_id); $title = '

' . sprintf(TABLE_HEADING_BEST_QUANTY, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '

'; } else { $title = '

' . sprintf(TABLE_HEADING_BEST_QUANTY, strftime('%B')) . '

'; } $zc_show_new_products = true; } } ?>