[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 featured_products.php

Zen Cart 源代码 featured_products.php




下载文件

文件名: featured_products.php
文件类型: PHP文件
文件大小: 5.46 KiB
MD5: f0c3320c89c8184e1c049465c92220b1

featured_products.php - 关闭高亮
  1. <?php
  2. /**
  3.  * featured_products module - prepares content for display
  4.  *
  5.  * @package modules
  6.  * @copyright Copyright 2003-2007 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: featured_products.php 6424 2007-05-31 05:59:21Z ajeh $
  10.  */
  11. if (!defined('IS_ADMIN_FLAG')) {
  12.   die('Illegal Access');
  13. }
  14.  
  15. // initialize vars
  16. $categories_products_id_list = '';
  17. $list_of_products = '';
  18. $featured_products_query = '';
  19. $display_limit = '';
  20.  
  21. if ( (($manufacturers_id > 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') ) {
  22.   $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
  23.                           from (" . TABLE_PRODUCTS . " p
  24.                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
  25.                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
  26.                           where p.products_id = f.products_id
  27.                           and p.products_id = pd.products_id
  28.                           and p.products_status = 1 and f.status = 1
  29.                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
  30. } else {
  31.   // get all products and cPaths in this subcat tree
  32.   $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);
  33.  
  34.   if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
  35.     // build products-list string to insert into SQL query
  36.     foreach($productsInCategory as $key => $value) {
  37.       $list_of_products .= $key . ', ';
  38.     }
  39.     $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma
  40.     $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
  41.                                from (" . TABLE_PRODUCTS . " p
  42.                                left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
  43.                                left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id)
  44.                                where p.products_id = f.products_id
  45.                                and p.products_id = pd.products_id
  46.                                and p.products_status = 1 and f.status = 1
  47.                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  48.                                and p.products_id in (" . $list_of_products . ")";
  49.   }
  50. }
  51. if ($featured_products_query != '') $featured_products = $db->ExecuteRandomMulti($featured_products_query, MAX_DISPLAY_SEARCH_RESULTS_FEATURED);
  52.  
  53. $row = 0;
  54. $col = 0;
  55. $list_box_contents = array();
  56. $title = '';
  57.  
  58. $num_products_count = ($featured_products_query == '') ? 0 : $featured_products->RecordCount();
  59.  
  60. // show only when 1 or more
  61. if ($num_products_count > 0) {
  62.   if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 0) {
  63.     $col_width = floor(100/$num_products_count);
  64.   } else {
  65.     $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS);
  66.   }
  67.   while (!$featured_products->EOF) {
  68.     $products_price = zen_get_products_display_price($featured_products->fields['products_id']);
  69.     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']);
  70.  
  71.     $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
  72.     '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']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<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><br />' . $products_price);
  73.  
  74.     $col ++;
  75.     if ($col > (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS - 1)) {
  76.       $col = 0;
  77.       $row ++;
  78.     }
  79.     $featured_products->MoveNextRandom();
  80.   }
  81.  
  82.   if ($featured_products->RecordCount() > 0) {
  83.     if (isset($new_products_category_id) && $new_products_category_id !=0) {
  84.       $category_title = zen_get_categories_name((int)$new_products_category_id);
  85.       $title = '<h2 class="centerBoxHeading">' . TABLE_HEADING_FEATURED_PRODUCTS . ($category_title != '' ? ' - ' . $category_title : '') . '</h2>';
  86.     } else {
  87.       $title = '<h2 class="centerBoxHeading">' . TABLE_HEADING_FEATURED_PRODUCTS . '</h2>';
  88.     }
  89.     $zc_show_featured = true;
  90.   }
  91. }
  92. ?>


cron