[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * best_sellers sidebox - displays selected number of (usu top ten) best selling products 4 * 5 * @package templateSystem 6 * @copyright Copyright 2003-2005 Zen Cart Development Team 7 * @copyright Portions Copyright 2003 osCommerce 8 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 9 * @version $Id: best_sellers.php 2718 2005-12-28 06:42:39Z drbyte $ 10 */ 11 12 // test if box should display 13 $show_best_sellers= false; 14 15 if (isset($_GET['products_id'])) { 16 if (isset($_SESSION['customer_id'])) { 17 $check_query = "select count(*) as count 18 from " . TABLE_CUSTOMERS_INFO . " 19 where customers_info_id = '" . (int)$_SESSION['customer_id'] . "' 20 and global_product_notifications = '1'"; 21 22 $check = $db->Execute($check_query); 23 24 if ($check->fields['count'] > 0) { 25 $show_best_sellers= true; 26 } 27 } 28 } else { 29 $show_best_sellers= true; 30 } 31 32 if ($show_best_sellers == true) { 33 if (isset($current_category_id) && ($current_category_id > 0)) { 34 $best_sellers_query = "select distinct p.products_id, pd.products_name, p.products_ordered 35 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " 36 . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c 37 where p.products_status = '1' 38 and p.products_ordered > 0 39 and p.products_id = pd.products_id 40 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 41 and p.products_id = p2c.products_id 42 and p2c.categories_id = c.categories_id 43 and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) 44 order by p.products_ordered desc, pd.products_name 45 limit " . MAX_DISPLAY_BESTSELLERS; 46 47 $best_sellers = $db->Execute($best_sellers_query); 48 49 } else { 50 $best_sellers_query = "select distinct p.products_id, pd.products_name, p.products_ordered 51 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 52 where p.products_status = '1' 53 and p.products_ordered > 0 54 and p.products_id = pd.products_id 55 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 56 order by p.products_ordered desc, pd.products_name 57 limit " . MAX_DISPLAY_BESTSELLERS; 58 59 $best_sellers = $db->Execute($best_sellers_query); 60 } 61 62 if ($best_sellers->RecordCount() >= MIN_DISPLAY_BESTSELLERS) { 63 $title = BOX_HEADING_BESTSELLERS; 64 $box_id = 'bestsellers'; 65 $rows = 0; 66 while (!$best_sellers->EOF) { 67 $rows++; 68 $bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id']; 69 $bestsellers_list[$rows]['name'] = $best_sellers->fields['products_name']; 70 $best_sellers->MoveNext(); 71 } 72 73 $title_link = false; 74 require($template->get_template_dir('tpl_best_sellers.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_best_sellers.php'); 75 $title = BOX_HEADING_BESTSELLERS; 76 require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); 77 } 78 } 79 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |