$featured_products = $db->ExecuteRandomMulti($featured_products_query, MAX_DISPLAY_SEARCH_RESULTS_FEATURED); } $row = 0; $col = 0; $list_box_contents = array(); $title = ''; $num_products_count = $featured_products_query == '' ? 0 : $featured_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 (!$featured_products->EOF) { $products_price = zen_get_products_display_final_price($featured_products->fields['products_id']); if (!isset($productsInCategory[$featured_products->fields['products_id']])) { $productsInCategory[$featured_products->fields['products_id']] = zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']); } $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsFeatured centeredContent back"' . ' ', 'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '" class="ih" >' . zen_image_OLD(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], 86, 86) . '</a>') . '<br /><p class="b red g_t_c">' . $products_price . '</p>'); // /* <a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a> */ // $col++; if ($col > SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS - 1) { $col = 0; $row++; } $featured_products->MoveNextRandom();
} } } else { $show_best_sellers = true; } if ($show_best_sellers == true) { if (isset($current_category_id) && $current_category_id > 0) { $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_ordered\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c\n where p.products_status = '1'\n and p.products_ordered > 0\n and p.products_id = pd.products_id\n and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n and p.products_id = p2c.products_id\n and p2c.categories_id = c.categories_id\n and '" . (int) $current_category_id . "' in (c.categories_id, c.parent_id)\n order by p.products_ordered desc, pd.products_name\n limit " . MAX_DISPLAY_BESTSELLERS; $best_sellers = $db->Execute($best_sellers_query); } else { $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_ordered\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n where p.products_status = '1'\n and p.products_ordered > 0\n and p.products_id = pd.products_id\n and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n order by p.products_ordered desc, pd.products_name\n limit " . MAX_DISPLAY_BESTSELLERS; $best_sellers = $db->Execute($best_sellers_query); } if ($best_sellers->RecordCount() >= MIN_DISPLAY_BESTSELLERS) { $title = BOX_HEADING_BESTSELLERS; $box_id = 'bestsellers'; $rows = 0; while (!$best_sellers->EOF) { $rows++; $bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id']; $bestsellers_list[$rows]['name'] = $best_sellers->fields['products_name']; $bestsellers_list[$rows]['products_image'] = $best_sellers->fields['products_image']; $bestsellers_list[$rows]['products_price'] = zen_get_products_display_final_price($best_sellers->fields['products_id']); $best_sellers->MoveNext(); } $title_link = false; require $template->get_template_dir('tpl_best_sellers.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_best_sellers.php'; $title = BOX_HEADING_BESTSELLERS; require $template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base, 'common') . '/tpl_box_best_sellers.php'; } }