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

Zen Cart 源代码 order_history.php




下载文件

文件名: order_history.php
文件类型: PHP文件
文件大小: 2.59 KiB
MD5: 317d6ec5f31af22ecd1dcd640d287b5c

order_history.php - 关闭高亮
  1. <?php
  2. /**
  3.  * order_history sidebox - if enabled, shows customers' most recent orders
  4.  *
  5.  * @package templateSystem
  6.  * @copyright Copyright 2003-2006 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: order_history.php 4822 2006-10-23 11:11:36Z drbyte $
  10.  */
  11.  
  12.   if (isset($_SESSION['customer_id']) && (int)$_SESSION['customer_id'] != 0) {
  13. // retreive the last x products purchased
  14.   $orders_history_query = "select distinct op.products_id
  15.                   from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p
  16.                   where o.customers_id = '" . (int)$_SESSION['customer_id'] . "'
  17.                   and o.orders_id = op.orders_id
  18.                   and op.products_id = p.products_id
  19.                   and p.products_status = '1'
  20.                   group by products_id
  21.                   order by o.date_purchased desc
  22.                   limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX;
  23.  
  24.     $orders_history = $db->Execute($orders_history_query);
  25.  
  26.     if ($orders_history->RecordCount() > 0) {
  27.       $product_ids = '';
  28.       while (!$orders_history->EOF) {
  29.         $product_ids .= (int)$orders_history->fields['products_id'] . ',';
  30.         $orders_history->MoveNext();
  31.       }
  32.       $product_ids = substr($product_ids, 0, -1);
  33.       $rows=0;
  34.       $customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
  35.       $products_history_query = "select products_id, products_name
  36.                         from " . TABLE_PRODUCTS_DESCRIPTION . "
  37.                         where products_id in (" . $product_ids . ")
  38.                         and language_id = '" . (int)$_SESSION['languages_id'] . "'
  39.                         order by products_name";
  40.  
  41.       $products_history = $db->Execute($products_history_query);
  42.  
  43.       while (!$products_history->EOF) {
  44.         $rows++;
  45.         $customer_orders[$rows]['id'] = $products_history->fields['products_id'];
  46.         $customer_orders[$rows]['name'] = $products_history->fields['products_name'];
  47.         $products_history->MoveNext();
  48.       }
  49.       $customer_orders_string .= '</table>';
  50.  
  51.       require($template->get_template_dir('tpl_order_history.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_order_history.php');
  52.       $title =  BOX_HEADING_CUSTOMER_ORDERS;
  53.       $title_link = false;
  54.       require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
  55.     }
  56.   }
  57. ?>


cron