Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] UPS XML Tracking


heliosquare

Recommended Posts

After messing with the only UPS XML tracking contrib. available and not being able to get it to do anything, I decided to modify it until it worked. I borrowed code from Torin Walker's excellent UPS XML Rates contrib. as well as a bit from Wayne's original UPS XML tracking contrib. The result is a tracking page that looks and acts pretty much exactly like UPS's own tracking page. It first displays a summary page and provides a link to a more detailed view. The package I submitted contains only 3 files and some images. You need to first download and install Wayne's package (mine and his can be had using the link below). The filenames are the same so once you have it installed just copy my files and overwrite the old ones.

 

http://www.oscommerce.com/community/contributions,113

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

  • Replies 324
  • Created
  • Last Reply

Top Posters In This Topic

You can view a demo of this contrib. here:

 

http://s88033743.onlinehome.us/tracking.php

 

use this tracking code:

 

1Z6107920342146506

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

I am happy to see that this is working. I am about to install and see if I can get it working.

 

I have a question, though.

 

I had the other UPS XML tracking module installed and it worked great until about 2 Saturdays ago when UPS altered its XML response. They removed the spacing and line breaks from the XML reply. This made the module for OScommerce quit functioning.

 

Did you do something to change the way the module parses the XML response from UPS?

Link to comment
Share on other sites

I didn't use any of the original code to parse the XML. In fact, I never compared my code to the original code b/c I didn't like the original code at all. The results were too simplistic for what I wanted. To answer your question, the code in my contrib. adheres to the current UPS xml. The example tracking code I supplied is from a shipment that was delivered only 6 days ago and the xml is formatted correctly. I tried a few old tracking codes (from March) and the results are all screwy due to changes made by UPS.

 

If you already have the original contrib. installed then all you need to do is replace:

 

tracking.php (all I did was make some HTML changes)

popup_tracker.php (HTML changes)

includes/classes/tracking.php (major changes)

includes/classes/xmldocument.php (new file)

 

The HTML changes noted above are necessary to meld to the HTML in classes/tracking.php

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

I tried to apply this mod to my site and found that the code in several of the files did not match the example code so there were spots that I had to guess. Sounds like your saying that this is what you did too! I guess the next question would be what version of OSC are you running? I am on 2.2 MS2 and these files are newer than in the current UPS tracking contrib, I am guessing that's why they did not match. But some were so different that I was not sure what to change. After the install, I did not get an error untill I tried to go to the orders screen in admin and POOOF! So I backed it out and am now looking for another option which it sounds like you have created.

 

I will redo the install and replace the files in question as your contrib states and see what I get.

Link to comment
Share on other sites

I'm using 2.2 MS1

 

If memory serves me the code in the original contrib. is for a release prior to any of the milestone releases. When I installed it I had to change some of the code but not much. I also modified it to suit my needs. Were you able to use the tracking page ok? If you need help with the Admin just let me know...

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

What I got was a PHP error on line 83 of the admin/orders.php file. That line contains a case statement. If I comment out the case statement the error moves to line 91 where an extra } is present. I comment that out and then my admin/orders page comes up and has a UPS Tracking box at the top. But I can not enter into my orders to edit them. I really need to see what the admin side of this contribution looks like to know if I am on the right track here (no pun!)

 

Any help you can give me would be greatly appreciated.

Link to comment
Share on other sites

Help anyone. I've also downloaded both files for the contrib. and I am getting the error below:

 

 

Rating and Service 1.0001 0 MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR : Rating and Service 1.0001 0 MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR

If you prefer to use ups as your shipping method, please contact osCommerce via Email.

 

Any help would be great.

Link to comment
Share on other sites

Also on the tracking page I get this trying to call the tracking page:

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in C:\Inetpub\wwwroot\catalog\includes\functions\database.php:13) in C:\Inetpub\wwwroot\catalog\includes\functions\database.php on line 13

Link to comment
Share on other sites

Help anyone. I've also downloaded both files for the contrib. and I am getting the error below:

 

 

Rating and Service 1.0001 0 MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR : Rating and Service 1.0001 0 MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR

If you prefer to use ups as your shipping method, please contact osCommerce via Email.

 

Any help would be great.

I think you are getting your contribs. mixed up...the error you are getting is an error with the UPS xml Rates on checkout_shipping.php...

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

I'm getting a very similar error as DS Sultan - once it's all installed, exactly according to the instructions, i get a parse error on admin/orders.php.

 

here's the error I'm receiving:

 

Parse error: parse error in /home/azteam/public_html/catalog/admin/orders.php on line 88

 

and on line 88, I see this:

 

case 'deleteconfirm':

 

I've tried a lot of things to get this to work, but ultimately had to back out the entire contrib because it wouldn't work. I also had the same situation as DS Sultan when I commented out the error line and removed a bracket a few lines lower. the orders page loaded, but I couldn't edit any orders.

 

I would love to use this contrib - anyone have any ideas? Oh, i'm using OSC 2.2MS2 and I also updated all the files in wayne's original contrib with the new ups tracking files in the newer contrib. Hope that makes sense.

 

Thanks.

Link to comment
Share on other sites

The reason you are getting that error is becuase there is one too many closing brackets ( } ). You cant comment out those lines as they are needed for the page to operate correctly. The orders page is built on one main if statement (with a bunch of other ifelse statements sandwiched in between). It checks to see if action=edit and if it does the top half of the page executes. If the variable $action is not set then the bottom half of the page executes. You need to start at the top of the code and trace down where each closing bracket is. If you follow the code logic down the page you will see where the extra bracket is. I'm at home right now so I can't post any code but if you want to wait until morning then I'll post it then.

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

This code *should* work for milestone 2.2 sites. I don't have that version installed so I can't test this:

 

<?php
/*
 $Id: orders.php,v 1.112 2003/06/29 22:50:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 $orders_statuses = array();
 $orders_status_array = array();
 $orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");
 while ($orders_status = tep_db_fetch_array($orders_status_query)) {
   $orders_statuses[] = array('id' => $orders_status['orders_status_id'],
                              'text' => $orders_status['orders_status_name']);
   $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
 }

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'update_order':
       $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
       $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
       $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
/*Tracking contribution begin*/
       $ups_track_num = tep_db_prepare_input($HTTP_POST_VARS['ups_track_num']);
/*Tracking contribution end*/

       $order_updated = false;
//        $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
/*Tracking contribution begin*/
     $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, ups_track_num, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");

/*Tracking contribution end*/
       $check_status = tep_db_fetch_array($check_status_query);

       if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
         tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");
  /*Tracking contribution begin*/
       if (tep_not_null($ups_track_num)) {
         tep_db_query("update " . TABLE_ORDERS . " set ups_track_num = '" . tep_db_input($ups_track_num) . "' where orders_id = '" . tep_db_input($oID) . "'");
         $order_updated = true;
       }
/*Tracking contribution end*/

         /*Tracking contribution begin*/
       $customer_notified = '0';
       if ($HTTP_POST_VARS['notify'] == 'on' && $ups_track_num == '' ) {
         $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" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
         tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         $customer_notified = '1';
       }elseif ($HTTP_POST_VARS['notify'] == 'on' && tep_not_null($ups_track_num) ) {
         $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" . EMAIL_TEXT_TRACKING_NUMBER . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
         tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         $customer_notified = '1';
       }
/*Tracking contribution end*/

         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)  . "')");

         $order_updated = true;
       }

       if ($order_updated == true) {
        $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
       } else {
         $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
       }

       tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
       break;
     case 'deleteconfirm':
       $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

       tep_remove_order($oID, $HTTP_POST_VARS['restock']);

       tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
       break;
   }
 }

 if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) {
   $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

   $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
   $order_exists = true;
   if (!tep_db_num_rows($orders_query)) {
     $order_exists = false;
     $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');
   }
 }

 include(DIR_WS_CLASSES . 'order.php');
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php
 require(DIR_WS_INCLUDES . 'header.php');
?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if (($action == 'edit') && ($order_exists == true)) {
   $order = new order($oID);
?>
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
           <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td colspan="3"><?php echo tep_draw_separator(); ?></td>
         </tr>
         <tr>
           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td>
               <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>
             </tr>
             <tr>
               <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
             </tr>
             <tr>
               <td class="main"><b><?php echo ENTRY_TELEPHONE_NUMBER; ?></b></td>
               <td class="main"><?php echo $order->customer['telephone']; ?></td>
             </tr>
             <tr>
               <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
               <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>
             </tr>
           </table></td>
           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main" valign="top"><b><?php echo ENTRY_SHIPPING_ADDRESS; ?></b></td>
               <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
             </tr>
           </table></td>
           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main" valign="top"><b><?php echo ENTRY_BILLING_ADDRESS; ?></b></td>
               <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
           <td class="main"><?php echo $order->info['payment_method']; ?></td>
         </tr>
<?php
   if (tep_not_null($order->info['cc_type']) || tep_not_null($order->info['cc_owner']) || tep_not_null($order->info['cc_number'])) {
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>
           <td class="main"><?php echo $order->info['cc_type']; ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>
           <td class="main"><?php echo $order->info['cc_owner']; ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>
           <td class="main"><?php echo $order->info['cc_number']; ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_CVV_NUMBER; ?></td>
           <td class="main"><?php echo $order->info['cvv_number']; ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>
           <td class="main"><?php echo $order->info['cc_expires']; ?></td>
         </tr>
<?php
   }
?>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr class="dataTableHeadingRow">
           <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
           <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
         </tr>
<?php
   for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
     echo '          <tr class="dataTableRow">' . "\n" .
          '            <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
          '            <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

     if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
       for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
         echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
         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']) . ')';
         echo '</i></small></nobr>';
       }
     }

     echo '            </td>' . "\n" .
          '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
          '            <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
          '            <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" .
          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
          '            <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" .
          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
     echo '          </tr>' . "\n";
   }
