Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] UPS XML Tracking


heliosquare

Recommended Posts

Steve how do I do an commandline methode tracking?

 

Could you explain step by step?

I PM?d you a trackingnr outside US with multiple packages.

to use the command line code simply uncomment the appropriate lines located in the post() function in /classes/tracking.php

 

your post() function should look like this:

function post($protocol, $host, $port, $path, $version, $timeout, $xmlRequest) {
  $url = $protocol."://".$host.":".$port.$path;
     // uncomment the line below if you need to use the command line to send the curl request.
     // remember to comment out lines $ch = curl_init(); through curl_close($ch);
     exec('curl --data ' . escapeshellarg($xmlRequest) . ' ' . $url . '', $xmlResponse);

//Begin curl request using the compiled curl version
/*
     $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
  curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);

     $xmlResponse = curl_exec ($ch);
     curl_close ($ch);
*/
//End curl request using the compiled curl version

     if(!$xmlResponse) {
 $xmlResponse = "<?xml version=\"1.0\"?>\n".
  	 "<TrackResponse>\n".
  	 "  <Response>\n".
  	 "    <TransactionReference>\n".
       "      <CustomerContext>UPS Package Tracking</CustomerContext>\n".
       "      <XpciVersion>1.0001</XpciVersion>\n".
       "    </TransactionReference>\n".
       "    <ResponseStatusCode>99</ResponseStatusCode>\n".
       "    <ResponseStatusDescription>There seems to be a communication error with the UPS servers.  Please contact the webmaster of this site to report this error.</ResponseStatusDescription>\n".
          "  </Response>\n".
          "</TrackResponse>\n";
  }
//Use the line below for the compiled curl version
     //return $xmlResponse;
//Use the line below for the command line curl version
     return $xmlResponse[0];
}

 

you can just copy-n-paste the above to your /classes/tracking.php to replace the existing post() function...

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

Is there a description of how this contribution works? Like the customer and administrator process?

 

Does the Administrator need to manually enter the tracking numbers in per order?

 

And is the only way for a customer to recieve their tracking number by clicking account_history_info.php?

Most likely your question has been answered, please do a search first.

Link to comment
Share on other sites

Is there a description of how this contribution works? Like the customer and administrator process?

 

Does the Administrator need to manually enter the tracking numbers in per order?

 

And is the only way for a customer to recieve their tracking number by clicking account_history_info.php?

Description:

- customer places order

- admin. processes order and inputs tracking code on order page

- customer receives e-mail notifying that order has shipped (for my store I copy-n-paste a text file that contains generic text instructing them to log back in to their account to track the order)

- customer clicks the track button and marvels both at the efficiency of your store and that of UPS

 

 

Yes, the store admin. has to manually enter the tracking code on the orders.php page. I'm not sure how else it would get there...The problem with using a telephone number as a reference number is that what happens if a customer places more than one order? I didn't want to mess with reference numbers b/c tracking codes are unique and work just fine.

 

As it stands the only way for the customer to get their tracking code is either on account_history.php or account_history_info.php. I purposely omitted e-mailing the code to the customer b/c I like the idea of having them return to the site.

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

thanks for the follow up, this is the info, i was exactly looking for!

 

i thought the reference numbers could be cross referenced with your shipper id. so that even when a customer has ordered from multiple stores, only your orders will be shown.

 

i'm just trying to decide whether it's worth the extra time, to implement the XML system or just to use their HTML system.

Edited by FlyingMonkey

Most likely your question has been answered, please do a search first.

Link to comment
Share on other sites

Problem.....

 

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/sites/site16/web/shop/includes/classes/xmldocument.php on line 254

 

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/sites/site16/web/shop/includes/classes/xmldocument.php on line 273

 

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of xml_set_object(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/sites/site16/web/shop/includes/classes/xmldocument.php on line 282

 

 

Some have an ansewers?...

http://www.mibuscador.com/shop/tracking.php

 

Many thanks

 

Clems

Link to comment
Share on other sites

Added the last updated tracking.php from the cont. page and now if I am Logged in and track a package with the tracking.php page(not from account hist-Thats working fine) It logs me out of my account.

 

Any Idea why this may be??

Link to comment
Share on other sites

First off, mega kudos to Steve for all his work on this contrib!! Thanks!! Can't wait to see what's next! :)

 

It looks like when I copied the tracking number into the box (with spaces) it cut off some digits which is why I was getting the "Invalid number" message.  When I copy the number without spaces it works fine.

Like Jay and a few other people, it took me a few minutes (okay, an hour!) to realize the contrib was set up for the 18 character tracking number without spaces. To make it easier for my cut and paste shipping person, I made two simple changes (to /admin/orders.php and the orders table in the database) allowing for the 5 spaces normally found in the tracking number.

 

In /admin/orders.php line 321 changed the 20 to 25 and the 18 to 23:

<td class="main"><b><?php echo TABLE_HEADING_UPS_TRACKING; ?></b>  <?php echo tep_draw_textbox_field('ups_track_num', '25', '23', '', $order->info['ups_track_num']); ?></td>

In the database, orders table, ups_track_num field changed the length from 20 to 23. This could be done before installing by changing the update.sql:

ALTER TABLE `orders` ADD `ups_track_num` VARCHAR( 23 ) NULL;

Everything seems to work fine, but does anybody see any issues I may have missed? Also, I know Steve said he likes the idea of making customers go back to the site but has anyone looked at passing along the tracking number into the email (before I duplicate efforts)...

 

Thanks again!

Later,

Michael

Link to comment
Share on other sites

Figured out the problem with the updated classes/tracking.php.

Just to let you know so if other have the same thing...

At the end of the file there are a couple of Blank lines. You need to delete those so that the ?> is the last line. Problem solved!

Link to comment
Share on other sites

