Contributions
UPS Order Tracking XML
This is an add-on for customers to track packages in real-time from your osCommerce based site. This version uses XML and requires that you have cURL installed on your server. The advantage of using this add-on over my previous HTML add-on is that your customers will never leave your site.
Expand All / Collapse All
This is an update to the last update (and a full install package for those who are installing new) for those who just want to make their Sheduled delivery date uhh dates display right instead of part of your tracking code, just replace the includes/classes/tracking.php with the one in this package. Sorry Steve, you didn't use an operator in your tracking.php to say whether Rescheduled delivery was true or not so it was using that "date" the whole time.
This update fixes a problem where the scheduled delivery date was not displaying properly for re-scheduled shipments. Simply replace your existing classes/tracking.php file with this one
As per a request here is a full package of files that should be the most updated version. Please use the forum thread for questions/comments
After lengthy discussions with techs. at UPS I decided to change to code a bit to avoid possible problems caused by admitted inconsistencies between the UPS database servers. In some cases the data available to the XML Tracking program (such as this contrib.) may vary depending on which database it is coming from. UPS is still ironing out some wrinkles that cause odd behavior on the user's end. Some "wrinkles" are unavaoidable at this time but others should be alleviated by the code changes in this file. Simply replace your existing /classes/tracking.php file with this one. Don't forget to enter your user/pass/key info.
If you don't have curl compiled and need to use the command line to send the xml request then replace the post() function found in /includes/class/tracking.php with the code shown below. Nothing else needs to be changed.
The .zip file contains the code below verbatim.
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];
}
first .zip was somehow empty...try this one..
Updated /includes/classes/tracking.php to track multiple packages. Also optomized the code slightly to reduce redundant processing of HTML
This fix changes one line of code in catalog/includes/classes/tracking.php
Prior to this fix, the weight value was being 'clipped' so that 47.00 LBS was displayed as 7.00 LBS. This fix changes the definitions/rules on how we difine the field weight.
The old line of code was found around line 175 of catalog/includes/classes/tracking.php:
$Weight = substr($doc->getValueByPath('TrackResponse/Shipment/Package/PackageWeight/UnitOfMeasure/Code'), -4, 4) . '&nbs
p;' . substr($doc->getValueByPath('TrackResponse/Shipment/Package/PackageWeight/UnitOfMeasure/Code'), 0, 3);
It has been changed to this:
$Weight = substr($doc->getValueByPath('TrackResponse/Shipment/Package/PackageWeight/UnitOfMeasure/Code'), 3, 5) . ' ' . substr($doc->getValueByPath('TrackResponse/Shipment/Package/PackageWeight/UnitOfMeasure/Code'), 0, 3);
The included file is identical to the previous release, except the one line of code has been fixed.
Ok, I'm an idiot. This package is finally final. It contains the /boxes/information.php file as well as the language file for it (as well as everything else).
This is the complete package for MS2 users. The 12/3 package is missing a couple of files (the main tracking.php page and the .sql update file)
Don't forget to add the 'ups_track_num' field to your ORDERS table. You can use the attached .sql file
This is an update to the original contribution making it compatible with osCommerce 2.2 MS2
This package contains only 3 files. One is new and the other 2 are replacements for files found in the original package written by Wayne.
You need to download and install Wayne's contrib. and then replace his files with the ones found in this package.
The tracking output looks and functions pretty much exactly like UPS's tracking page. It first displays a summary and provides a link for a more detailed view.
This is an updated version of my original contribution. Based on a snapshot from 8/16/2002. I have included full documentation and some troubleshooting steps.
I was going to attempt to implement USPS XML tracking into the script, but due to time restrictions, I cannot do this at this time. As always, if you have any questions about this mod, feel free to contact me. I will help if I can.
BTW: You still need to have cURL installed to use this mod.
Regards
Wayne
This is just an update. V2.0. was missing a few steps in the readme file.
Description: This contribution is the same as version 1.0 with added functions
for admin. This version allows you to integrate this feature seamlessly into
the admin section. It provides a form in the admin orders.php page, where you
insert the tracking number. When admin clicks on update, the tracking number
gets emailed directly to the customer and inserted into the customers order
history page. In the email, the tracking number is a link which directs the
customer to the the store owners site and displays the results. In the
customers order history, the number is a link which opens up a small
javascript window (similar to the larger image window) with the results. It
was planned to allow the store owner to activate these feature through the
admin control panel. However, this was not implemented. If installed, only the
form in the admin orders.php section and the tracking.php pages
(catalog/tracking.php) will be visible to the customer. Only after updating
and order (from admin), with the tracking number included in the form, will
the customer see any mention of a tracking number. If you do not want a
customer to receive a tracking number, don't include one when updating the
order. Simple.
This download contains a very large instruction file. It's fairly detailed so
that inexperienced users should be able to install this contribution.
Email me at wwetterhahn@yahoo.com or post to this thread with questions or
comments. Please do not open a new thread to ask questions concerning this
contribution. Also, please do not email the osCommerce developers to ask for
help with this mod, all questions should be posted to the forum or emailed to
me. I will help if I can.
The live demo was removed because of an (1) individual who abused the system.
I may place a demo on my site at a later date. Thanks to all who submitted the
great feedback about my earlier version.
I made the installation instructions pretty quickly, so let me know if it
fails to work properly.
Description: This contribution is the same as version 1.0 with added functions for admin. This version allows you to integrate this feature seamlessly into the admin section. It provides a form in the admin orders.php page, where you insert the tracking number. When admin clicks on update, the tracking number gets emailed directly to the customer and inserted into the customers order history page. In the email, the tracking number is a link which directs the customer to the the store owners site and displays the results. In the customers order history, the number is a link which opens up a small javascript window (similar to the larger image window) with the results. It was planned to allow the store owner to activate these feature through the admin control panel. However, this was not implemented. If installed, only the form in the admin orders.php section and the tracking.php pages
(catalog/tracking.php) will be visible to the customer. Only after updating and order (from admin), with the tracking number included in the form, will the customer see any mention of a tracking number. If you do not want a customer to receive a tracking number, don't include one when updating the order. Simple.
This download contains a very large instruction file. It's fairly detailed so that inexperienced users should be able to install this contribution.
Email me at wwetterhahn@yahoo.com or post to this thread with questions or comments. Please do not open a new thread to ask questions concerning this contribution. Also, please do not email the osCommerce developers to ask for help with this mod, all questions should be posted to the forum or emailed to me. I will help if I can.
The live demo was removed because of an (1) individual who abused the system. I may place a demo on my site at a later date. Thanks to all who submitted the great feedback about my earlier version.
I made the installation instructions pretty quickly, so let me know if it fails to work properly.
This is an add-on for customers to track packages in real-time from your osCommerce based site. This version uses XML and requires that you have cURL installed on your server. The advantage of using this add-on over my previous HTML add-on is that your customers will never leave your site.
You can check out a live demo at http://www.abcshopper.com/tracking.php ..
Tracking numbers are valid for up to 1 year, so if you have an old tracking number, try it. If not you can use 1Z462E560318067529 for the demo.
Questions, comments, suggestions, or whatever are welcome and should be directed to wwetterhahn@yahoo.com.
Regards
Wayne
Note: Contributions are used at own risk.