?>
         <tr>
           <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
<?php
   for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
     echo '              <tr>' . "\n" .
          '                <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
          '                <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
          '              </tr>' . "\n";
   }
?>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td class="main"><table border="1" cellspacing="0" cellpadding="5">
         <tr>
           <td class="smallText" align="center"><b><?php echo TABLE_HEADING_DATE_ADDED; ?></b></td>
           <td class="smallText" align="center"><b><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></b></td>
           <td class="smallText" align="center"><b><?php echo TABLE_HEADING_STATUS; ?></b></td>
           <td class="smallText" align="center"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
         </tr>
<?php
   $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");
   if (tep_db_num_rows($orders_history_query)) {
     while ($orders_history = tep_db_fetch_array($orders_history_query)) {
       echo '          <tr>' . "\n" .
            '            <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" .
            '            <td class="smallText" align="center">';
       if ($orders_history['customer_notified'] == '1') {
         echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
       } else {
         echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
       }
       echo '            <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" .
            '            <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" .
            '          </tr>' . "\n";
     }
   } else {
       echo '          <tr>' . "\n" .
            '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
            '          </tr>' . "\n";
   }
?>
       </table></td>
     </tr>
     <tr>
       <td class="main"><br><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
     </tr>
     <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>
       <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td><table border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main"><b><?php echo ENTRY_STATUS; ?></b> <?php echo tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>
             </tr>
             <tr>
               <td class="main"><b><?php echo ENTRY_NOTIFY_CUSTOMER; ?></b> <?php echo tep_draw_checkbox_field('notify', '', true); ?></td>
               <td class="main"><b><?php echo ENTRY_NOTIFY_COMMENTS; ?></b> <?php echo tep_draw_checkbox_field('notify_comments', '', true); ?></td>
             </tr>
<?php
/*Tracking contribution begin*/
?>
     <tr>
       <td colspan="2" class="main"><b><?php echo TABLE_HEADING_UPS_TRACKING; ?></b>  <?php echo tep_draw_textbox_field('ups_track_num', '20', '18', '', $order->info['ups_track_num']); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>

<?php
/*Tracking contribution end*/
?>
           </table><td align="right" valign="top"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
         </tr>
       </table></td>
     </form></tr>
     <tr>
       <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_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
     </tr>
<?php
 } else {
?>
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
           <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr><?php echo tep_draw_form('orders', FILENAME_ORDERS, '', 'get'); ?>
               <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('oID', '', 'size="12"') . tep_draw_hidden_field('action', 'edit'); ?></td>
             </form></tr>
             <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, '', 'get'); ?>
               <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>
             </form></tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td>
               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
             </tr>
<?php
   if (isset($HTTP_GET_VARS['cID'])) {
     $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
     $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, 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";
   } elseif (isset($HTTP_GET_VARS['status'])) {
     $status = tep_db_prepare_input($HTTP_GET_VARS['status']);
     $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, 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";
   } else {
     $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, 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";
   }
   $orders_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $orders_query_raw, $orders_query_numrows);
   $orders_query = tep_db_query($orders_query_raw);
   while ($orders = tep_db_fetch_array($orders_query)) {
   if ((!isset($HTTP_GET_VARS['oID']) || (isset($HTTP_GET_VARS['oID']) && ($HTTP_GET_VARS['oID'] == $orders['orders_id']))) && !isset($oInfo)) {
       $oInfo = new objectInfo($orders);
     }

     if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) {
       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";
     } else {
       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";
     }
?>
               <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> ' . $orders['customers_name']; ?></td>
               <td class="dataTableContent" align="right"><?php echo strip_tags($orders['order_total']); ?></td>
               <td class="dataTableContent" align="center"><?php echo tep_datetime_short($orders['date_purchased']); ?></td>
               <td class="dataTableContent" align="right"><?php echo $orders['orders_status_name']; ?></td>
               <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>'; } ?> </td>
             </tr>
<?php
   }
