[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> orders.php (source)

   1  <?php
   2  /*

   3  $Id: orders.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    require (DIR_WS_CLASSES . 'currencies.php');
  16    $currencies = new currencies();
  17  
  18    $orders_statuses = array();
  19    $orders_status_array = array();
  20    $orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");
  21    while ($orders_status = tep_db_fetch_array($orders_status_query)) {
  22      $orders_statuses[] = array('id' => $orders_status['orders_status_id'],
  23                                 'text' => $orders_status['orders_status_name']);
  24      $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
  25    }
  26  
  27    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  28  
  29    if (tep_not_null($action)) {
  30      switch ($action) {
  31        case 'update_order':
  32          $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
  33          $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
  34          $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
  35  
  36          $order_updated = false;
  37          $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
  38          $check_status = tep_db_fetch_array($check_status_query);
  39  
  40  // BOF: MOD - Downloads Controller

  41  // always update date and time on order_status

  42  // original        if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {

  43                     if ( ($check_status['orders_status'] != $status) || $comments != '' || ($status ==DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) ) {
  44            tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");
  45          $check_status_query2 = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
  46          $check_status2 = tep_db_fetch_array($check_status_query2);
  47        if ( $check_status2['orders_status']==DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE ) {
  48          tep_db_query("update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays = '" . tep_get_configuration_key_value('DOWNLOAD_MAX_DAYS') . "', download_count = '" . tep_get_configuration_key_value('DOWNLOAD_MAX_COUNT') . "' where orders_id = '" . (int)$oID . "'");
  49        }
  50  // EOF: MOD - Downloads Controller

  51  
  52            $customer_notified = '0';
  53            if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
  54              $notify_comments = '';
  55              if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
  56                $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
  57              }
  58  
  59              $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
  60  
  61              tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  62  
  63              $customer_notified = '1';
  64            }
  65  
  66            tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");
  67  
  68            $order_updated = true;
  69          }
  70  
  71          if ($order_updated == true) {
  72           $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
  73          } else {
  74            $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
  75          }
  76  
  77          tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
  78          break;
  79        case 'deleteconfirm':
  80          $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
  81  
  82          tep_remove_order($oID, $HTTP_POST_VARS['restock']);
  83  
  84          tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
  85          break;
  86      }
  87    }
  88  
  89    if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) {
  90      $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
  91  
  92      $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
  93      $order_exists = true;
  94      if (!tep_db_num_rows($orders_query)) {
  95        $order_exists = false;
  96        $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');
  97      }
  98    }
  99  // BOF: MOD - Downloads Controller - Extra order info

 100  // Look up things in orders

 101    $the_extra_query= tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
 102    $the_extra= tep_db_fetch_array($the_extra_query);
 103    $the_customers_id= $the_extra['customers_id'];
 104  // Look up things in customers

 105    $the_extra_query= tep_db_query("select * from " . TABLE_CUSTOMERS . " where customers_id = '" . $the_customers_id . "'");
 106    $the_extra= tep_db_fetch_array($the_extra_query);
 107    $the_customers_fax= $the_extra['customers_fax'];
 108  // EOF: MOD - Downloads Controller - Extra order info

 109  
 110    include (DIR_WS_CLASSES . 'order.php');
 111  ?>
 112  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 113  <html <?php echo HTML_PARAMS; ?>>
 114  <head>
 115  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 116  <title><?php echo TITLE; ?></title>
 117  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 118  <script language="javascript" src="includes/general.js"></script>
 119  </head>
 120  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
 121  <!-- header //-->
 122  <?php
 123    require (DIR_WS_INCLUDES . 'header.php');
 124  ?>
 125  <!-- header_eof //-->
 126  
 127  <!-- body //-->
 128  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 129    <tr>
 130      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 131  <!-- left_navigation //-->
 132  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
 133  <!-- left_navigation_eof //-->
 134      </table></td>
 135  <!-- body_text //-->
 136      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 137  <?php
 138    if (($action == 'edit') && ($order_exists == true)) {
 139      $order = new order($oID);
 140  ?>
 141        <tr>
 142          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 143            <tr>
 144              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 145              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
 146  <?php
 147  // BOF: MOD - PayPal IPN

 148      if ($order->info['payment_method'] == 'paypal'  && isset($HTTP_GET_VARS['refer']) && $HTTP_GET_VARS['refer'] == 'ipn'){
 149  ?>
 150             <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_PAYPAL_IPN, tep_get_all_get_params(array('action','oID','refer'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
 151  <?php
 152      } else {
 153  ?>
 154              <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_EDIT, 'oID=' . $_GET['oID']) . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> '; ?></td>
 155  <?php
 156      }//else not paypal

 157  // EOF: MOD - PayPal IPN

 158  ?>
 159            </tr>
 160          </table></td>
 161        </tr>
 162        <tr>
 163          <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
 164            <tr>
 165              <td colspan="3"><?php echo tep_draw_separator(); ?></td>
 166            </tr>
 167            <tr>
 168              <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
 169                <tr>
 170                  <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td>
 171                  <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>
 172                </tr>
 173                <tr>
 174                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
 175                </tr>
 176                <tr>
 177                  <td class="main"><b><?php echo ENTRY_TELEPHONE_NUMBER; ?></b></td>
 178                  <td class="main"><?php echo $order->customer['telephone']; ?></td>
 179                </tr>
 180  <?php
 181  // BOF: MOD - Downloads Controller - Extra order info

 182  ?>
 183                <tr>
 184                  <td class="main"><b><?php echo 'FAX #:'; ?></b></td>
 185                  <td class="main"><?php echo $the_customers_fax; ?></td>
 186                </tr>
 187  <?php
 188  // EOF: MOD - Downloads Controller - Extra order info

 189  ?>
 190                <tr>
 191                  <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
 192                  <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>
 193                </tr>
 194              </table></td>
 195              <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
 196                <tr>
 197                  <td class="main" valign="top"><b><?php echo ENTRY_SHIPPING_ADDRESS; ?></b></td>
 198                  <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
 199                </tr>
 200              </table></td>
 201              <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
 202                <tr>
 203                  <td class="main" valign="top"><b><?php echo ENTRY_BILLING_ADDRESS; ?></b></td>
 204                  <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'); ?></td>
 205                </tr>
 206              </table></td>
 207            </tr>
 208          </table></td>
 209        </tr>
 210        <tr>
 211          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 212        </tr>
 213        <tr>
 214          <td><table border="0" cellspacing="0" cellpadding="2">
 215  <?php
 216  // BOF: MOD - Downloads Controller - Extra order info

 217  ?>
 218  <!-- add Order # // -->
 219        <tr>
 220          <td class="main"><b>Order # </b></td>
 221          <td class="main"><?php echo tep_db_input($oID); ?></td>
 222        </tr>
 223  <!-- add date/time // -->
 224        <tr>
 225          <td class="main"><b>Order Date & Time</b></td>
 226          <td class="main"><?php echo tep_datetime_short($order->info['date_purchased']); ?></td>
 227        </tr>
 228  <?php
 229  // EOF: MOD - Downloads Controller - Extra order info

 230  // BOF: MOD - PayPal IPN

 231    if (strtolower($order->info['payment_method']) == 'paypal') {
 232      include  'paypal_ipn_order.php';
 233    } else {
 234  // EOF: MOD - PayPal IPN

 235  ?>
 236            <tr>
 237              <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
 238              <td class="main"><?php echo $order->info['payment_method']; ?></td>
 239            </tr>
 240  <?php
 241    }//else not paypal

 242      if (tep_not_null($order->info['cc_type']) || tep_not_null($order->info['cc_owner']) || tep_not_null($order->info['cc_number'])) {
 243  ?>
 244            <tr>
 245              <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 246            </tr>
 247            <tr>
 248              <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>
 249              <td class="main"><?php echo $order->info['cc_type']; ?></td>
 250            </tr>
 251            <tr>
 252              <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>
 253              <td class="main"><?php echo $order->info['cc_owner']; ?></td>
 254            </tr>
 255            <tr>
 256              <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>
 257              <td class="main"><?php echo $order->info['cc_number']; ?></td>
 258            </tr>
 259            <tr>
 260              <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>
 261              <td class="main"><?php echo $order->info['cc_expires']; ?></td>
 262            </tr>
 263  <?php
 264      }
 265  ?>
 266          </table></td>
 267        </tr>
 268        <tr>
 269          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 270        </tr>
 271        <tr>
 272          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 273            <tr class="dataTableHeadingRow">
 274              <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
 275              <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
 276              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
 277              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
 278              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
 279              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
 280              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
 281            </tr>
 282  <?php
 283      for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 284        echo '          <tr class="dataTableRow">' . "\n" .
 285             '            <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
 286             '            <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];
 287  
 288        if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
 289          for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
 290            echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
 291            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']) . ')';
 292            echo '</i></small></nobr>';
 293          }
 294        }
 295  
 296        echo '            </td>' . "\n" .
 297             '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
 298             '            <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
 299             '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
 300             '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
 301             '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
 302             '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
 303        echo '          </tr>' . "\n";
 304      }
 305  ?>
 306            <tr>
 307              <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
 308  <?php
 309      for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
 310        echo '              <tr>' . "\n" .
 311             '                <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
 312             '                <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
 313             '              </tr>' . "\n";
 314      }
 315  ?>
 316              </table></td>
 317            </tr>
 318          </table></td>
 319        </tr>
 320        <tr>
 321          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 322        </tr>
 323        <tr>
 324          <td class="main"><table border="1" cellspacing="0" cellpadding="5">
 325            <tr>
 326              <td class="smallText" align="center"><b><?php echo TABLE_HEADING_DATE_ADDED; ?></b></td>
 327              <td class="smallText" align="center"><b><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></b></td>
 328              <td class="smallText" align="center"><b><?php echo TABLE_HEADING_STATUS; ?></b></td>
 329              <td class="smallText" align="center"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
 330            </tr>
 331  <?php
 332      $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
 333      if (tep_db_num_rows($orders_history_query)) {
 334        while ($orders_history = tep_db_fetch_array($orders_history_query)) {
 335          echo '          <tr>' . "\n" .
 336               '            <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" .
 337               '            <td class="smallText" align="center">';
 338          if ($orders_history['customer_notified'] == '1') {
 339            echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
 340          } else {
 341            echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
 342          }
 343          echo '            <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" .
 344               '            <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . '&nbsp;</td>' . "\n" .
 345               '          </tr>' . "\n";
 346        }
 347      } else {
 348          echo '          <tr>' . "\n" .
 349               '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
 350               '          </tr>' . "\n";
 351      }
 352  ?>
 353          </table></td>
 354        </tr>
 355        <tr>
 356          <td class="main"><br><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
 357        </tr>
 358        <tr>
 359          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
 360        </tr>
 361        <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>
 362          <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
 363        </tr>
 364        <tr>
 365          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 366        </tr>
 367        <tr>
 368          <td><table border="0" cellspacing="0" cellpadding="2">
 369            <tr>
 370              <td><table border="0" cellspacing="0" cellpadding="2">
 371                <tr>
 372                  <td class="main"><b><?php echo ENTRY_STATUS; ?></b> <?php echo tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>
 373                </tr>
 374                <tr>
 375                  <td class="main"><b><?php echo ENTRY_NOTIFY_CUSTOMER; ?></b> <?php echo tep_draw_checkbox_field('notify', '', true); ?></td>
 376                  <td class="main"><b><?php echo ENTRY_NOTIFY_COMMENTS; ?></b> <?php echo tep_draw_checkbox_field('notify_comments', '', true); ?></td>
 377                </tr>
 378              </table></td>
 379              <td valign="top"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
 380            </tr>
 381          </table></td>
 382        </form></tr>
 383        <tr>
 384  <?php /* BOF: MOD - PayPal IPN */ ?>
 385  <?php
 386      if ($order->info['payment_method'] == 'paypal'  && isset($HTTP_GET_VARS['refer']) && $HTTP_GET_VARS['refer'] == 'ipn'){
 387  ?>
 388             <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_PAYPAL_IPN, tep_get_all_get_params(array('action','oID','refer'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
 389  <?php
 390      } else {
 391  ?>
 392         <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_EDIT, 'oID=' . $_GET['oID']) . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> '; ?></td>
 393  <?php
 394      }//else not paypal

 395  // EOF: MOD - PayPal IPN ?>

 396        </tr>
 397  <?php
 398    } else {
 399  ?>
 400        <tr>
 401          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 402            <tr>
 403              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 404              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
 405              <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 406                <tr><?php echo tep_draw_form('orders', FILENAME_ORDERS, '', 'get'); ?>
 407                  <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('oID', '', 'size="12"') . tep_draw_hidden_field('action', 'edit'); ?></td>
 408                <?php echo tep_hide_session_id(); ?></form></tr>
 409                <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, '', 'get'); ?>
 410                  <td class="smallText" align="right"><?php echo HEADING_TITLE_STATUS . ' ' . tep_draw_pull_down_menu('status', array_merge(array(array('id' => '', 'text' => TEXT_ALL_ORDERS)), $orders_statuses), '', 'onChange="this.form.submit();"'); ?></td>
 411                <?php echo tep_hide_session_id(); ?></form></tr>
 412              </table></td>
 413            </tr>
 414          </table></td>
 415        </tr>
 416        <tr>
 417          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 418            <tr>
 419              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 420                <tr class="dataTableHeadingRow">
 421                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
 422                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td>
 423                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
 424                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
 425                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 426                </tr>
 427  <?php
 428      if (isset($HTTP_GET_VARS['cID'])) {
 429        $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
 430  //LINE CHANGED: MOD - fedex added "o.fedex_tracking"

 431        $orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, o.fedex_tracking, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC";
 432  // LINE CHANGED: MS2 update 501112

 433  //  } elseif (isset($HTTP_GET_VARS['status'])) {

 434      } elseif (isset($HTTP_GET_VARS['status']) && is_numeric($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] > 0)) {
 435        $status = tep_db_prepare_input($HTTP_GET_VARS['status']);
 436  //LINE CHANGED: MOD - fedex added "o.fedex_tracking"

 437        $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, o.fedex_tracking, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC";
 438      } else {
 439  //LINE CHANGED: MOD - fedex added "o.fedex_tracking"

 440        $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, o.fedex_tracking, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC";
 441      }
 442      $orders_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $orders_query_raw, $orders_query_numrows);
 443      $orders_query = tep_db_query($orders_query_raw);
 444      while ($orders = tep_db_fetch_array($orders_query)) {
 445      if ((!isset($HTTP_GET_VARS['oID']) || (isset($HTTP_GET_VARS['oID']) && ($HTTP_GET_VARS['oID'] == $orders['orders_id']))) && !isset($oInfo)) {
 446          $oInfo = new objectInfo($orders);
 447        }
 448  
 449        if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) {
 450          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '\'">' . "\n";
 451        } else {
 452          echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '\'">' . "\n";
 453        }
 454  ?>
 455                  <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $orders['customers_name']; ?></td>
 456                  <td class="dataTableContent" align="right"><?php echo strip_tags($orders['order_total']); ?></td>
 457                  <td class="dataTableContent" align="center"><?php echo tep_datetime_short($orders['date_purchased']); ?></td>
 458                  <td class="dataTableContent" align="right"><?php echo $orders['orders_status_name']; ?></td>
 459                  <td class="dataTableContent" align="right"><?php if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 460                </tr>
 461  <?php
 462      }
 463  ?>
 464                <tr>
 465                  <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 466                    <tr>
 467                      <td class="smallText" valign="top"><?php echo $orders_split->display_count($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
 468                      <td class="smallText" align="right"><?php echo $orders_split->display_links($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'oID', 'action'))); ?></td>
 469                    </tr>
 470                  </table></td>
 471                </tr>
 472              </table></td>
 473  <?php
 474    $heading = array();
 475    $contents = array();
 476  
 477    switch ($action) {
 478      case 'delete':
 479        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ORDER . '</b>');
 480  
 481        $contents = array('form' => tep_draw_form('orders', FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=deleteconfirm'));
 482        $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');
 483        $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY);
 484        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 485        break;
 486      default:
 487        if (isset($oInfo) && is_object($oInfo)) {
 488          $heading[] = array('text' => '<b>[' . $oInfo->orders_id . ']&nbsp;&nbsp;' . tep_datetime_short($oInfo->date_purchased) . '</b>');
 489  
 490  // BOF: MOD - FedEx 

 491  // first determine whether this is on the test or production server to send

 492  // in the url (there may be a better place to do this...)

 493      $value_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FEDEX1_SERVER'");
 494      $value = tep_db_fetch_array($value_query);
 495      $fedex_gateway = $value['configuration_value'];    
 496  
 497  // check for a fedex tracking number in the order record

 498  // if yes tracking number, show "fedex label," "track" and "cancel" options

 499      $fedex_tracking = $oInfo->fedex_tracking;
 500  
 501  // get the current order status                

 502      $check_fedex_status_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . $oInfo->orders_id . "'");
 503      $check_fedex_status = tep_db_fetch_array($check_fedex_status_query);
 504  
 505      if ($fedex_tracking) {
 506  // display the label

 507            $contents[] = array('align' => 'center', 'text' => '<a href="fedex_popup.php?num=' . $fedex_tracking . '&oID=' . $oInfo->orders_id . '">' . tep_image_button('button_fedex_label.gif', IMAGE_ORDERS_FEDEX_LABEL) . '</a>');
 508                      
 509  // track the package (no gateway needs to be specified)

 510            $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_TRACK_FEDEX, 'oID=' .$oInfo->orders_id . '&num=' . $fedex_tracking) . '&fedex_gateway=track">' . tep_image_button('button_track.gif', IMAGE_ORDERS_TRACK) . '</a>');
 511  
 512  // cancel the request                

 513                      
 514            $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SHIP_FEDEX, 'oID=' .$oInfo->orders_id . '&num=' . $fedex_tracking . '&action=cancel&fedex_gateway=' . $fedex_gateway) . '" onClick="return(window.confirm(\'Cancel shipment of order number ' . $oInfo->orders_id . '?\'));">' . tep_image_button('button_cancel_shipment.gif', IMAGE_ORDERS_CANCEL_SHIPMENT) . '</a>');
 515          }
 516  // if no fedex tracking number, AND if the order has not been manually marked "delivered,"

 517  // display the "ship" button

 518  
 519          elseif ((!$fedex_tracking) && (($check_fedex_status['orders_status']) != 3)) {            
 520            $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SHIP_FEDEX, 'oID=' .$oInfo->orders_id . '&action=new&status=3') . '">' . tep_image_button('button_ship.gif', IMAGE_ORDERS_SHIP) . '</a>');
 521          }
 522  // EOF: MOD - FedEx 

 523         $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . tep_image_button('button_details.gif', IMAGE_DETAILS) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 524  $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_EDIT, 'oID=' . $oInfo->orders_id) . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
 525  $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased));
 526          if (tep_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . tep_date_short($oInfo->last_modified));
 527          $contents[] = array('text' => '<br>' . TEXT_INFO_PAYMENT_METHOD . ' '  . $oInfo->payment_method);
 528        }
 529        break;
 530    }
 531  
 532    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 533      echo '            <td width="25%" valign="top">' . "\n";
 534  
 535      $box = new box;
 536      echo $box->infoBox($heading, $contents);
 537  
 538      echo '            </td>' . "\n";
 539    }
 540  ?>
 541            </tr>
 542          </table></td>
 543        </tr>
 544  <?php
 545    }
 546  ?>
 547      </table></td>
 548  <!-- body_text_eof //-->
 549    </tr>
 550  </table>
 551  <!-- body_eof //-->
 552  
 553  <!-- footer //-->
 554  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 555  <!-- footer_eof //-->
 556  <br>
 557  </body>
 558  </html>
 559  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7