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

Zen Cart 源代码 orders.php




下载文件

文件名: orders.php
文件类型: PHP文件
文件大小: 61.34 KiB
MD5: 38c212d3304c0564c64e0802ec8dd27d

orders.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: orders.php 19530 2011-09-19 13:52:37Z ajeh $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   require(DIR_WS_CLASSES . 'currencies.php');
  13.   $currencies = new currencies();
  14.  
  15.   if (isset($_GET['oID'])) $_GET['oID'] = (int)$_GET['oID'];
  16.   if (isset($_GET['download_reset_on'])) $_GET['download_reset_on'] = (int)$_GET['download_reset_on'];
  17.   if (isset($_GET['download_reset_off'])) $_GET['download_reset_off'] = (int)$_GET['download_reset_off'];
  18.  
  19.   include(DIR_WS_CLASSES . 'order.php');
  20.  
  21.   // prepare order-status pulldown list
  22.   $orders_statuses = array();
  23.   $orders_status_array = array();
  24.   $orders_status = $db->Execute("select orders_status_id, orders_status_name
  25.                                 from " . TABLE_ORDERS_STATUS . "
  26.                                 where language_id = '" . (int)$_SESSION['languages_id'] . "' order by orders_status_id");
  27.   while (!$orders_status->EOF) {
  28.     $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'],
  29.                                'text' => $orders_status->fields['orders_status_name'] . ' [' . $orders_status->fields['orders_status_id'] . ']');
  30.     $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name'];
  31.     $orders_status->MoveNext();
  32.   }
  33.  
  34.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  35.   $order_exists = false;
  36.   if (isset($_GET['oID']) && trim($_GET['oID']) == '') unset($_GET['oID']);
  37.   if ($action == 'edit' && !isset($_GET['oID'])) $action = '';
  38.  
  39.   $oID = FALSE;
  40.   if (isset($_POST['oID'])) {
  41.     $oID = zen_db_prepare_input(trim($_POST['oID']));
  42.   } elseif (isset($_GET['oID'])) {
  43.     $oID = zen_db_prepare_input(trim($_GET['oID']));
  44.   }
  45.   if ($oID) {
  46.     $orders = $db->Execute("select orders_id from " . TABLE_ORDERS . "
  47.                              where orders_id = '" . (int)$oID . "'");
  48.     $order_exists = true;
  49.     if ($orders->RecordCount() <= 0) {
  50.       $order_exists = false;
  51.       if ($action != '') $messageStack->add_session(ERROR_ORDER_DOES_NOT_EXIST . ' ' . $oID, 'error');
  52.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
  53.     }
  54.   }
  55.  
  56.   if (zen_not_null($action) && $order_exists == true) {
  57.     switch ($action) {
  58.       case 'edit':
  59.       // reset single download to on
  60.         if ($_GET['download_reset_on'] > 0) {
  61.           // adjust download_maxdays based on current date
  62.           $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
  63.                                      date_purchased from " . TABLE_ORDERS . "
  64.                                      where orders_id = '" . $_GET['oID'] . "'");
  65.  
  66.           // check for existing product attribute download days and max
  67.           $chk_products_download_query = "SELECT orders_products_id, orders_products_filename, products_prid from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " WHERE orders_products_download_id='" . $_GET['download_reset_on'] . "'";
  68.           $chk_products_download = $db->Execute($chk_products_download_query);
  69.  
  70.           $chk_products_download_time_query = "SELECT pa.products_attributes_id, pa.products_id, pad.products_attributes_filename, pad.products_attributes_maxdays, pad.products_attributes_maxcount
  71.          from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
  72.          WHERE pa.products_attributes_id = pad.products_attributes_id
  73.          and pad.products_attributes_filename = '" . $chk_products_download->fields['orders_products_filename'] . "'
  74.          and pa.products_id = '" . (int)$chk_products_download->fields['products_prid'] . "'";
  75.  
  76.           $chk_products_download_time = $db->Execute($chk_products_download_time_query);
  77.  
  78.           if ($chk_products_download_time->EOF) {
  79.             $zc_max_days = (DOWNLOAD_MAX_DAYS == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS);
  80.             $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
  81.           } else {
  82.             $zc_max_days = ($chk_products_download_time->fields['products_attributes_maxdays'] == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + $chk_products_download_time->fields['products_attributes_maxdays']);
  83.             $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . $chk_products_download_time->fields['products_attributes_maxcount'] . "' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
  84.           }
  85.  
  86.           $db->Execute($update_downloads_query);
  87.           unset($_GET['download_reset_on']);
  88.  
  89.           $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_ON, 'success');
  90.           zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  91.         }
  92.       // reset single download to off
  93.         if ($_GET['download_reset_off'] > 0) {
  94.           // adjust download_maxdays based on current date
  95.           // *** fix: adjust count not maxdays to cancel download
  96. //          $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='0', download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";
  97.           $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";
  98.           $db->Execute($update_downloads_query);
  99.           unset($_GET['download_reset_off']);
  100.  
  101.           $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_OFF, 'success');
  102.           zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  103.         }
  104.       break;
  105.       case 'update_order':
  106.         // demo active test
  107.         if (zen_admin_demo()) {
  108.           $_GET['action']= '';
  109.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  110.           zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  111.         }
  112.         $oID = zen_db_prepare_input($_GET['oID']);
  113.         $comments = zen_db_prepare_input($_POST['comments']);
  114.         $status = (int)zen_db_prepare_input($_POST['status']);
  115.         if ($status < 1) break;
  116.  
  117.         $order_updated = false;
  118.         $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
  119.                                      date_purchased from " . TABLE_ORDERS . "
  120.                                      where orders_id = '" . (int)$oID . "'");
  121.  
  122.         if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
  123.           $db->Execute("update " . TABLE_ORDERS . "
  124.                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
  125.                        where orders_id = '" . (int)$oID . "'");
  126.  
  127.           $customer_notified = '0';
  128.           if (isset($_POST['notify']) && ($_POST['notify'] == '1')) {
  129.  
  130.             $notify_comments = '';
  131.             if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
  132.               $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
  133.             }
  134.             //send emails
  135.             $message =
  136.             EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
  137.             EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
  138.             EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
  139.             strip_tags($notify_comments) .
  140.             EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
  141.             EMAIL_TEXT_STATUS_PLEASE_REPLY;
  142.  
  143.             $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
  144.             $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
  145.             $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
  146.             $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
  147.             $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
  148.             $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
  149.             $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
  150.             $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
  151.             $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
  152.             $html_msg['EMAIL_PAYPAL_TRANSID'] = '';
  153.  
  154.             zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
  155.             $customer_notified = '1';
  156.  
  157.             // PayPal Trans ID, if any
  158.             $sql = "select txn_id, parent_txn_id from " . TABLE_PAYPAL . " where order_id = :orderID order by last_modified DESC, date_added DESC, parent_txn_id DESC, paypal_ipn_id DESC ";
  159.             $sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
  160.             $result = $db->Execute($sql);
  161.             if ($result->RecordCount() > 0) {
  162.               $message .= "\n\n" . ' PayPal Trans ID: ' . $result->fields['txn_id'];
  163.               $html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id'];
  164.             }
  165.  
  166.             //send extra emails
  167.             if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
  168.               zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
  169.             }
  170.           } elseif (isset($_POST['notify']) && ($_POST['notify'] == '-1')) {
  171.             // hide comment
  172.             $customer_notified = '-1';
  173.           }
  174.  
  175.           $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
  176.                      (orders_id, orders_status_id, date_added, customer_notified, comments)
  177.                      values ('" . (int)$oID . "',
  178.                      '" . zen_db_input($status) . "',
  179.                      now(),
  180.                      '" . zen_db_input($customer_notified) . "',
  181.                      '" . zen_db_input($comments)  . "')");
  182.           $order_updated = true;
  183.         }
  184.  
  185.         // trigger any appropriate updates which should be sent back to the payment gateway:
  186.         $order = new order((int)$oID);
  187.         if ($order->info['payment_module_code']) {
  188.           if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  189.             require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  190.             require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  191.             $module = new $order->info['payment_module_code'];
  192.             if (method_exists($module, '_doStatusUpdate')) {
  193.               $response = $module->_doStatusUpdate($oID, $status, $comments, $customer_notified, $check_status->fields['orders_status']);
  194.             }
  195.           }
  196.         }
  197.  
  198.         if ($order_updated == true) {
  199.           if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
  200.  
  201.             // adjust download_maxdays based on current date
  202.             $chk_downloads_query = "SELECT opd.*, op.products_id from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd, " . TABLE_ORDERS_PRODUCTS . " op
  203.                                    WHERE op.orders_id='" . (int)$oID . "'
  204.                                    and opd.orders_products_id = op.orders_products_id";
  205.             $chk_downloads = $db->Execute($chk_downloads_query);
  206.  
  207.             while (!$chk_downloads->EOF) {
  208.               $chk_products_download_time_query = "SELECT pa.products_attributes_id, pa.products_id, pad.products_attributes_filename, pad.products_attributes_maxdays, pad.products_attributes_maxcount
  209.                                                    from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
  210.                                                    WHERE pa.products_attributes_id = pad.products_attributes_id
  211.                                                    and pad.products_attributes_filename = '" . $chk_downloads->fields['orders_products_filename'] . "'
  212.                                                    and pa.products_id = '" . $chk_downloads->fields['products_id'] . "'";
  213.  
  214.               $chk_products_download_time = $db->Execute($chk_products_download_time_query);
  215.  
  216.               if ($chk_products_download_time->EOF) {
  217.                 $zc_max_days = (DOWNLOAD_MAX_DAYS == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS);
  218.                 $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int)$oID . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
  219.               } else {
  220.                 $zc_max_days = ($chk_products_download_time->fields['products_attributes_maxdays'] == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + $chk_products_download_time->fields['products_attributes_maxdays']);
  221.                 $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . $chk_products_download_time->fields['products_attributes_maxcount'] . "' where orders_id='" . (int)$oID . "' and orders_products_download_id='" . $chk_downloads->fields['orders_products_download_id'] . "'";
  222.               }
  223.  
  224.               $db->Execute($update_downloads_query);
  225.  
  226.               $chk_downloads->MoveNext();
  227.             }
  228.           }
  229.           $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
  230.         } else {
  231.           $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
  232.         }
  233.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  234.         break;
  235.       case 'deleteconfirm':
  236.         // demo active test
  237.         if (zen_admin_demo()) {
  238.           $_GET['action']= '';
  239.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  240.           zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
  241.         }
  242.         $oID = zen_db_prepare_input($_POST['oID']);
  243.  
  244.         zen_remove_order($oID, $_POST['restock']);
  245.  
  246.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
  247.         break;
  248.       case 'delete_cvv':
  249.         $delete_cvv = $db->Execute("update " . TABLE_ORDERS . " set cc_cvv = '" . TEXT_DELETE_CVV_REPLACEMENT . "' where orders_id = '" . (int)$_GET['oID'] . "'");
  250.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  251.         break;
  252.       case 'mask_cc':
  253.         $result  = $db->Execute("select cc_number from " . TABLE_ORDERS . " where orders_id = '" . (int)$_GET['oID'] . "'");
  254.         $old_num = $result->fields['cc_number'];
  255.         $new_num = substr($old_num, 0, 4) . str_repeat('*', (strlen($old_num) - 8)) . substr($old_num, -4);
  256.         $mask_cc = $db->Execute("update " . TABLE_ORDERS . " set cc_number = '" . $new_num . "' where orders_id = '" . (int)$_GET['oID'] . "'");
  257.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  258.         break;
  259.  
  260.       case 'doRefund':
  261.         $order = new order($oID);
  262.         if ($order->info['payment_module_code']) {
  263.           if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  264.             require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  265.             require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  266.             $module = new $order->info['payment_module_code'];
  267.             if (method_exists($module, '_doRefund')) {
  268.               $module->_doRefund($oID);
  269.             }
  270.           }
  271.         }
  272.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  273.         break;
  274.       case 'doAuth':
  275.         $order = new order($oID);
  276.         if ($order->info['payment_module_code']) {
  277.           if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  278.             require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  279.             require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  280.             $module = new $order->info['payment_module_code'];
  281.             if (method_exists($module, '_doAuth')) {
  282.               $module->_doAuth($oID, $order->info['total'], $order->info['currency']);
  283.             }
  284.           }
  285.         }
  286.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  287.         break;
  288.       case 'doCapture':
  289.         $order = new order($oID);
  290.         if ($order->info['payment_module_code']) {
  291.           if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  292.             require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  293.             require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  294.             $module = new $order->info['payment_module_code'];
  295.             if (method_exists($module, '_doCapt')) {
  296.               $module->_doCapt($oID, 'Complete', $order->info['total'], $order->info['currency']);
  297.             }
  298.           }
  299.         }
  300.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  301.         break;
  302.       case 'doVoid':
  303.         $order = new order($oID);
  304.         if ($order->info['payment_module_code']) {
  305.           if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  306.             require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  307.             require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  308.             $module = new $order->info['payment_module_code'];
  309.             if (method_exists($module, '_doVoid')) {
  310.               $module->_doVoid($oID);
  311.             }
  312.           }
  313.         }
  314.         zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  315.         break;
  316.     }
  317.   }
  318. ?>
  319. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  320. <html <?php echo HTML_PARAMS; ?>>
  321. <head>
  322. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  323. <title><?php echo TITLE; ?></title>
  324. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  325. <link rel="stylesheet" type="text/css" media="print" href="includes/stylesheet_print.css">
  326. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  327. <script language="javascript" src="includes/menu.js"></script>
  328. <script language="javascript" src="includes/general.js"></script>
  329. <script type="text/javascript">
  330.   <!--
  331.   function init()
  332.   {
  333.     cssjsmenu('navbar');
  334.     if (document.getElementById)
  335.     {
  336.       var kill = document.getElementById('hoverJS');
  337.       kill.disabled = true;
  338.     }
  339.   }
  340.   // -->
  341. </script>
  342. <script language="javascript" type="text/javascript"><!--
  343. function couponpopupWindow(url) {
  344.   window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
  345. }
  346. //--></script>
  347. </head>
  348. <body onLoad="init()">
  349. <!-- header //-->
  350. <div class="header-area">
  351. <?php
  352.   require(DIR_WS_INCLUDES . 'header.php');
  353. ?>
  354. </div>
  355. <!-- header_eof //-->
  356.  
  357. <!-- body //-->
  358. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  359. <!-- body_text //-->
  360.  
  361. <?php if ($action == '') { ?>
  362. <!-- search -->
  363.   <tr>
  364.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  365.       <tr>
  366.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  367.          <tr><?php echo zen_draw_form('search', FILENAME_ORDERS, '', 'get', '', true); ?>
  368.             <td width="65%" class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  369.             <td colspan="2" class="smallText" align="right">
  370. <?php
  371. // show reset search
  372.   if ((isset($_GET['search']) && zen_not_null($_GET['search'])) or $_GET['cID'] !='') {
  373.     echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />';
  374.   }
  375. ?>
  376. <?php
  377.   echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
  378.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  379.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  380.     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  381.   }
  382. ?>
  383.             </td>
  384.           </form>
  385.  
  386.  
  387.          <?php echo zen_draw_form('search_orders_products', FILENAME_ORDERS, '', 'get', '', true); ?>
  388.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  389.             <td colspan="2" class="smallText" align="right">
  390. <?php
  391. // show reset search orders_products
  392.   if ((isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) or $_GET['cID'] !='') {
  393.     echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />';
  394.   }
  395. ?>
  396. <?php
  397.   echo HEADING_TITLE_SEARCH_DETAIL_ORDERS_PRODUCTS . ' ' . zen_draw_input_field('search_orders_products') . zen_hide_session_id();
  398.   if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
  399.     $keywords_orders_products = zen_db_input(zen_db_prepare_input($_GET['search_orders_products']));
  400.     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER_ORDERS_PRODUCTS . zen_db_prepare_input($keywords_orders_products);
  401.   }
  402. ?>
  403.             </td>
  404.           </form>
  405.  
  406.         </table></td>
  407.       </tr>
  408. <!-- search -->
  409. <?php } ?>
  410.  
  411.  
  412. <?php
  413.   if (($action == 'edit') && ($order_exists == true)) {
  414.     $order = new order($oID);
  415.     if ($order->info['payment_module_code']) {
  416.       if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  417.         require(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  418.         require(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  419.         $module = new $order->info['payment_module_code'];
  420. //        echo $module->admin_notification($oID);
  421.       }
  422.     }
  423. ?>
  424.       <tr>
  425.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  426.           <tr>
  427.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  428.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  429.             <td class="pageHeading" align="right"><?php echo '<a href="javascript:history.back()">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  430.           </tr>
  431.         </table></td>
  432.       </tr>
  433.       <tr>
  434.         <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
  435.           <tr>
  436.             <td colspan="3"><?php echo zen_draw_separator(); ?></td>
  437.           </tr>
  438.           <tr>
  439.             <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  440.               <tr>
  441.                 <td class="main" valign="top"><strong><?php echo ENTRY_CUSTOMER; ?></strong></td>
  442.                 <td class="main"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'); ?></td>
  443.               </tr>
  444.               <tr>
  445.                 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  446.               </tr>
  447.               <tr>
  448.                 <td class="main"><strong><?php echo ENTRY_TELEPHONE_NUMBER; ?></strong></td>
  449.                 <td class="main"><?php echo $order->customer['telephone']; ?></td>
  450.               </tr>
  451.               <tr>
  452.                 <td class="main"><strong><?php echo ENTRY_EMAIL_ADDRESS; ?></strong></td>
  453.                 <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '">' . $order->customer['email_address'] . '</a>'; ?></td>
  454.               </tr>
  455.               <tr>
  456.                 <td class="main"><strong><?php echo TEXT_INFO_IP_ADDRESS; ?></strong></td>
  457.                 <td class="main"><?php echo $order->info['ip_address']; ?></td>
  458.               </tr>
  459.             </table></td>
  460.             <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  461.               <tr>
  462.                 <td class="main" valign="top"><strong><?php echo ENTRY_SHIPPING_ADDRESS; ?></strong></td>
  463.                 <td class="main"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'); ?></td>
  464.               </tr>
  465.             </table></td>
  466.             <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  467.               <tr>
  468.                 <td class="main" valign="top"><strong><?php echo ENTRY_BILLING_ADDRESS; ?></strong></td>
  469.                 <td class="main"><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'); ?></td>
  470.               </tr>
  471.             </table></td>
  472.           </tr>
  473.         </table></td>
  474.       </tr>
  475.       <tr>
  476.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  477.       </tr>
  478.       <tr>
  479.         <td class="main"><strong><?php echo ENTRY_ORDER_ID . $oID; ?></strong></td>
  480.       </tr>
  481.       <tr>
  482.      <td><table border="0" cellspacing="0" cellpadding="2">
  483.         <tr>
  484.            <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
  485.            <td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
  486.         </tr>
  487.         <tr>
  488.            <td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td>
  489.            <td class="main"><?php echo $order->info['payment_method']; ?></td>
  490.         </tr>
  491. <?php
  492.     if (zen_not_null($order->info['cc_type']) || zen_not_null($order->info['cc_owner']) || zen_not_null($order->info['cc_number'])) {
  493. ?>
  494.           <tr>
  495.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  496.           </tr>
  497.           <tr>
  498.             <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>
  499.             <td class="main"><?php echo $order->info['cc_type']; ?></td>
  500.           </tr>
  501.           <tr>
  502.             <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>
  503.             <td class="main"><?php echo $order->info['cc_owner']; ?></td>
  504.           </tr>
  505.           <tr>
  506.             <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>
  507.             <td class="main"><?php echo $order->info['cc_number'] . (zen_not_null($order->info['cc_number']) && !strstr($order->info['cc_number'],'X') && !strstr($order->info['cc_number'],'********') ? '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_ORDERS, '&action=mask_cc&oID=' . $oID, 'NONSSL') . '" class="noprint">' . TEXT_MASK_CC_NUMBER . '</a>' : ''); ?><td>
  508.           </tr>
  509. <?php if (zen_not_null($order->info['cc_cvv'])) { ?>
  510.           <tr>
  511.             <td class="main"><?php echo ENTRY_CREDIT_CARD_CVV; ?></td>
  512.             <td class="main"><?php echo $order->info['cc_cvv'] . (zen_not_null($order->info['cc_cvv']) && !strstr($order->info['cc_cvv'],TEXT_DELETE_CVV_REPLACEMENT) ? '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_ORDERS, '&action=delete_cvv&oID=' . $oID, 'NONSSL') . '" class="noprint">' . TEXT_DELETE_CVV_FROM_DATABASE . '</a>' : ''); ?><td>
  513.           </tr>
  514. <?php } ?>
  515.           <tr>
  516.             <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>
  517.             <td class="main"><?php echo $order->info['cc_expires']; ?></td>
  518.           </tr>
  519. <?php
  520.     }
  521. ?>
  522.         </table></td>
  523.       </tr>
  524. <?php
  525.       if (method_exists($module, 'admin_notification')) {
  526. ?>
  527.       <tr>
  528.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  529.       </tr>
  530.       <tr>
  531.         <?php echo $module->admin_notification($oID); ?>
  532.       </tr>
  533.       <tr>
  534.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  535.       </tr>
  536. <?php
  537. }
  538. ?>
  539.       <tr>
  540.         <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  541.           <tr class="dataTableHeadingRow">
  542.             <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
  543.             <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
  544.             <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
  545.             <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
  546.             <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
  547.             <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
  548.             <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
  549.           </tr>
  550. <?php
  551.     for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  552.       if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true')
  553.       {
  554.         $priceIncTax = $currencies->format(zen_round(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']),$currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
  555.       } else
  556.       {
  557.         $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
  558.       }
  559.       echo '          <tr class="dataTableRow">' . "\n" .
  560.            '            <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
  561.            '            <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];
  562.  
  563.       if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
  564.         for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
  565.           echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
  566.           if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
  567.           if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE;
  568.           echo '</i></small></nobr>';
  569.         }
  570.       }
  571.  
  572.       echo '            </td>' . "\n" .
  573.            '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
  574.            '            <td class="dataTableContent" align="right" valign="top">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
  575.            '            <td class="dataTableContent" align="right" valign="top"><strong>' .
  576.                           $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) .
  577.                           ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') .
  578.                         '</strong></td>' . "\n" .
  579.            '            <td class="dataTableContent" align="right" valign="top"><strong>' .
  580.                           $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) .
  581.                           ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
  582.                         '</strong></td>' . "\n" .
  583.            '            <td class="dataTableContent" align="right" valign="top"><strong>' .
  584.                           $currencies->format(zen_round($order->products[$i]['final_price'], $currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) .
  585.                           ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') .
  586.                         '</strong></td>' . "\n" .
  587.            '            <td class="dataTableContent" align="right" valign="top"><strong>' .
  588.                           $priceIncTax .
  589.                           ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
  590.                         '</strong></td>' . "\n";
  591.       echo '          </tr>' . "\n";
  592.     }
  593. ?>
  594.           <tr>
  595.             <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
  596. <?php
  597.     for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
  598.       echo '              <tr>' . "\n" .
  599.            '                <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $order->totals[$i]['title'] . '</td>' . "\n" .
  600.            '                <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $currencies->format($order->totals[$i]['value'], false) . '</td>' . "\n" .
  601.            '              </tr>' . "\n";
  602.     }
  603. ?>
  604.             </table></td>
  605.           </tr>
  606.         </table></td>
  607.       </tr>
  608.  
  609. <?php
  610.   // show downloads
  611.   require(DIR_WS_MODULES . 'orders_download.php');
  612. ?>
  613.  
  614.       <tr>
  615.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  616.       </tr>
  617.       <tr>
  618.         <td class="main"><table border="1" cellspacing="0" cellpadding="5">
  619.           <tr>
  620.             <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td>
  621.             <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td>
  622.             <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td>
  623.             <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
  624.           </tr>
  625. <?php
  626.     $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
  627.                                    from " . TABLE_ORDERS_STATUS_HISTORY . "
  628.                                    where orders_id = '" . zen_db_input($oID) . "'
  629.                                    order by date_added");
  630.  
  631.     if ($orders_history->RecordCount() > 0) {
  632.       while (!$orders_history->EOF) {
  633.         echo '          <tr>' . "\n" .
  634.              '            <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" .
  635.              '            <td class="smallText" align="center">';
  636.         if ($orders_history->fields['customer_notified'] == '1') {
  637.           echo zen_image(DIR_WS_ICONS . 'tick.gif', TEXT_YES) . "</td>\n";
  638.         } else if ($orders_history->fields['customer_notified'] == '-1') {
  639.           echo zen_image(DIR_WS_ICONS . 'locked.gif', TEXT_HIDDEN) . "</td>\n";
  640.         } else {
  641.           echo zen_image(DIR_WS_ICONS . 'unlocked.gif', TEXT_VISIBLE) . "</td>\n";
  642.         }
  643.         echo '            <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
  644.         echo '            <td class="smallText">' . nl2br(zen_db_output($orders_history->fields['comments'])) . '&nbsp;</td>' . "\n" .
  645.              '          </tr>' . "\n";
  646.         $orders_history->MoveNext();
  647.       }
  648.     } else {
  649.         echo '          <tr>' . "\n" .
  650.              '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
  651.              '          </tr>' . "\n";
  652.     }
  653. ?>
  654.         </table></td>
  655.       </tr>
  656.       <tr>
  657.         <td class="main noprint"><br /><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
  658.       </tr>
  659.       <tr>
  660.         <td class="noprint"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  661.       </tr>
  662.       <tr><?php echo zen_draw_form('status', FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=update_order', 'post', '', true); ?>
  663.         <td class="main noprint"><?php echo zen_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
  664.       </tr>
  665.       <tr>
  666.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  667.       </tr>
  668.       <tr>
  669.         <td><table border="0" cellspacing="0" cellpadding="2" class="noprint">
  670.           <tr>
  671.             <td><table border="0" cellspacing="0" cellpadding="2">
  672.               <tr>
  673.                 <td class="main"><strong><?php echo ENTRY_STATUS; ?></strong> <?php echo zen_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>
  674.               </tr>
  675.               <tr>
  676.                 <td class="main"><strong><?php echo ENTRY_NOTIFY_CUSTOMER; ?></strong> [<?php echo zen_draw_radio_field('notify', '1', true) . '-' . TEXT_EMAIL . ' ' . zen_draw_radio_field('notify', '0', FALSE) . '-' . TEXT_NOEMAIL . ' ' . zen_draw_radio_field('notify', '-1', FALSE) . '-' . TEXT_HIDE; ?>]&nbsp;&nbsp;&nbsp;</td>
  677.                 <td class="main"><strong><?php echo ENTRY_NOTIFY_COMMENTS; ?></strong> <?php echo zen_draw_checkbox_field('notify_comments', '', true); ?></td>
  678.               </tr>
  679.               <tr><td><br /></td></tr>
  680.             </table></td>
  681.             <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
  682.           </tr>
  683.         </table></td>
  684.       </form></tr>
  685.       <tr>
  686.         <td colspan="2" align="right" class="noprint"><?php echo '<a href="' . zen_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . zen_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . zen_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action'))) . '">' . zen_image_button('button_orders.gif', IMAGE_ORDERS) . '</a>'; ?></td>
  687.       </tr>
  688. <?php
  689. // check if order has open gv
  690.         $gv_check = $db->Execute("select order_id, unique_id
  691.                                  from " . TABLE_COUPON_GV_QUEUE ."
  692.                                  where order_id = '" . $_GET['oID'] . "' and release_flag='N' limit 1");
  693.         if ($gv_check->RecordCount() > 0) {
  694.           $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'order=' . $_GET['oID']) . '">' . zen_image_button('button_gift_queue.gif',IMAGE_GIFT_QUEUE) . '</a>';
  695.           echo '      <tr><td align="right"><table width="225"><tr>';
  696.           echo '        <td align="center">';
  697.           echo $goto_gv . '&nbsp;&nbsp;';
  698.           echo '        </td>';
  699.           echo '      </tr></table></td></tr>';
  700.         }
  701. ?>
  702. <?php
  703.   } else {
  704. ?>
  705.       <tr>
  706.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  707.           <tr>
  708.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  709.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  710.             <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  711.               <tr><?php echo zen_draw_form('orders', FILENAME_ORDERS, '', 'get', '', true); ?>
  712.                 <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . zen_draw_input_field('oID', '', 'size="12"') . zen_draw_hidden_field('action', 'edit') . zen_hide_session_id(); ?></td>
  713.               </form></tr>
  714.               <tr><?php echo zen_draw_form('status', FILENAME_ORDERS, '', 'get', '', true); ?>
  715.                 <td class="smallText" align="right">
  716.                   <?php
  717.                     echo HEADING_TITLE_STATUS . ' ' . zen_draw_pull_down_menu('status', array_merge(array(array('id' => '', 'text' => TEXT_ALL_ORDERS)), $orders_statuses), $_GET['status'], 'onChange="this.form.submit();"');
  718.                     echo zen_hide_session_id();
  719.                   ?>
  720.                 </td>
  721.               </form></tr>
  722.             </table></td>
  723.           </tr>
  724.         </table></td>
  725.       </tr>
  726.       <tr>
  727.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  728.           <tr>
  729.             <td class="smallText"><?php echo TEXT_LEGEND . ' ' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . ' ' . TEXT_BILLING_SHIPPING_MISMATCH; ?>
  730.           </td>
  731.           <tr>
  732.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  733.               <tr class="dataTableHeadingRow">
  734. <?php
  735. // Sort Listing
  736.           switch ($_GET['list_order']) {
  737.               case "id-asc":
  738.               $disp_order = "c.customers_id";
  739.               break;
  740.               case "firstname":
  741.               $disp_order = "c.customers_firstname";
  742.               break;
  743.               case "firstname-desc":
  744.               $disp_order = "c.customers_firstname DESC";
  745.               break;
  746.               case "lastname":
  747.               $disp_order = "c.customers_lastname, c.customers_firstname";
  748.               break;
  749.               case "lastname-desc":
  750.               $disp_order = "c.customers_lastname DESC, c.customers_firstname";
  751.               break;
  752.               case "company":
  753.               $disp_order = "a.entry_company";
  754.               break;
  755.               case "company-desc":
  756.               $disp_order = "a.entry_company DESC";
  757.               break;
  758.               default:
  759.               $disp_order = "c.customers_id DESC";
  760.           }
  761. ?>
  762.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDERS_ID; ?></td>
  763.                 <td class="dataTableHeadingContent" align="left" width="50"><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></td>
  764.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
  765.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td>
  766.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
  767.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
  768.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_COMMENTS; ?></td>
  769.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  770.               </tr>
  771.  
  772. <?php
  773. // Only one or the other search
  774. // create search_orders_products filter
  775.   $search = '';
  776.   $new_table = '';
  777.   $new_fields = '';
  778.   if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
  779.     $new_fields = '';
  780.     $search_distinct = ' distinct ';
  781.     $new_table = " left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) ";
  782.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search_orders_products']));
  783.     $search = " and (op.products_model like '%" . $keywords . "%' or op.products_name like '" . $keywords . "%')";
  784.     if (substr(strtoupper($_GET['search_orders_products']), 0, 3) == 'ID:') {
  785.       $keywords = TRIM(substr($_GET['search_orders_products'], 3));
  786.       $search = " and op.products_id ='" . (int)$keywords . "'";
  787.     }
  788.   } else {
  789. ?>
  790. <?php
  791. // create search filter
  792.   $search = '';
  793.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  794.     $search_distinct = ' ';
  795.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  796.     $search = " and (o.customers_city like '%" . $keywords . "%' or o.customers_postcode like '%" . $keywords . "%' or o.date_purchased like '%" . $keywords . "%' or o.billing_name like '%" . $keywords . "%' or o.billing_company like '%" . $keywords . "%' or o.billing_street_address like '%" . $keywords . "%' or o.delivery_city like '%" . $keywords . "%' or o.delivery_postcode like '%" . $keywords . "%' or o.delivery_name like '%" . $keywords . "%' or o.delivery_company like '%" . $keywords . "%' or o.delivery_street_address like '%" . $keywords . "%' or o.billing_city like '%" . $keywords . "%' or o.billing_postcode like '%" . $keywords . "%' or o.customers_email_address like '%" . $keywords . "%' or o.customers_name like '%" . $keywords . "%' or o.customers_company like '%" . $keywords . "%' or o.customers_street_address  like '%" . $keywords . "%' or o.customers_telephone like '%" . $keywords . "%' or o.ip_address  like '%" . $keywords . "%')";
  797.     $new_table = '';
  798. //    $new_fields = ", o.customers_company, o.customers_email_address, o.customers_street_address, o.delivery_company, o.delivery_name, o.delivery_street_address, o.billing_company, o.billing_name, o.billing_street_address, o.payment_module_code, o.shipping_module_code, o.ip_address ";
  799.   }
  800. } // eof: search orders or orders_products
  801.     $new_fields = ", o.customers_company, o.customers_email_address, o.customers_street_address, o.delivery_company, o.delivery_name, o.delivery_street_address, o.billing_company, o.billing_name, o.billing_street_address, o.payment_module_code, o.shipping_module_code, o.ip_address ";
  802. ?>
  803. <?php
  804.     if (isset($_GET['cID'])) {
  805.       $cID = zen_db_prepare_input($_GET['cID']);
  806.       $orders_query_raw =   "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total" .
  807.                             $new_fields . "
  808.                            from (" . TABLE_ORDERS_STATUS . " s, " .
  809.                             TABLE_ORDERS . " o " .
  810.                             $new_table . ")
  811.                            left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . "
  812.                            where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "' order by orders_id DESC";
  813.  
  814. //echo '<BR><BR>I SEE A: ' . $orders_query_raw . '<BR><BR>';
  815.  
  816.     } elseif ($_GET['status'] != '') {
  817.       $status = zen_db_prepare_input($_GET['status']);
  818.       $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total" .
  819.                           $new_fields . "
  820.                          from (" . TABLE_ORDERS_STATUS . " s, " .
  821.                           TABLE_ORDERS . " o " .
  822.                           $new_table . ")
  823.                          left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . "
  824.                          where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "' and s.orders_status_id = '" . (int)$status . "'  " .
  825.                           $search . " order by o.orders_id DESC";
  826.  
  827. //echo '<BR><BR>I SEE B: ' . $orders_query_raw . '<BR><BR>';
  828.  
  829.     } else {
  830.       $orders_query_raw = "select " . $search_distinct . " o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total" .
  831.                           $new_fields . "
  832.                          from (" . TABLE_ORDERS_STATUS . " s, " .
  833.                           TABLE_ORDERS . " o " .
  834.                           $new_table . ")
  835.                          left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . "
  836.                          where (o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "')  " .
  837.                           $search . " order by o.orders_id DESC";
  838.  
  839. //echo '<BR><BR>I SEE C: ' . $orders_query_raw . '<BR><BR>';
  840.  
  841.     }
  842.  
  843. // Split Page
  844. // reset page when page is unknown
  845. if (($_GET['page'] == '' or $_GET['page'] <= 1) and $_GET['oID'] != '') {
  846.   $check_page = $db->Execute($orders_query_raw);
  847.   $check_count=1;
  848.   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_ORDERS) {
  849.     while (!$check_page->EOF) {
  850.       if ($check_page->fields['orders_id'] == $_GET['oID']) {
  851.         break;
  852.       }
  853.       $check_count++;
  854.       $check_page->MoveNext();
  855.     }
  856.     $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_ORDERS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_ORDERS) !=0 ? .5 : 0)),0);
  857.   } else {
  858.     $_GET['page'] = 1;
  859.   }
  860. }
  861.  
  862. //    $orders_query_numrows = '';
  863.     $orders_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $orders_query_raw, $orders_query_numrows);
  864.     $orders = $db->Execute($orders_query_raw);
  865.     while (!$orders->EOF) {
  866.     if ((!isset($_GET['oID']) || (isset($_GET['oID']) && ($_GET['oID'] == $orders->fields['orders_id']))) && !isset($oInfo)) {
  867.         $oInfo = new objectInfo($orders->fields);
  868.       }
  869.  
  870.       if (isset($oInfo) && is_object($oInfo) && ($orders->fields['orders_id'] == $oInfo->orders_id)) {
  871.         echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '\'">' . "\n";
  872.       } else {
  873.         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID')) . 'oID=' . $orders->fields['orders_id'], 'NONSSL') . '\'">' . "\n";
  874.       }
  875.  
  876.       $show_difference = '';
  877.       if (($orders->fields['delivery_name'] != $orders->fields['billing_name'] and $orders->fields['delivery_name'] != '')) {
  878.         $show_difference = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . '&nbsp;';
  879.       }
  880.       if (($orders->fields['delivery_street_address'] != $orders->fields['billing_street_address'] and $orders->fields['delivery_street_address'] != '')) {
  881.         $show_difference = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . '&nbsp;';
  882.       }
  883.       $show_payment_type = $orders->fields['payment_module_code'] . '<br />' . $orders->fields['shipping_module_code'];
  884. ?>
  885.                 <td class="dataTableContent" align="right"><?php echo $show_difference . $orders->fields['orders_id']; ?></td>
  886.                 <td class="dataTableContent" align="left" width="50"><?php echo $show_payment_type; ?></td>
  887.                 <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $orders->fields['customers_id'], 'NONSSL') . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW . ' ' . TABLE_HEADING_CUSTOMERS) . '</a>&nbsp;' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br />' . $orders->fields['customers_company'] : ''); ?></td>
  888.                 <td class="dataTableContent" align="right"><?php echo strip_tags($orders->fields['order_total']); ?></td>
  889.                 <td class="dataTableContent" align="center"><?php echo zen_datetime_short($orders->fields['date_purchased']); ?></td>
  890.                 <td class="dataTableContent" align="right"><?php echo $orders->fields['orders_status_name']; ?></td>
  891.                 <td class="dataTableContent" align="center"><?php echo (zen_get_orders_comments($orders->fields['orders_id']) == '' ? '' : zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', TEXT_COMMENTS_YES, 16, 16)); ?></td>
  892.  
  893.                 <td class="dataTableContent" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders->fields['orders_id'] . '&action=edit', 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?><?php if (isset($oInfo) && is_object($oInfo) && ($orders->fields['orders_id'] == $oInfo->orders_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID')) . 'oID=' . $orders->fields['orders_id'], 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  894.               </tr>
  895. <?php
  896.       $orders->MoveNext();
  897.     }
  898. ?>
  899.               <tr>
  900.                 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  901.                   <tr>
  902.                     <td class="smallText" valign="top"><?php echo $orders_split->display_count($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
  903.                     <td class="smallText" align="right"><?php echo $orders_split->display_links($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_ORDERS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'oID', 'action'))); ?></td>
  904.                   </tr>
  905. <?php
  906.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  907. ?>
  908.                   <tr>
  909.                     <td class="smallText" align="right" colspan="2">
  910.                       <?php
  911.                         echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>';
  912.                         if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  913.                           $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  914.                           echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  915.                         }
  916.                       ?>
  917.                     </td>
  918.                   </tr>
  919. <?php
  920.   }
  921. ?>
  922.                 </table></td>
  923.               </tr>
  924.             </table></td>
  925. <?php
  926.   $heading = array();
  927.   $contents = array();
  928.  
  929.   switch ($action) {
  930.     case 'delete':
  931.       $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_DELETE_ORDER . '</strong>');
  932.  
  933.       $contents = array('form' => zen_draw_form('orders', FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . '&action=deleteconfirm', 'post', '', true) . zen_draw_hidden_field('oID', $oInfo->orders_id));
  934. //      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br /><br /><strong>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</strong>');
  935.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br /><br /><strong>' . ENTRY_ORDER_ID . $oInfo->orders_id . '<br />' . $oInfo->order_total . '<br />' . $oInfo->customers_name . ($oInfo->customers_company != '' ? '<br />' . $oInfo->customers_company : '') . '</strong>');
  936.       $contents[] = array('text' => '<br />' . zen_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY);
  937.       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id, 'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  938.       break;
  939.     default:
  940.       if (isset($oInfo) && is_object($oInfo)) {
  941.         $heading[] = array('text' => '<strong>[' . $oInfo->orders_id . ']&nbsp;&nbsp;' . zen_datetime_short($oInfo->date_purchased) . '</strong>');
  942.  
  943.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete', 'NONSSL') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  944.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . zen_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . zen_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>');
  945.         $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . zen_date_short($oInfo->date_purchased));
  946.         $contents[] = array('text' => '<br />' . $oInfo->customers_email_address);
  947.         $contents[] = array('text' => TEXT_INFO_IP_ADDRESS . ' ' . $oInfo->ip_address);
  948.         if (zen_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . zen_date_short($oInfo->last_modified));
  949.         $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' '  . $oInfo->payment_method);
  950.         $contents[] = array('text' => '<br />' . ENTRY_SHIPPING . ' '  . $oInfo->shipping_method);
  951.  
  952. // check if order has open gv
  953.         $gv_check = $db->Execute("select order_id, unique_id
  954.                                  from " . TABLE_COUPON_GV_QUEUE ."
  955.                                  where order_id = '" . $oInfo->orders_id . "' and release_flag='N' limit 1");
  956.         if ($gv_check->RecordCount() > 0) {
  957.           $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'order=' . $oInfo->orders_id) . '">' . zen_image_button('button_gift_queue.gif',IMAGE_GIFT_QUEUE) . '</a>';
  958.           $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3'));
  959.           $contents[] = array('align' => 'center', 'text' => $goto_gv);
  960.         }
  961.       }
  962.  
  963. // indicate if comments exist
  964.       $orders_history_query = $db->Execute("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . $oInfo->orders_id . "' and comments !='" . "'" );
  965.       if ($orders_history_query->RecordCount() > 0) {
  966.         $contents[] = array('align' => 'left', 'text' => '<br />' . TABLE_HEADING_COMMENTS);
  967.       }
  968.  
  969.       $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3'));
  970.       $order = new order($oInfo->orders_id);
  971.       $contents[] = array('text' => 'Products Ordered: ' . sizeof($order->products) );
  972.       for ($i=0; $i<sizeof($order->products); $i++) {
  973.         $contents[] = array('text' => $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name']);
  974.  
  975.         if (sizeof($order->products[$i]['attributes']) > 0) {
  976.           for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {
  977.             $contents[] = array('text' => '&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</i></nobr>' );
  978.           }
  979.         }
  980.         if ($i > MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) {
  981.           $contents[] = array('align' => 'left', 'text' => TEXT_MORE);
  982.           break;
  983.         }
  984.       }
  985.  
  986.       if (sizeof($order->products) > 0) {
  987.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
  988.       }
  989.       break;
  990.   }
  991.  
  992.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  993.     echo '            <td width="25%" valign="top">' . "\n";
  994.  
  995.     $box = new box;
  996.     echo $box->infoBox($heading, $contents);
  997.  
  998.     echo '            </td>' . "\n";
  999.   }
  1000. ?>
  1001.           </tr>
  1002.         </table></td>
  1003.       </tr>
  1004. <?php
  1005.   }
  1006. ?>
  1007.     </table></td>
  1008. <!-- body_text_eof //-->
  1009.   </tr>
  1010. </table>
  1011. <!-- body_eof //-->
  1012.  
  1013. <!-- footer //-->
  1014. <div class="footer-area">
  1015. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  1016. </div>
  1017. <!-- footer_eof //-->
  1018. <br />
  1019. </body>
  1020. </html>
  1021. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  1022.