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

Zen Cart 源代码 specials_index.php




下载文件

文件名: specials_index.php
文件类型: PHP文件
文件大小: 5.13 KiB
MD5: 705f3211e9b9b5f85e7dce119a6a0d68

specials_index.php - 关闭高亮
  1. <?php
  2. /**
  3.  * specials_index module
  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: specials_index.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. $specials_index_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.   $specials_index_query = "select p.products_id, p.products_image, pd.products_name, p.master_categories_id
  23.                           from (" . TABLE_PRODUCTS . " p
  24.                           left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id
  25.                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
  26.                           where p.products_id = s.products_id
  27.                           and p.products_id = pd.products_id
  28.                           and p.products_status = '1' and s.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.     $specials_index_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_SPECIALS . " s on p.products_id = s.products_id
  43.                             left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
  44.                             where p.products_id = s.products_id
  45.                             and p.products_id = pd.products_id
  46.                             and p.products_status = '1' and s.status = '1'
  47.                             and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  48.                             and p.products_id in (" . $list_of_products . ")";
  49.   }
  50. }
  51. if ($specials_index_query != '') $specials_index = $db->ExecuteRandomMulti($specials_index_query, MAX_DISPLAY_SPECIAL_PRODUCTS_INDEX);
  52.  
  53. $row = 0;
  54. $col = 0;
  55. $list_box_contents = array();
  56. $title = '';
  57.  
  58. $num_products_count = ($specials_index_query == '') ? 0 : $specials_index->RecordCount();
  59.  
  60. // show only when 1 or more
  61. if ($num_products_count > 0) {
  62.   if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS == 0 ) {
  63.     $col_width = floor(100/$num_products_count);
  64.   } else {
  65.     $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
  66.   }
  67.  
  68.   $list_box_contents = array();
  69.   while (!$specials_index->EOF) {
  70.     $products_price = zen_get_products_display_price($specials_index->fields['products_id']);
  71.     if (!isset($productsInCategory[$specials_index->fields['products_id']])) $productsInCategory[$specials_index->fields['products_id']] = zen_get_generated_category_path_rev($specials_index->fields['master_categories_id']);
  72.  
  73.     $specials_index->fields['products_name'] = zen_get_products_name($specials_index->fields['products_id']);
  74.     $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsSpecials centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
  75.     'text' => (($specials_index->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . (int)$specials_index->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $specials_index->fields['products_image'], $specials_index->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . $specials_index->fields['products_id']) . '">' . $specials_index->fields['products_name'] . '</a><br />' . $products_price);
  76.  
  77.     $col ++;
  78.     if ($col > (SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS - 1)) {
  79.       $col = 0;
  80.       $row ++;
  81.     }
  82.     $specials_index->MoveNextRandom();
  83.   }
  84.  
  85.   if ($specials_index->RecordCount() > 0) {
  86.     $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_SPECIALS_INDEX, strftime('%B')) . '</h2>';
  87.     $zc_show_specials = true;
  88.   }
  89. }
  90. ?>