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

Zen Cart 源代码 product_listing.php




下载文件

文件名: product_listing.php
文件类型: PHP文件
文件大小: 12.21 KiB
MD5: 07c0269844d85736e4ff53cc645d89c1

product_listing.php - 关闭高亮
  1. <?php
  2. /**
  3.  * product_listing module
  4.  *
  5.  * @package modules
  6.  * @copyright Copyright 2003-2010 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: product_listing.php 17051 2010-07-29 07:25:09Z drbyte $
  10.  */
  11. if (!defined('IS_ADMIN_FLAG')) {
  12.   die('Illegal Access');
  13. }
  14. $show_submit = zen_run_normal();
  15. $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_LISTING, 'p.products_id', 'page');
  16. $zco_notifier->notify('NOTIFY_MODULE_PRODUCT_LISTING_RESULTCOUNT', $listing_split->number_of_rows);
  17. $how_many = 0;
  18.  
  19. $list_box_contents[0] = array('params' => 'class="productListing-rowheading"');
  20.  
  21. $zc_col_count_description = 0;
  22. $lc_align = '';
  23. for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
  24.   switch ($column_list[$col]) {
  25.     case 'PRODUCT_LIST_MODEL':
  26.     $lc_text = TABLE_HEADING_MODEL;
  27.     $lc_align = '';
  28.     $zc_col_count_description++;
  29.     break;
  30.     case 'PRODUCT_LIST_NAME':
  31.     $lc_text = TABLE_HEADING_PRODUCTS;
  32.     $lc_align = '';
  33.     $zc_col_count_description++;
  34.     break;
  35.     case 'PRODUCT_LIST_MANUFACTURER':
  36.     $lc_text = TABLE_HEADING_MANUFACTURER;
  37.     $lc_align = '';
  38.     $zc_col_count_description++;
  39.     break;
  40.     case 'PRODUCT_LIST_PRICE':
  41.     $lc_text = TABLE_HEADING_PRICE;
  42.     $lc_align = 'right' . (PRODUCTS_LIST_PRICE_WIDTH > 0 ? '" width="' . PRODUCTS_LIST_PRICE_WIDTH : '');
  43.     $zc_col_count_description++;
  44.     break;
  45.     case 'PRODUCT_LIST_QUANTITY':
  46.     $lc_text = TABLE_HEADING_QUANTITY;
  47.     $lc_align = 'right';
  48.     $zc_col_count_description++;
  49.     break;
  50.     case 'PRODUCT_LIST_WEIGHT':
  51.     $lc_text = TABLE_HEADING_WEIGHT;
  52.     $lc_align = 'right';
  53.     $zc_col_count_description++;
  54.     break;
  55.     case 'PRODUCT_LIST_IMAGE':
  56.     $lc_text = TABLE_HEADING_IMAGE;
  57.     $lc_align = 'center';
  58.     $zc_col_count_description++;
  59.     break;
  60.   }
  61.  
  62.   if ( ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
  63.     $lc_text = zen_create_sort_heading($_GET['sort'], $col+1, $lc_text);
  64.   }
  65.  
  66.  
  67.  
  68.   $list_box_contents[0][$col] = array('align' => $lc_align,
  69.                                       'params' => 'class="productListing-heading"',
  70.                                       'text' => $lc_text );
  71. }
  72.  
  73. if ($listing_split->number_of_rows > 0) {
  74.   $rows = 0;
  75.   $listing = $db->Execute($listing_split->sql_query);
  76.   $extra_row = 0;
  77.   while (!$listing->EOF) {
  78.     $rows++;
  79.  
  80.     if ((($rows-$extra_row)/2) == floor(($rows-$extra_row)/2)) {
  81.       $list_box_contents[$rows] = array('params' => 'class="productListing-even"');
  82.     } else {
  83.       $list_box_contents[$rows] = array('params' => 'class="productListing-odd"');
  84.     }
  85.  
  86.     $cur_row = sizeof($list_box_contents) - 1;
  87.  
  88.     for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
  89.       $lc_align = '';
  90.       switch ($column_list[$col]) {
  91.         case 'PRODUCT_LIST_MODEL':
  92.         $lc_align = '';
  93.         $lc_text = $listing->fields['products_model'];
  94.         break;
  95.         case 'PRODUCT_LIST_NAME':
  96.         $lc_align = '';
  97.         $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
  98.         break;
  99.         case 'PRODUCT_LIST_MANUFACTURER':
  100.         $lc_align = '';
  101.         $lc_text = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>';
  102.         break;
  103.         case 'PRODUCT_LIST_PRICE':
  104.         $lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
  105.         $lc_align = 'right';
  106.         $lc_text =  $lc_price;
  107.  
  108.         // more info in place of buy now
  109.         $lc_button = '';
  110.         if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
  111.           $lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
  112.         } else {
  113.           if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
  114.             if (
  115.                 // not a hide qty box product
  116.                 $listing->fields['products_qty_box_status'] != 0 &&
  117.                 // product type can be added to cart
  118.                 zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N'
  119.                 &&
  120.                 // product is not call for price
  121.                 $listing->fields['product_is_call'] == 0
  122.                 &&
  123.                 // product is in stock or customers may add it to cart anyway
  124.                 ($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) ) {
  125.               $how_many++;
  126.             }
  127.             // hide quantity box
  128.             if ($listing->fields['products_qty_box_status'] == 0) {
  129.               $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
  130.             } else {
  131.               $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
  132.             }
  133.           } else {
  134. // qty box with add to cart button
  135.             if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
  136.               $lc_button= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
  137.             } else {
  138.               $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
  139.             }
  140.           }
  141.         }
  142.         $the_button = $lc_button;
  143.         $products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
  144.         $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
  145.         $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
  146.  
  147.         break;
  148.         case 'PRODUCT_LIST_QUANTITY':
  149.         $lc_align = 'right';
  150.         $lc_text = $listing->fields['products_quantity'];
  151.         break;
  152.         case 'PRODUCT_LIST_WEIGHT':
  153.         $lc_align = 'right';
  154.         $lc_text = $listing->fields['products_weight'];
  155.         break;
  156.         case 'PRODUCT_LIST_IMAGE':
  157.         $lc_align = 'center';
  158.         if ($listing->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
  159.           $lc_text = '';
  160.         } else {
  161.           if (isset($_GET['manufacturers_id'])) {
  162.             $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
  163.           } else {
  164.             $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
  165.           }
  166.         }
  167.         break;
  168.       }
  169.  
  170.       $list_box_contents[$rows][$col] = array('align' => $lc_align,
  171.                                               'params' => 'class="productListing-data"',
  172.                                               'text'  => $lc_text);
  173.     }
  174.  
  175.     // add description and match alternating colors
  176.     //if (PRODUCT_LIST_DESCRIPTION > 0) {
  177.     //  $rows++;
  178.     //  if ($extra_row == 1) {
  179.     //    $list_box_description = "productListing-data-description-even";
  180.     //    $extra_row=0;
  181.     //  } else {
  182.     //    $list_box_description = "productListing-data-description-odd";
  183.     //    $extra_row=1;
  184.     //  }
  185.     //  $list_box_contents[$rows][] = array('params' => 'class="' . $list_box_description . '" colspan="' . $zc_col_count_description . '"',
  186.     //  'text' => zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION));
  187.     //}
  188.     $listing->MoveNext();
  189.   }
  190.   $error_categories = false;
  191. } else {
  192.   $list_box_contents = array();
  193.  
  194.   $list_box_contents[0] = array('params' => 'class="productListing-odd"');
  195.   $list_box_contents[0][] = array('params' => 'class="productListing-data"',
  196.                                               'text' => TEXT_NO_PRODUCTS);
  197.  
  198.   $error_categories = true;
  199. }
  200.  
  201. if (($how_many > 0 and $show_submit == true and $listing_split->number_of_rows > 0) and (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART == 1 or  PRODUCT_LISTING_MULTIPLE_ADD_TO_CART == 3) ) {
  202.   $show_top_submit_button = true;
  203. } else {
  204.   $show_top_submit_button = false;
  205. }
  206. if (($how_many > 0 and $show_submit == true and $listing_split->number_of_rows > 0) and (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART >= 2) ) {
  207.   $show_bottom_submit_button = true;
  208. } else {
  209.   $show_bottom_submit_button = false;
  210. }
  211.  
  212.  
  213.  
  214.   if ($how_many > 0 && PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0 and $show_submit == true and $listing_split->number_of_rows > 0) {
  215.   // bof: multiple products
  216.     echo zen_draw_form('multiple_products_cart_quantity', zen_href_link(FILENAME_DEFAULT, zen_get_all_get_params(array('action')) . 'action=multiple_products_add_product'), 'post', 'enctype="multipart/form-data"');
  217.   }
  218.  
  219.