Having problems. It works great apart from when I try to view it in the Pop-up through account history. Any ideas?

 

I just get a blank pop-up screen?

http://www.healthylifepharmacy.com/

 

Best

Steve.

Do you have any pop-up blockers running? That problem sounds like you are running one or more of the pop-up blockers out there, and as your problem is with the pop-up, it is likely being blocked (Almost everything today has a popup blocker in it, including toolbars, antivirus applications and even the latest browsers). :unsure:

Link to comment
Share on other sites

  • 2 weeks later...

OK, I'm stumped.

 

I have this contribution installed on my local server and on my client's live site (Smart-San).

 

On my local server, when I use the tracking page (Tracking Page), I get the same page with no tracking info. Here's the relevant info when I view source:

 

        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main">Enter your UPS tracking code in the box below.  If you do not know the code you can log into your account, click on My Account and then click the Track button next to the order you wish to track.  If you do not see a Track button then a code has not yet been issued.</td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td>
           <form method="post" action="

 

When I use the pop-up tracking from the order history page, everything works fine.

 

On the live site, when I use the tracking page, I get the same page that looks identical, but viewing source, it ends like this:

 

            <td>
           <form method="post" action="/catalog/tracking.php">
           <input type="hidden" name="action" value="track">
           <table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td align="center" width="100%"><input type="text" name="tracknum" value="1Z6107920342146506" maxlength="20" size="20"> <input type="submit" name="button" value="Track!"></td>
             </tr>
             <tr>
            	 <td>

 

On the live pop-up tracker, I get a blank pop-up with this source:

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">
<head>
<title>UPS Tracking</title>
<base href="http://smart-san.com/catalog/">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
var i=0;
function resize() {
 if (navigator.appName == 'Netscape') i=40;
}
//--></script>
</head>
<body>
<center>
<table border="0" width="625" cellpadding="3" cellspacing="0">
<tr>
 <td align="left" width="100%" class="main">

 

curl is installed and working on the live server, as is XML.

 

Anybody got any ideas?

Link to comment
Share on other sites

  • 2 weeks later...

Hello People,

 

Well for us new users who found about UPS tracking recently, it would be a good idea to make a contribution which has all the files that need to be use for it to work. When I went to the download of this contribution, it was actually very complicated figuring out which versions were good and the updates that need to be done. Can anyone upload a full working contribution with the changes made? It would be very nice...

 

A question: Is this contribution capable of working with the current UPS XML rates 1.0? The rates on this contribution are more accurate and the weight is also accurate. Anyone any idea?

 

Last: Is Friday 2,2004 and I wish everyone a good Labor Day weekend for those in the US.

 

Thanks in advance!

Link to comment
Share on other sites

Hello People,

 

Well for us new users who found about UPS tracking recently, it would be a good idea to make a contribution which has all the files that need to be use for it to work. When I went to the download of this contribution, it was actually very complicated figuring out which versions were good and the updates that need to be done. Can anyone upload a full working contribution with the changes made? It would be very nice...

posted a new .zip containing the most updated versions of all files...

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

This contribution works great, easy to install. Question though; Has anybody added tracking buttons to their admin page (orders.php)? I'd like to be able to view all of my shipped orders and be able to track from that page so I can update any which have been delivered.

 

If anyone has any quick insight, it would be appriciated.

 

Thanks,

Mark

Link to comment
Share on other sites

This contribution works great, easy to install.  Question though;  Has anybody added tracking buttons to their admin page (orders.php)?  I'd like to be able to view all of my shipped orders and be able to track from that page so I can update any which have been delivered.

 

If anyone has any quick insight, it would be appriciated.

 

Thanks,

Mark

yup, I added a tracking button to orders.php (guess I should have included it in the contrib. but this is an easy mod)

 

1. copy /classes/tracking.php and /classes/xmldocument.php into /admin/includes/classes/

 

2. copy popup_tracker.php into your /admin dir

 

3. add a new DEFINE where ever your version of osC defines filenames for admin (my version is still /admin/includes/application_top.php

 

define('FILENAME_POPUP_TRACKER', 'popup_tracker.php');

 

4. add the following in /admin/orders.php :

<script language="javascript"><!--
function popupTrackerWindow(url) {
 window.open(url,'popupTrackerWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,re
sizable=no,copyhistory=no,width=650,height=500')
}
//--></script>

 

Replace the line below (should be around line 321)

<td 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>

with:

<td 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']); ?> <?php echo '<a href="javascript:popupTrackerWindow(\'' . tep_href_link(FILENAME_POPUP_TRACKER, 'action=track&tracknum=' . $order->info['ups_track_num']) . '\')">' . tep_image(DIR_WS_CATALOG_IMAGES . 'button_track.gif') . '</a></td>'; ?>

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

you will also need to update the admin stylesheet with the ups-related classes and also copy the appropriate images into the /admin/images/ dir. The /catalog/images/ dir. in the contribution .zip shows each of the 6 file names...

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, great contribution!

I'm wondering though, if there is a contribution for osc out there that for UPS Signature Tracking??

 

It would be very helpful to keep chargeback to the minimum.

Link to comment
Share on other sites

I am having the same problem.. Cannot figure out.

Tracking is working great in catalog.

 

Any pop-up trackers (in account history and admin) comes up a blank page. No errors, just a blank page with background color. Paths are correct.

 

Please help.

 

One of the mssg poster has brought up the blank page issue once here. But turns out to be different problem, because I did exactly what that guy did and didnot do the trick.

Link to comment
Share on other sites

I had the same problem initially then I figured out that I forgot to update the admin/includes/classes/tracker.php with my UPS account information. Otherwise it installed quite easily with a few minor changes due to my specific implementation of osCommerce (MS 3 and contributions).

 

-Mark

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...