|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 require(DIR_WS_CLASSES . 'currencies.php'); 00013 $currencies = new currencies(); 00014 00015 if (isset($_GET['oID'])) $_GET['oID'] = (int)$_GET['oID']; 00016 if (isset($_GET['download_reset_on'])) $_GET['download_reset_on'] = (int)$_GET['download_reset_on']; 00017 if (isset($_GET['download_reset_off'])) $_GET['download_reset_off'] = (int)$_GET['download_reset_off']; 00018 00019 include(DIR_WS_CLASSES . 'order.php'); 00020 00021 // prepare order-status pulldown list 00022 $orders_statuses = array(); 00023 $orders_status_array = array(); 00024 $orders_status = $db->Execute("select orders_status_id, orders_status_name 00025 from " . TABLE_ORDERS_STATUS . " 00026 where language_id = '" . (int)$_SESSION['languages_id'] . "' order by orders_status_id"); 00027 while (!$orders_status->EOF) { 00028 $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'], 00029 'text' => $orders_status->fields['orders_status_name'] . ' [' . $orders_status->fields['orders_status_id'] . ']'); 00030 $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name']; 00031 $orders_status->MoveNext(); 00032 } 00033 00034 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00035 $order_exists = false; 00036 if (isset($_GET['oID']) && trim($_GET['oID']) == '') unset($_GET['oID']); 00037 if ($action == 'edit' && !isset($_GET['oID'])) $action = ''; 00038 00039 $oID = FALSE; 00040 if (isset($_POST['oID'])) { 00041 $oID = zen_db_prepare_input(trim($_POST['oID'])); 00042 } elseif (isset($_GET['oID'])) { 00043 $oID = zen_db_prepare_input(trim($_GET['oID'])); 00044 } 00045 if ($oID) { 00046 $orders = $db->Execute("select orders_id from " . TABLE_ORDERS . " 00047 where orders_id = '" . (int)$oID . "'"); 00048 $order_exists = true; 00049 if ($orders->RecordCount() <= 0) { 00050 $order_exists = false; 00051 if ($action != '') $messageStack->add_session(ERROR_ORDER_DOES_NOT_EXIST . ' ' . $oID, 'error'); 00052 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL')); 00053 } 00054 } 00055 00056 if (zen_not_null($action) && $order_exists == true) { 00057 switch ($action) { 00058 case 'edit': 00059 // reset single download to on 00060 if ($_GET['download_reset_on'] > 0) { 00061 // adjust download_maxdays based on current date 00062 $check_status = $db->Execute("select customers_name, customers_email_address, orders_status, 00063 date_purchased from " . TABLE_ORDERS . " 00064 where orders_id = '" . $_GET['oID'] . "'"); 00065 00066 // check for existing product attribute download days and max 00067 $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'] . "'"; 00068 $chk_products_download = $db->Execute($chk_products_download_query); 00069 00070 $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 00071 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad 00072 WHERE pa.products_attributes_id = pad.products_attributes_id 00073 and pad.products_attributes_filename = '" . $chk_products_download->fields['orders_products_filename'] . "' 00074 and pa.products_id = '" . (int)$chk_products_download->fields['products_prid'] . "'"; 00075 00076 $chk_products_download_time = $db->Execute($chk_products_download_time_query); 00077 00078 if ($chk_products_download_time->EOF) { 00079 $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); 00080 $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'] . "'"; 00081 } else { 00082 $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']); 00083 $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'] . "'"; 00084 } 00085 00086 $db->Execute($update_downloads_query); 00087 unset($_GET['download_reset_on']); 00088 00089 $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_ON, 'success'); 00090 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00091 } 00092 // reset single download to off 00093 if ($_GET['download_reset_off'] > 0) { 00094 // adjust download_maxdays based on current date 00095 // *** fix: adjust count not maxdays to cancel download 00096 // $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'] . "'"; 00097 $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'] . "'"; 00098 $db->Execute($update_downloads_query); 00099 unset($_GET['download_reset_off']); 00100 00101 $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_OFF, 'success'); 00102 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00103 } 00104 break; 00105 case 'update_order': 00106 // demo active test 00107 if (zen_admin_demo()) { 00108 $_GET['action']= ''; 00109 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 00110 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00111 } 00112 $oID = zen_db_prepare_input($_GET['oID']); 00113 $comments = zen_db_prepare_input($_POST['comments']); 00114 $status = (int)zen_db_prepare_input($_POST['status']); 00115 if ($status < 1) break; 00116 00117 $order_updated = false; 00118 $check_status = $db->Execute("select customers_name, customers_email_address, orders_status, 00119 date_purchased from " . TABLE_ORDERS . " 00120 where orders_id = '" . (int)$oID . "'"); 00121 00122 if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) { 00123 $db->Execute("update " . TABLE_ORDERS . " 00124 set orders_status = '" . zen_db_input($status) . "', last_modified = now() 00125 where orders_id = '" . (int)$oID . "'"); 00126 00127 $customer_notified = '0'; 00128 if (isset($_POST['notify']) && ($_POST['notify'] == '1')) { 00129 00130 $notify_comments = ''; 00131 if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) { 00132 $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n"; 00133 } 00134 //send emails 00135 $message = 00136 EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" . 00137 EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" . 00138 EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" . 00139 strip_tags($notify_comments) . 00140 EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) . 00141 EMAIL_TEXT_STATUS_PLEASE_REPLY; 00142 00143 $html_msg['EMAIL_CUSTOMERS_NAME'] = $check_status->fields['customers_name']; 00144 $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID; 00145 $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>'; 00146 $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']); 00147 $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments); 00148 $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED); 00149 $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] )); 00150 $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status]; 00151 $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY); 00152 $html_msg['EMAIL_PAYPAL_TRANSID'] = ''; 00153 00154 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'); 00155 $customer_notified = '1'; 00156 00157 // PayPal Trans ID, if any 00158 $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 "; 00159 $sql = $db->bindVars($sql, ':orderID', $oID, 'integer'); 00160 $result = $db->Execute($sql); 00161 if ($result->RecordCount() > 0) { 00162 $message .= "\n\n" . ' PayPal Trans ID: ' . $result->fields['txn_id']; 00163 $html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id']; 00164 } 00165 00166 //send extra emails 00167 if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') { 00168 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'); 00169 } 00170 } elseif (isset($_POST['notify']) && ($_POST['notify'] == '-1')) { 00171 // hide comment 00172 $customer_notified = '-1'; 00173 } 00174 00175 $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . " 00176 (orders_id, orders_status_id, date_added, customer_notified, comments) 00177 values ('" . (int)$oID . "', 00178 '" . zen_db_input($status) . "', 00179 now(), 00180 '" . zen_db_input($customer_notified) . "', 00181 '" . zen_db_input($comments) . "')"); 00182 $order_updated = true; 00183 } 00184 00185 // trigger any appropriate updates which should be sent back to the payment gateway: 00186 $order = new order((int)$oID); 00187 if ($order->info['payment_module_code']) { 00188 if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { 00189 require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'); 00190 require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'); 00191 $module = new $order->info['payment_module_code']; 00192 if (method_exists($module, '_doStatusUpdate')) { 00193 $response = $module->_doStatusUpdate($oID, $status, $comments, $customer_notified, $check_status->fields['orders_status']); 00194 } 00195 } 00196 } 00197 00198 if ($order_updated == true) { 00199 if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) { 00200 00201 // adjust download_maxdays based on current date 00202 $chk_downloads_query = "SELECT opd.*, op.products_id from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd, " . TABLE_ORDERS_PRODUCTS . " op 00203 WHERE op.orders_id='" . (int)$oID . "' 00204 and opd.orders_products_id = op.orders_products_id"; 00205 $chk_downloads = $db->Execute($chk_downloads_query); 00206 00207 while (!$chk_downloads->EOF) { 00208 $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 00209 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad 00210 WHERE pa.products_attributes_id = pad.products_attributes_id 00211 and pad.products_attributes_filename = '" . $chk_downloads->fields['orders_products_filename'] . "' 00212 and pa.products_id = '" . $chk_downloads->fields['products_id'] . "'"; 00213 00214 $chk_products_download_time = $db->Execute($chk_products_download_time_query); 00215 00216 if ($chk_products_download_time->EOF) { 00217 $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); 00218 $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'] . "'"; 00219 } else { 00220 $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']); 00221 $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'] . "'"; 00222 } 00223 00224 $db->Execute($update_downloads_query); 00225 00226 $chk_downloads->MoveNext(); 00227 } 00228 } 00229 $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success'); 00230 } else { 00231 $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning'); 00232 } 00233 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00234 break; 00235 case 'deleteconfirm': 00236 // demo active test 00237 if (zen_admin_demo()) { 00238 $_GET['action']= ''; 00239 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 00240 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL')); 00241 } 00242 $oID = zen_db_prepare_input($_POST['oID']); 00243 00244 zen_remove_order($oID, $_POST['restock']); 00245 00246 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL')); 00247 break; 00248 case 'delete_cvv': 00249 $delete_cvv = $db->Execute("update " . TABLE_ORDERS . " set cc_cvv = '" . TEXT_DELETE_CVV_REPLACEMENT . "' where orders_id = '" . (int)$_GET['oID'] . "'"); 00250 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00251 break; 00252 case 'mask_cc': 00253 $result = $db->Execute("select cc_number from " . TABLE_ORDERS . " where orders_id = '" . (int)$_GET['oID'] . "'"); 00254 $old_num = $result->fields['cc_number']; 00255 $new_num = substr($old_num, 0, 4) . str_repeat('*', (strlen($old_num) - 8)) . substr($old_num, -4); 00256 $mask_cc = $db->Execute("update " . TABLE_ORDERS . " set cc_number = '" . $new_num . "' where orders_id = '" . (int)$_GET['oID'] . "'"); 00257 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00258 break; 00259 00260 case 'doRefund': 00261 $order = new order($oID); 00262 if ($order->info['payment_module_code']) { 00263 if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { 00264 require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'); 00265 require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'); 00266 $module = new $order->info['payment_module_code']; 00267 if (method_exists($module, '_doRefund')) { 00268 $module->_doRefund($oID); 00269 } 00270 } 00271 } 00272 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00273 break; 00274 case 'doAuth': 00275 $order = new order($oID); 00276 if ($order->info['payment_module_code']) { 00277 if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { 00278 require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'); 00279 require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'); 00280 $module = new $order->info['payment_module_code']; 00281 if (method_exists($module, '_doAuth')) { 00282 $module->_doAuth($oID, $order->info['total'], $order->info['currency']); 00283 } 00284 } 00285 } 00286 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00287 break; 00288 case 'doCapture': 00289 $order = new order($oID); 00290 if ($order->info['payment_module_code']) { 00291 if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { 00292 require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'); 00293 require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'); 00294 $module = new $order->info['payment_module_code']; 00295 if (method_exists($module, '_doCapt')) { 00296 $module->_doCapt($oID, 'Complete', $order->info['total'], $order->info['currency']); 00297 } 00298 } 00299 } 00300 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00301 break; 00302 case 'doVoid': 00303 $order = new order($oID); 00304 if ($order->info['payment_module_code']) { 00305 if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { 00306 require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'); 00307 require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'); 00308 $module = new $order->info['payment_module_code']; 00309 if (method_exists($module, '_doVoid')) { 00310 $module->_doVoid($oID); 00311 } 00312 } 00313 } 00314 zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL')); 00315 break; 00316 } 00317 } 00318 ?> 00319 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00320 <html <?php echo HTML_PARAMS; ?>> 00321 <head> 00322 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00323 <title><?php echo TITLE; ?></title> 00324 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00325 <link rel="stylesheet" type="text/css" media="print" href="includes/stylesheet_print.css"> 00326 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00327 <script language="javascript" src="includes/menu.js"></script> 00328 <script language="javascript" src="includes/general.js"></script> 00329 <script type="text/javascript"> 00330 <!-- 00331 function init() 00332 { 00333 cssjsmenu('navbar'); 00334 if (document.getElementById) 00335 { 00336 var kill = document.getElementById('hoverJS'); 00337 kill.disabled = true; 00338 } 00339 } 00340 // --> 00341 </script> 00342 <script language="javascript" type="text/javascript"><!-- 00343 function couponpopupWindow(url) { 00344 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') 00345 } 00346 //--></script> 00347 </head> 00348 <body onLoad="init()"> 00349 <!-- header //--> 00350 <div class="header-area"> 00351 <?php 00352 require(DIR_WS_INCLUDES . 'header.php'); 00353 ?> 00354 </div> 00355 <!-- header_eof //--> 00356 00357 <!-- body //--> 00358 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00359 <!-- body_text //--> 00360 00361 <?php if ($action == '') { ?> 00362 <!-- search --> 00363 <tr> 00364 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00365 <tr> 00366 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00367 <tr><?php echo zen_draw_form('search', FILENAME_ORDERS, '', 'get', '', true); ?> 00368 <td width="65%" class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 00369 <td colspan="2" class="smallText" align="right"> 00370 <?php 00371 // show reset search 00372 if ((isset($_GET['search']) && zen_not_null($_GET['search'])) or $_GET['cID'] !='') { 00373 echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />'; 00374 } 00375 ?> 00376 <?php 00377 echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id(); 00378 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00379 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 00380 echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords; 00381 } 00382 ?> 00383 </td> 00384 </form> 00385 00386 00387 <?php echo zen_draw_form('search_orders_products', FILENAME_ORDERS, '', 'get', '', true); ?> 00388 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 00389 <td colspan="2" class="smallText" align="right"> 00390 <?php 00391 // show reset search orders_products 00392 if ((isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) or $_GET['cID'] !='') { 00393 echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />'; 00394 } 00395 ?> 00396 <?php 00397 echo HEADING_TITLE_SEARCH_DETAIL_ORDERS_PRODUCTS . ' ' . zen_draw_input_field('search_orders_products') . zen_hide_session_id(); 00398 if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) { 00399 $keywords_orders_products = zen_db_input(zen_db_prepare_input($_GET['search_orders_products'])); 00400 echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER_ORDERS_PRODUCTS . zen_db_prepare_input($keywords_orders_products); 00401 } 00402 ?> 00403 </td> 00404 </form> 00405 00406 </table></td> 00407 </tr> 00408 <!-- search --> 00409 <?php } ?> 00410 00411 00412 <?php 00413 if (($action == 'edit') && ($order_exists == true)) { 00414 $order = new order($oID); 00415 if ($order->info['payment_module_code']) { 00416 if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { 00417 require(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'); 00418 require(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'); 00419 $module = new $order->info['payment_module_code']; 00420 // echo $module->admin_notification($oID); 00421 } 00422 } 00423 ?> 00424 <tr> 00425 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00426 <tr> 00427 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00428 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 00429 <td class="pageHeading" align="right"><?php echo '<a href="javascript:history.back()">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 00430 </tr> 00431 </table></td> 00432 </tr> 00433 <tr> 00434 <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> 00435 <tr> 00436 <td colspan="3"><?php echo zen_draw_separator(); ?></td> 00437 </tr> 00438 <tr> 00439 <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> 00440 <tr> 00441 <td class="main" valign="top"><strong><?php echo ENTRY_CUSTOMER; ?></strong></td> 00442 <td class="main"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'); ?></td> 00443 </tr> 00444 <tr> 00445 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td> 00446 </tr> 00447 <tr> 00448 <td class="main"><strong><?php echo ENTRY_TELEPHONE_NUMBER; ?></strong></td> 00449 <td class="main"><?php echo $order->customer['telephone']; ?></td> 00450 </tr> 00451 <tr> 00452 <td class="main"><strong><?php echo ENTRY_EMAIL_ADDRESS; ?></strong></td> 00453 <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '">' . $order->customer['email_address'] . '</a>'; ?></td> 00454 </tr> 00455 <tr> 00456 <td class="main"><strong><?php echo TEXT_INFO_IP_ADDRESS; ?></strong></td> 00457 <td class="main"><?php echo $order->info['ip_address']; ?></td> 00458 </tr> 00459 </table></td> 00460 <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> 00461 <tr> 00462 <td class="main" valign="top"><strong><?php echo ENTRY_SHIPPING_ADDRESS; ?></strong></td> 00463 <td class="main"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'); ?></td> 00464 </tr> 00465 </table></td> 00466 <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> 00467 <tr> 00468 <td class="main" valign="top"><strong><?php echo ENTRY_BILLING_ADDRESS; ?></strong></td> 00469 <td class="main"><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'); ?></td> 00470 </tr> 00471 </table></td> 00472 </tr> 00473 </table></td> 00474 </tr> 00475 <tr> 00476 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00477 </tr> 00478 <tr> 00479 <td class="main"><strong><?php echo ENTRY_ORDER_ID . $oID; ?></strong></td> 00480 </tr> 00481 <tr> 00482 <td><table border="0" cellspacing="0" cellpadding="2"> 00483 <tr> 00484 <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td> 00485 <td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td> 00486 </tr> 00487 <tr> 00488 <td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td> 00489 <td class="main"><?php echo $order->info['payment_method']; ?></td> 00490 </tr> 00491 <?php 00492 if (zen_not_null($order->info['cc_type']) || zen_not_null($order->info['cc_owner']) || zen_not_null($order->info['cc_number'])) { 00493 ?> 00494 <tr> 00495 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00496 </tr> 00497 <tr> 00498 <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td> 00499 <td class="main"><?php echo $order->info['cc_type']; ?></td> 00500 </tr> 00501 <tr> 00502 <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td> 00503 <td class="main"><?php echo $order->info['cc_owner']; ?></td> 00504 </tr> 00505 <tr> 00506 <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td> 00507 <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'],'********') ? ' <a href="' . zen_href_link(FILENAME_ORDERS, '&action=mask_cc&oID=' . $oID, 'NONSSL') . '" class="noprint">' . TEXT_MASK_CC_NUMBER . '</a>' : ''); ?><td> 00508 </tr> 00509 <?php if (zen_not_null($order->info['cc_cvv'])) { ?> 00510 <tr> 00511 <td class="main"><?php echo ENTRY_CREDIT_CARD_CVV; ?></td> 00512 <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) ? ' <a href="' . zen_href_link(FILENAME_ORDERS, '&action=delete_cvv&oID=' . $oID, 'NONSSL') . '" class="noprint">' . TEXT_DELETE_CVV_FROM_DATABASE . '</a>' : ''); ?><td> 00513 </tr> 00514 <?php } ?> 00515 <tr> 00516 <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td> 00517 <td class="main"><?php echo $order->info['cc_expires']; ?></td> 00518 </tr> 00519 <?php 00520 } 00521 ?> 00522 </table></td> 00523 </tr> 00524 <?php 00525 if (method_exists($module, 'admin_notification')) { 00526 ?> 00527 <tr> 00528 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00529 </tr> 00530 <tr> 00531 <?php echo $module->admin_notification($oID); ?> 00532 </tr> 00533 <tr> 00534 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00535 </tr> 00536 <?php 00537 } 00538 ?> 00539 <tr> 00540 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00541 <tr class="dataTableHeadingRow"> 00542 <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td> 00543 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> 00544 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td> 00545 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td> 00546 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td> 00547 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td> 00548 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td> 00549 </tr> 00550 <?php 00551 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { 00552 if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') 00553 { 00554 $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']); 00555 } else 00556 { 00557 $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']); 00558 } 00559 echo ' <tr class="dataTableRow">' . "\n" . 00560 ' <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" . 00561 ' <td class="dataTableContent" valign="top">' . $order->products[$i]['name']; 00562 00563 if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { 00564 for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { 00565 echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); 00566 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']) . ')'; 00567 if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE; 00568 echo '</i></small></nobr>'; 00569 } 00570 } 00571 00572 echo ' </td>' . "\n" . 00573 ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . 00574 ' <td class="dataTableContent" align="right" valign="top">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . 00575 ' <td class="dataTableContent" align="right" valign="top"><strong>' . 00576 $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . 00577 ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . 00578 '</strong></td>' . "\n" . 00579 ' <td class="dataTableContent" align="right" valign="top"><strong>' . 00580 $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . 00581 ($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']) : '') . 00582 '</strong></td>' . "\n" . 00583 ' <td class="dataTableContent" align="right" valign="top"><strong>' . 00584 $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']) . 00585 ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . 00586 '</strong></td>' . "\n" . 00587 ' <td class="dataTableContent" align="right" valign="top"><strong>' . 00588 $priceIncTax . 00589 ($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']) : '') . 00590 '</strong></td>' . "\n"; 00591 echo ' </tr>' . "\n"; 00592 } 00593 ?> 00594 <tr> 00595 <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2"> 00596 <?php 00597 for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { 00598 echo ' <tr>' . "\n" . 00599 ' <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $order->totals[$i]['title'] . '</td>' . "\n" . 00600 ' <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $currencies->format($order->totals[$i]['value'], false) . '</td>' . "\n" . 00601 ' </tr>' . "\n"; 00602 } 00603 ?> 00604 </table></td> 00605 </tr> 00606 </table></td> 00607 </tr> 00608 00609 <?php 00610 // show downloads 00611 require(DIR_WS_MODULES . 'orders_download.php'); 00612 ?> 00613 00614 <tr> 00615 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00616 </tr> 00617 <tr> 00618 <td class="main"><table border="1" cellspacing="0" cellpadding="5"> 00619 <tr> 00620 <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td> 00621 <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td> 00622 <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td> 00623 <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td> 00624 </tr> 00625 <?php 00626 $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments 00627 from " . TABLE_ORDERS_STATUS_HISTORY . " 00628 where orders_id = '" . zen_db_input($oID) . "' 00629 order by date_added"); 00630 00631 if ($orders_history->RecordCount() > 0) { 00632 while (!$orders_history->EOF) { 00633 echo ' <tr>' . "\n" . 00634 ' <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" . 00635 ' <td class="smallText" align="center">'; 00636 if ($orders_history->fields['customer_notified'] == '1') { 00637 echo zen_image(DIR_WS_ICONS . 'tick.gif', TEXT_YES) . "</td>\n"; 00638 } else if ($orders_history->fields['customer_notified'] == '-1') { 00639 echo zen_image(DIR_WS_ICONS . 'locked.gif', TEXT_HIDDEN) . "</td>\n"; 00640 } else { 00641 echo zen_image(DIR_WS_ICONS . 'unlocked.gif', TEXT_VISIBLE) . "</td>\n"; 00642 } 00643 echo ' <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n"; 00644 echo ' <td class="smallText">' . nl2br(zen_db_output($orders_history->fields['comments'])) . ' </td>' . "\n" . 00645 ' </tr>' . "\n"; 00646 $orders_history->MoveNext(); 00647 } 00648 } else { 00649 echo ' <tr>' . "\n" . 00650 ' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . 00651 ' </tr>' . "\n"; 00652 } 00653 ?> 00654 </table></td> 00655 </tr> 00656 <tr> 00657 <td class="main noprint"><br /><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td> 00658 </tr> 00659 <tr> 00660 <td class="noprint"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td> 00661 </tr> 00662 <tr><?php echo zen_draw_form('status', FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=update_order', 'post', '', true); ?> 00663 <td class="main noprint"><?php echo zen_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> 00664 </tr> 00665 <tr> 00666 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00667 </tr> 00668 <tr> 00669 <td><table border="0" cellspacing="0" cellpadding="2" class="noprint"> 00670 <tr> 00671 <td><table border="0" cellspacing="0" cellpadding="2"> 00672 <tr> 00673 <td class="main"><strong><?php echo ENTRY_STATUS; ?></strong> <?php echo zen_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td> 00674 </tr> 00675 <tr> 00676 <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; ?>] </td> 00677 <td class="main"><strong><?php echo ENTRY_NOTIFY_COMMENTS; ?></strong> <?php echo zen_draw_checkbox_field('notify_comments', '', true); ?></td> 00678 </tr> 00679 <tr><td><br /></td></tr> 00680 </table></td> 00681 <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td> 00682 </tr> 00683 </table></td> 00684 </form></tr> 00685 <tr> 00686 <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> 00687 </tr> 00688 <?php 00689 // check if order has open gv 00690 $gv_check = $db->Execute("select order_id, unique_id 00691 from " . TABLE_COUPON_GV_QUEUE ." 00692 where order_id = '" . $_GET['oID'] . "' and release_flag='N' limit 1"); 00693 if ($gv_check->RecordCount() > 0) { 00694 $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'order=' . $_GET['oID']) . '">' . zen_image_button('button_gift_queue.gif',IMAGE_GIFT_QUEUE) . '</a>'; 00695 echo ' <tr><td align="right"><table width="225"><tr>'; 00696 echo ' <td align="center">'; 00697 echo $goto_gv . ' '; 00698 echo ' </td>'; 00699 echo ' </tr></table></td></tr>'; 00700 } 00701 ?> 00702 <?php 00703 } else { 00704 ?> 00705 <tr> 00706 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00707 <tr> 00708 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00709 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 00710 <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00711 <tr><?php echo zen_draw_form('orders', FILENAME_ORDERS, '', 'get', '', true); ?> 00712 <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> 00713 </form></tr> 00714 <tr><?php echo zen_draw_form('status', FILENAME_ORDERS, '', 'get', '', true); ?> 00715 <td class="smallText" align="right"> 00716 <?php 00717 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();"'); 00718 echo zen_hide_session_id(); 00719 ?> 00720 </td> 00721 </form></tr> 00722 </table></td> 00723 </tr> 00724 </table></td> 00725 </tr> 00726 <tr> 00727 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00728 <tr> 00729 <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; ?> 00730 </td> 00731 <tr> 00732 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00733 <tr class="dataTableHeadingRow"> 00734 <?php 00735 // Sort Listing 00736 switch ($_GET['list_order']) { 00737 case "id-asc": 00738 $disp_order = "c.customers_id"; 00739 break; 00740 case "firstname": 00741 $disp_order = "c.customers_firstname"; 00742 break; 00743 case "firstname-desc": 00744 $disp_order = "c.customers_firstname DESC"; 00745 break; 00746 case "lastname": 00747 $disp_order = "c.customers_lastname, c.customers_firstname"; 00748 break; 00749 case "lastname-desc": 00750 $disp_order = "c.customers_lastname DESC, c.customers_firstname"; 00751 break; 00752 case "company": 00753 $disp_order = "a.entry_company"; 00754 break; 00755 case "company-desc": 00756 $disp_order = "a.entry_company DESC"; 00757 break; 00758 default: 00759 $disp_order = "c.customers_id DESC"; 00760 } 00761 ?> 00762 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDERS_ID; ?></td> 00763 <td class="dataTableHeadingContent" align="left" width="50"><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></td> 00764 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td> 00765 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td> 00766 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td> 00767 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td> 00768 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_COMMENTS; ?></td> 00769 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 00770 </tr> 00771 00772 <?php 00773 // Only one or the other search 00774 // create search_orders_products filter 00775 $search = ''; 00776 $new_table = ''; 00777 $new_fields = ''; 00778 if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) { 00779 $new_fields = ''; 00780 $search_distinct = ' distinct '; 00781 $new_table = " left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) "; 00782 $keywords = zen_db_input(zen_db_prepare_input($_GET['search_orders_products'])); 00783 $search = " and (op.products_model like '%" . $keywords . "%' or op.products_name like '" . $keywords . "%')"; 00784 if (substr(strtoupper($_GET['search_orders_products']), 0, 3) == 'ID:') { 00785 $keywords = TRIM(substr($_GET['search_orders_products'], 3)); 00786 $search = " and op.products_id ='" . (int)$keywords . "'"; 00787 } 00788 } else { 00789 ?> 00790 <?php 00791 // create search filter 00792 $search = ''; 00793 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00794 $search_distinct = ' '; 00795 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 00796 $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 . "%')"; 00797 $new_table = ''; 00798 // $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 "; 00799 } 00800 } // eof: search orders or orders_products 00801 $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 "; 00802 ?> 00803 <?php 00804 if (isset($_GET['cID'])) { 00805 $cID = zen_db_prepare_input($_GET['cID']); 00806 $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" . 00807 $new_fields . " 00808 from (" . TABLE_ORDERS_STATUS . " s, " . 00809 TABLE_ORDERS . " o " . 00810 $new_table . ") 00811 left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . " 00812 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"; 00813 00814 //echo '<BR><BR>I SEE A: ' . $orders_query_raw . '<BR><BR>'; 00815 00816 } elseif ($_GET['status'] != '') { 00817 $status = zen_db_prepare_input($_GET['status']); 00818 $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" . 00819 $new_fields . " 00820 from (" . TABLE_ORDERS_STATUS . " s, " . 00821 TABLE_ORDERS . " o " . 00822 $new_table . ") 00823 left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . " 00824 where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "' and s.orders_status_id = '" . (int)$status . "' " . 00825 $search . " order by o.orders_id DESC"; 00826 00827 //echo '<BR><BR>I SEE B: ' . $orders_query_raw . '<BR><BR>'; 00828 00829 } else { 00830 $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" . 00831 $new_fields . " 00832 from (" . TABLE_ORDERS_STATUS . " s, " . 00833 TABLE_ORDERS . " o " . 00834 $new_table . ") 00835 left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . " 00836 where (o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "') " . 00837 $search . " order by o.orders_id DESC"; 00838 00839 //echo '<BR><BR>I SEE C: ' . $orders_query_raw . '<BR><BR>'; 00840 00841 } 00842 00843 // Split Page 00844 // reset page when page is unknown 00845 if (($_GET['page'] == '' or $_GET['page'] <= 1) and $_GET['oID'] != '') { 00846 $check_page = $db->Execute($orders_query_raw); 00847 $check_count=1; 00848 if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_ORDERS) { 00849 while (!$check_page->EOF) { 00850 if ($check_page->fields['orders_id'] == $_GET['oID']) { 00851 break; 00852 } 00853 $check_count++; 00854 $check_page->MoveNext(); 00855 } 00856 $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_ORDERS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_ORDERS) !=0 ? .5 : 0)),0); 00857 } else { 00858 $_GET['page'] = 1; 00859 } 00860 } 00861 00862 // $orders_query_numrows = ''; 00863 $orders_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $orders_query_raw, $orders_query_numrows); 00864 $orders = $db->Execute($orders_query_raw); 00865 while (!$orders->EOF) { 00866 if ((!isset($_GET['oID']) || (isset($_GET['oID']) && ($_GET['oID'] == $orders->fields['orders_id']))) && !isset($oInfo)) { 00867 $oInfo = new objectInfo($orders->fields); 00868 } 00869 00870 if (isset($oInfo) && is_object($oInfo) && ($orders->fields['orders_id'] == $oInfo->orders_id)) { 00871 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"; 00872 } else { 00873 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"; 00874 } 00875 00876 $show_difference = ''; 00877 if (($orders->fields['delivery_name'] != $orders->fields['billing_name'] and $orders->fields['delivery_name'] != '')) { 00878 $show_difference = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . ' '; 00879 } 00880 if (($orders->fields['delivery_street_address'] != $orders->fields['billing_street_address'] and $orders->fields['delivery_street_address'] != '')) { 00881 $show_difference = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . ' '; 00882 } 00883 $show_payment_type = $orders->fields['payment_module_code'] . '<br />' . $orders->fields['shipping_module_code']; 00884 ?> 00885 <td class="dataTableContent" align="right"><?php echo $show_difference . $orders->fields['orders_id']; ?></td> 00886 <td class="dataTableContent" align="left" width="50"><?php echo $show_payment_type; ?></td> 00887 <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> ' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br />' . $orders->fields['customers_company'] : ''); ?></td> 00888 <td class="dataTableContent" align="right"><?php echo strip_tags($orders->fields['order_total']); ?></td> 00889 <td class="dataTableContent" align="center"><?php echo zen_datetime_short($orders->fields['date_purchased']); ?></td> 00890 <td class="dataTableContent" align="right"><?php echo $orders->fields['orders_status_name']; ?></td> 00891 <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> 00892 00893 <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>'; } ?> </td> 00894 </tr> 00895 <?php 00896 $orders->MoveNext(); 00897 } 00898 ?> 00899 <tr> 00900 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00901 <tr> 00902 <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> 00903 <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> 00904 </tr> 00905 <?php 00906 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00907 ?> 00908 <tr> 00909 <td class="smallText" align="right" colspan="2"> 00910 <?php 00911 echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; 00912 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 00913 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 00914 echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords; 00915 } 00916 ?> 00917 </td> 00918 </tr> 00919 <?php 00920 } 00921 ?> 00922 </table></td> 00923 </tr> 00924 </table></td> 00925 <?php 00926 $heading = array(); 00927 $contents = array(); 00928 00929 switch ($action) { 00930 case 'delete': 00931 $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_DELETE_ORDER . '</strong>'); 00932 00933 $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)); 00934 // $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br /><br /><strong>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</strong>'); 00935 $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>'); 00936 $contents[] = array('text' => '<br />' . zen_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY); 00937 $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>'); 00938 break; 00939 default: 00940 if (isset($oInfo) && is_object($oInfo)) { 00941 $heading[] = array('text' => '<strong>[' . $oInfo->orders_id . '] ' . zen_datetime_short($oInfo->date_purchased) . '</strong>'); 00942 00943 $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>'); 00944 $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>'); 00945 $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . zen_date_short($oInfo->date_purchased)); 00946 $contents[] = array('text' => '<br />' . $oInfo->customers_email_address); 00947 $contents[] = array('text' => TEXT_INFO_IP_ADDRESS . ' ' . $oInfo->ip_address); 00948 if (zen_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . zen_date_short($oInfo->last_modified)); 00949 $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' ' . $oInfo->payment_method); 00950 $contents[] = array('text' => '<br />' . ENTRY_SHIPPING . ' ' . $oInfo->shipping_method); 00951 00952 // check if order has open gv 00953 $gv_check = $db->Execute("select order_id, unique_id 00954 from " . TABLE_COUPON_GV_QUEUE ." 00955 where order_id = '" . $oInfo->orders_id . "' and release_flag='N' limit 1"); 00956 if ($gv_check->RecordCount() > 0) { 00957 $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>'; 00958 $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3')); 00959 $contents[] = array('align' => 'center', 'text' => $goto_gv); 00960 } 00961 } 00962 00963 // indicate if comments exist 00964 $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 !='" . "'" ); 00965 if ($orders_history_query->RecordCount() > 0) { 00966 $contents[] = array('align' => 'left', 'text' => '<br />' . TABLE_HEADING_COMMENTS); 00967 } 00968 00969 $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3')); 00970 $order = new order($oInfo->orders_id); 00971 $contents[] = array('text' => 'Products Ordered: ' . sizeof($order->products) ); 00972 for ($i=0; $i<sizeof($order->products); $i++) { 00973 $contents[] = array('text' => $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name']); 00974 00975 if (sizeof($order->products[$i]['attributes']) > 0) { 00976 for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) { 00977 $contents[] = array('text' => ' <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</i></nobr>' ); 00978 } 00979 } 00980 if ($i > MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) { 00981 $contents[] = array('align' => 'left', 'text' => TEXT_MORE); 00982 break; 00983 } 00984 } 00985 00986 if (sizeof($order->products) > 0) { 00987 $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>'); 00988 } 00989 break; 00990 } 00991 00992 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 00993 echo ' <td width="25%" valign="top">' . "\n"; 00994 00995 $box = new box; 00996 echo $box->infoBox($heading, $contents); 00997 00998 echo ' </td>' . "\n"; 00999 } 01000 ?> 01001 </tr> 01002 </table></td> 01003 </tr> 01004 <?php 01005 } 01006 ?> 01007 </table></td> 01008 <!-- body_text_eof //--> 01009 </tr> 01010 </table> 01011 <!-- body_eof //--> 01012 01013 <!-- footer //--> 01014 <div class="footer-area"> 01015 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 01016 </div> 01017 <!-- footer_eof //--> 01018 <br /> 01019 </body> 01020 </html> 01021 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>