[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 源代码 new_products.php

Zen Cart 源代码 new_products.php




下载文件

文件名: new_products.php
文件类型: PHP文件
文件大小: 4.96 KiB
MD5: 3766fac4c13b0a5a75e422b2ac650b83

new_products.php - 关闭高亮
  1. <?php
  2. /**
  3.  * new_products.php module
  4.  *
  5.  * @package modules
  6.  * @copyright Copyright 2003-2008 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: new_products.php 8730 2008-06-28 01:31:22Z drbyte $
  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. $new_products_query = '';
  19.  
  20. $display_limit = zen_get_new_date_range();
  21.  
  22. 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') ) {
  23.   $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
  24.                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id
  25.                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
  26.                           where p.products_id = pd.products_id
  27.                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  28.                           and   p.products_status = 1 " . $display_limit;
  29. } else {
  30.   // get all products and cPaths in this subcat tree
  31.   $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);
  32.  
  33.   if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
  34.     // build products-list string to insert into SQL query
  35.     foreach($productsInCategory as $key => $value) {
  36.       $list_of_products .= $key . ', ';
  37.     }
  38.     $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma
  39.  
  40.     $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
  41.                                  p.products_date_added, p.products_price, p.products_type, p.master_categories_id
  42.                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
  43.                           where p.products_id = pd.products_id
  44.                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  45.                           and p.products_status = 1
  46.                           and p.products_id in (" . $list_of_products . ")";
  47.   }
  48. }
  49.  
  50. if ($new_products_query != '') $new_products = $db->ExecuteRandomMulti($new_products_query, MAX_DISPLAY_NEW_PRODUCTS);
  51.  
  52. $row = 0;
  53. $col = 0;
  54. $list_box_contents = array();
  55. $title = '';
  56.  
  57. $num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount();
  58.  
  59. // show only when 1 or more
  60. if ($num_products_count > 0) {
  61.   if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) {
  62.     $col_width = floor(100/$num_products_count);
  63.   } else {
  64.     $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS);
  65.   }
  66.  
  67.   while (!$new_products->EOF) {
  68.     $products_price = zen_get_products_display_price($new_products->fields['products_id']);
  69.     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']);
  70.  
  71.     $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
  72.     'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);
  73.  
  74.     $col ++;
  75.     if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) {
  76.       $col = 0;
  77.       $row ++;
  78.     }
  79.     $new_products->MoveNextRandom();
  80.   }
  81.  
  82.   if ($new_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">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
  86.     } else {
  87.       $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>';
  88.     }
  89.     $zc_show_new_products = true;
  90.   }
  91. }
  92. ?>


cron