?>
             <tr>
               <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <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>
                   <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>
                 </tr>
               </table></td>
             </tr>
           </table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
   case 'delete':
     $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ORDER . '</b>');

     $contents = array('form' => tep_draw_form('orders', FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=deleteconfirm'));
     $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');
     $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY);
     $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>');
     break;
   default:
     if (isset($oInfo) && is_object($oInfo)) {
       $heading[] = array('text' => '<b>[' . $oInfo->orders_id . ']  ' . tep_datetime_short($oInfo->date_purchased) . '</b>');

       $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_edit.gif', IMAGE_EDIT) . '</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>');
       $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>');
       $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased));
       if (tep_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . tep_date_short($oInfo->last_modified));
       $contents[] = array('text' => '<br>' . TEXT_INFO_PAYMENT_METHOD . ' '  . $oInfo->payment_method);
     }
     break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
   echo '            <td width="25%" valign="top">' . "\n";

   $box = new box;
   echo $box->infoBox($heading, $contents);

   echo '            </td>' . "\n";
 }
?>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

Steve, what if UPS makes changes to their site layout, or changes in general, then the contribution wont work, similar to when you entered old tracking numbers?

 

My question is why cant one just use the XML tools provided by UPS?....does anyone know how to intergrate those to work with OSC?

 

And I still would like to know in regards to UPS XML Rates & Service 1.02 Contribution , wether this will work if a customer has in their cart items shipping from various zip codes?

 

I contacted UPS in regards to using their online XML tools and this is the response:

"Thank you for using UPS OnLine Tools. We have received your e-mail requesting technical support.

 

Please note that the Rates & Service Selection HTML tool only displays the UPS rates in a pre-formatted web page. If you need the shipping charges added to the shopping cart total, you will need to use the Rates & Service Selection XML tool.

Now, in response to your question, the Rates & Service Selection tool provides rates based on the origin and destination information that you provide. Technically, the Rates & Service Selection tool will not handle the multiple points of origin. It is up to your application to determine the appropriate origin location for the shipment and provide that information to the Rates & Service Selection tool. The tool will then return the rate(s) based on the supplied origin and destination addresses."

 

So this means the tools offered on the UPS site can work its a matter of someone knowing how to address that last part?......anyone know how.....Steve? :)

 

Thanks,

Jon

Jon Torres

President

1.888.887.1112

«xcelprinting.com»

Quality Printing You Can Count On!

Portfolio

xcelprin.gif

 

Xcel's Xcel-lent specials:

Business Cards:

1000 THICK 16pt UV Coated FULL Color 2 Sided $69 FREE Shipping

 

Postcards/Flyers:

1000 THICK 16pt UV Coated FULL Color 2 Sided $99

 

Visit Our Site For More Xcel-lent Deals!

Link to comment
Share on other sites

The XML Rates and XML Tracking contributions *do* use UPS's XML tools. UPS's "tools" are simply .pdf's and help files that show developers the syntax of the XML output for each given service. The "tools" contain things like error codes and descriptions, ports and paths, info. on how to format your requests...etc. It is still up to the developer to write custom code to interface with UPS's services.

 

The only changes a developer has to keep current are changes UPS makes to the syntax of their XML. Other than that the applications based upon their services will work just fine.

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

heliosquare,

Just to let you know, your mod of orders.php for milestone 2.2 works very well. Great work on this contribution. There's enough of a difference between the origional, your implementation, and 2.2 to maybe warrant an updated contrib for the 2.2 users..I'd hate to see anyone run the .sql on the orders table if they were using 2.2; backup kids :) I haven't run into any issues yet but after a bit more testing, and if anyone is interested, I can put together an updated install explanation.....and run it by you, heliosquare, if necessary.

 

anyway, this is exactly what I was looking for and appreciate the effort.

 

Steve

Link to comment
Share on other sites

I installed your contribution on a MS2 site, and the tracking page loads as it should. When you enter a tracking number, and submit the number....the main tracking.php page just reloads. It doesn't do anything. Any ideas?

 

Thanks,

-Chris

Chris Sullivan

Link to comment
Share on other sites

zenpig, I'm glad to hear you are able to use it. no need to run anything by me if you want to put together a 2.2 version. I simply do not have the time to do it.

 

blueline, do you have a url I could look at?

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

great contribution man. very complicated yet so pretty to use on the UI side. i have a suggestion.. i was looking for something that when i ship the order, i go to the admin, change order status to delivered and enter the tracking number into a new field. so when customers log into their account and check order status, the ups delivery box automatically shows right away where the package is. so in essense, the tracking number is passed from the admin page and later hardcoded in to the XML tracking module.

Edited by dimports
Link to comment
Share on other sites

dimports, the functionality you want already exists. The code I contributed is merely an add-on to the original XML tracking contribution. The original contrib. contains the code necessary to do what you want. You need to install the original and then replace the 3 files in my contrib. with the originals of the same name...hope that makes sense.

 

The original contrib. was written for an earlier version of osCommerce so if you are using the newest version you will need to make a few small adjustments to the code. I posted code that seems to work for admin/orders.php earlier in this thread. The download for the original contrib. is located on the same page as my contrib....

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

ok, if you give me a few days I'll post a full-fledged 2.2MS2 version...don't have much spare time but hopefully in the next 3 days or so I'll find the time...

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...