Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Tracking Module


chris23

Recommended Posts

will this module help me out if i need track packages through YRC (Yellow) and UPS. I need to track from these companies.

 

YRC just e-mailed me their HTML API for tracking. Can I use that to integrate into this module, all for osc r2ca?

 

Thanks!

 

Anyone using this module, please help me as I am curious on its use before I dive into building it. Does it support UPS, Fedex and Freight companies like YELLOW?

Link to comment
Share on other sites

  • Replies 296
  • Created
  • Last Reply

Top Posters In This Topic

Anyone using this module, please help me as I am curious on its use before I dive into building it. Does it support UPS, Fedex and Freight companies like YELLOW?

 

BUMP

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

 

I am having an issue with the Parcelforce V1.1 addition. I am unable to enter the track and trace code ie 2 letters 7 numbers. I get the error:-

 

"Warning: Nothing to change. The order was not updated."

 

I have searched through this post and some seem to say to add GB on the end this also did not work.

 

I previously have the royal mail tracker and this works fine no problem.

 

Any ideas?

Better to be looked over than overlooked!

Link to comment
Share on other sites

Hi,

 

I am having an issue with the Parcelforce V1.1 addition. I am unable to enter the track and trace code ie 2 letters 7 numbers. I get the error:-

 

"Warning: Nothing to change. The order was not updated."

 

I have searched through this post and some seem to say to add GB on the end this also did not work.

 

I previously have the royal mail tracker and this works fine no problem.

 

Any ideas?

 

 

Is this forum supported anymore?

Better to be looked over than overlooked!

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

 

If a module writer needs help and they have an account with a courier (especially a test account), then they are free to PM their details so I can have a look how the courier's system works. Some couriers are helpful and their systems are easy (cf CityLink), others are the opposite (anything Royal Mail!)

 

I'll have a look at what you've done so far but if you have any details of Business Post's systems, please send them over.

 

 

I try to remake the dhl-courier for my courier www.opek.com.pl. The tracking webside are here:

 

http://opek.top100.net.pl/

 

Everyone can use this form, but must write username/passord. For all, you can use:

username (Nazwa uzytkownika): opek

password (haslo): opek

 

True list id are (Podaj numer(y) przesylek): 30627320

 

My source of catalog/op_tracking.php are like here:

--------------------------------------

<?php

/*

$Id: dp_tracking.php, v1.0 2008/09/29 web-engel - osC forum id - chris23

 

This script will be called via ajax from account_history_info.php and admin/orders.php

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// prevent direct calls to this page

 

if (!isset($_GET['tracking_id'])) {

die('Direct call to script. Exiting.');

}

 

error_reporting(E_ALL);

 

require("includes/application_top.php");

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TRACKING_MODULE);

 

// cookie file for cURL

$cookie_name = "opcookie.txt";

 

$tracking_number = $_GET['tracking_id'];

 

$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"; // dummy UA

 

$opek_id = "opek"; // Set your DHL ID

$opek_user_password = "opek"; // Set your DHL password

 

// Note: the tidying code below has been done on language=de only. Haven't tested tidying code on en page

 

$initial_loginurl = "http://opek.top100.net.pl/";

 

// Login

$ch= curl_init(); // initialise curl

curl_setopt($ch, CURLOPT_URL, 'http://opek.top100.net.pl/Status.aspx');

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_USERAGENT, $agent);

// set cookie jar / file

curl_setopt($ch, CURLOPT_COOKIEJAR, DIR_FS_CATALOG . 'tmp/' . $cookie_name);

curl_setopt($ch, CURLOPT_COOKIEFILE, DIR_FS_CATALOG . 'tmp/' . $cookie_name);

curl_setopt($ch, CURLOPT_REFERER, $initial_loginurl);

curl_setopt($ch, CURLOPT_POSTFIELDS, "UserName=" . $opek_id . "&Password=" . $opek_user_password );

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_exec($ch);

 

if ($error = curl_errno($ch)) {

if ($error == 7) {

die(TRACKING_CURL_SERVER_ERROR);

}

if ($error == 6) {

die(TRACKING_CURL_NO_ACTIVE_INTERNET);

}

}

 

// Logged in. Post tracking ID & params and see where we get sent:

 

curl_setopt($ch, CURLOPT_URL, 'http://opek.top100.net.pl/Status.aspx');

curl_setopt($ch, CURLOPT_HEADER, 1); // we need headers returned so we can extact 302 "location"

curl_setopt($ch, CURLOPT_USERAGENT, $agent);

curl_setopt($ch, CURLOPT_COOKIEJAR, DIR_FS_CATALOG . 'tmp/' . $cookie_name);

curl_setopt($ch, CURLOPT_COOKIEFILE, DIR_FS_CATALOG . 'tmp/' . $cookie_name);

curl_setopt($ch, CURLOPT_REFERER, $initial_loginurl);

curl_setopt($ch, CURLOPT_POSTFIELDS, 'TextBoxNrListu=' . $tracking_number);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);

 

if ($error = curl_errno($ch)) {

if ($error == 7) {

die(TRACKING_CURL_SERVER_ERROR);

}

if ($error == 6) {

die(TRACKING_CURL_NO_ACTIVE_INTERNET);

}

}

 

/*

we cannot rely on CURLOPT_FOLLOWLOCATION on shared servers (having openbase_dir / safe_mode enabled) because

since PHP 4.4.4 / PHP 5.2.0 this option is disabled

dl use a single 302 temporary redirect - get the url

*/

 

list($header, $data) = explode("\n\n", $data, 2);

preg_match('/Location:(.*?)\n/', $header, $matches);

$nurl = trim(str_replace("Location:", "", $matches[0]));

 

// now have redirected url

 

curl_setopt($ch, CURLOPT_USERAGENT, $agent);

curl_setopt($ch, CURLHEADER, 0);

curl_setopt($ch, CURLOPT_COOKIEFILE, DIR_FS_CATALOG . 'tmp/' . $cookie_name);

curl_setopt($ch, CURLOPT_URL, $nurl);

curl_setopt($ch, CURLOPT_REFERER, $initial_loginurl);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$grab_data = curl_exec($ch);

curl_close ($ch);

 

// tidy extraneous whitespace - use on all grabs

 

$grab_data = str_replace("\n", "", $grab_data);

$grab_data = str_replace("\r", "", $grab_data);

$grab_data = str_replace("\t", "", $grab_data);

$grab_data = str_replace(" ", "", $grab_data);

$pat[0] = "/^\s+/";

$pat[1] = "/\s{2,}/";

$pat[2] = "/\s+\$/";

$rep[0] = "";

$rep[1] = " ";

$rep[2] = "";

$grab_data = preg_replace($pat, $rep, $grab_data);

 

// set html start and end grab

 

$StartGrab = '<table border="0" cellpadding="3" cellspacing="0" style="width: 720px;" >';

$EndGrab = '</table>';

 

// Grab delivery status information

 

$text = eregi("$StartGrab(.*)$EndGrab", $grab_data, $content);

 

// start custom tidying

// strip tags - keep tracking tables but tidy afterwards

 

$content = strip_tags($content[1], '<table><tr><th></th><td></td></tr></table>');

 

// remove all html attributes

 

function strip_attributes($msg, $tag, $attr) {

$lengthfirst = 0;

while (strstr(substr($msg, $lengthfirst), "<$tag ") != "") {

$imgstart = $lengthfirst + strpos(substr($msg, $lengthfirst), "<$tag ");

$partafterwith = substr($msg, $imgstart);

$img = substr($partafterwith, 0, strpos($partafterwith, ">")+1);

$img = str_replace(" =", "=", $msg);

$out = "<$tag";

 

for($i = 0; $i <= (count($attr) - 1 );

$i++) {

$long_val = strpos($img, " ", strpos($img, $attr[$i]."=")) - (strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1) ;

$val = substr($img, strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1, $long_val);

if (strlen($val) > 0) $attr[$i] = " ".$attr[$i]."=".$val;

else $attr[$i] = "";

$out .= $attr[$i];

}

 

$out .= ">";

$partafter = substr($partafterwith, strpos($partafterwith, ">")+1);

$msg = substr($msg, 0, $imgstart).$out.$partafter;

$lengthfirst = $imgstart+3;

}

return $msg;

}

 

$content = strip_attributes($content, "TR", array());

$content = strip_attributes($content, "tr", array());

$content = strip_attributes($content, "TD", array());

$content = strip_attributes($content, "td", array());

$content = strip_attributes($content, "table", array());

 

// strip empty cells , rows and tables:

$content = preg_replace('/<td>\s*<\/td>/i','', $content); // cells

$content = preg_replace('/<tr>\s*<\/tr>/i','', $content); // rows

$content = preg_replace('/<table>\s*<\/table>/i','', $content); // rows

 

// size table:

$content = str_replace('<table>', '<table style="font-size: 11px">' , $content);

 

// the following functions will prevent 'UTF garbled' returned data. We try to use iconv (may be missing on Win32) or mb_convert_encoding (may not be compiled in to PHP)

if(function_exists(mb_convert_encoding)){

echo mb_convert_encoding($content, "ISO-8859-1", "UTF-8");

} elseif(function_exists(iconv)){

echo iconv("UTF-8", "ISO-8859-1", $content);

} else {

echo $content;

}

?>

--------------------------------------

 

& not working. I see info from const: INVALID_TK_ID_OP (the XX = OP in my contributions)

 

Can somebody help me?

 

--

MG

Link to comment
Share on other sites

Does anyone know how to disable the tracking ID validation check? Whatever I enter, valid or not, i get this message:

 The Posten Norge ID you have supplied is not valid. Please check and try again. The required format is 17 - 20 digits. Do not use spaces.

 

As you see I use the Posten Norge constribution, but from what I know, the validation check is located in the main constribution.

Link to comment
Share on other sites

  • 2 weeks later...

After long war, my version for Courier Opek are working, but not full. I have some problem.

 

First example.

1.Client login at my shop.

2.Client at place: Top » Catalog » My Account » History » Order #8949 see his tracking number.

3. When he click for him ID, then he see result.

 

I test this self on opera browser.

 

When I at the same time have see http://blablabla.pl/catalog/admin/orders.php.

And when I click at ID, then for first time all are ok.

And when I click agains, & again & again all are ok too.

 

----------------------------------------------------------

After this example I close opera (all session are closed).

Then in admin side see result only for first click. After second click I see error:

 

Fatal error: Call to a member function add_current_page() on a non-object in ...../catalog/includes/application_top.php on line 312

 

The 312 line are like here:

 

312: $navigation->add_current_page();

 

----------------------------------------------------------

For client all working OK (client must be signed). For admin not. Can somebody help me? (session in configure.php are mysql).

 

----------------------------------------------------------

Another information:

 

When I see first time error: "Fatal error: Call to a member function add_curren...." I can't open catalog side.

 

When I clear cache of opera, are start like new. (One click in admin-side or must login on client-side as some client & can working in admin-side full).

Edited by marcingebus
Link to comment
Share on other sites

  • 4 weeks later...

I have little problems with this contribution.

 

When a customer see his order history:

 

 

the always says "Whithout Tracking ID"

 

Looking for the database tables the data is right:

orders_status_history_id orders_id orders_status_id date_added customer_notified comments tracking_id

402 246 3 06/01/2010 16:03 1 Send. 00345630001234566385|dp

 

Looking for the code of account_history_info.php is this:

         '                <td class="main" align="center" valign="top">' . $tracking->display_tracking_link($statuses['tracking_id'], TRACKING_LINK_LABEL) . '</td>' . "\n" .

 

Why dont appear the tracking ID to the customers comments.???

 

In admin/orders is right, but the code is different:

'            <td class="smallText" align="center">' . $tracking->display_tracking_link($orders_history['tracking_id']) . '</td></tr>' . "\n";

 

 

Also, sometimes in admin/orders.php gets this error when updating:

Warning: Cannot modify header information - headers already sent by (output started at */htdocs/includes/languages/espanol/tracking_module.php:61) in */htdocs/admin/includes/functions/general.php on line 89

Link to comment
Share on other sites

Does anyone know how to set a range from 8 to 25 digits for the fedex validation, instead of it being constant single number.

 

fedex express is 12 digits long

fedex ground is 22 to 25 characters long

postal office smart post can be more than 25 digits long.

 

I'm assuming this all can be the same tracking module with a regular expression of numbers between 12 and 50. But how is that written and where in the code or in the database do you store that?

 

thanks

Link to comment
Share on other sites

got it - simply uninstall your fedex tracking module - then go into your includes/modules/tracking/ fedex.php tracking page and update your validation code to something like this...

/^\\\d{8,25}$/

 

save the file, install the tracking module again in the admin and it should work.

Link to comment
Share on other sites

  • 4 months later...

Ignore the last post, i figured out that i forgot to add the constants to the language file.

 

However. i got everything looking good. it accepts my tracking number links are all there.

 

BUT. When i click to view it, it does the little "Contacting courier... Please Wait"

 

and then it shows nothing. i dont even get the "cannot contact the server" or anything. just nothing except the "[X] Close" thing.

 

I've got my start & grab code set to

 

$StartGrab = '<html>';
$EndGrab = '</html>';

 

So it should just show me everything.

 

Any ideas?

 

Cheers,

Reece

Link to comment
Share on other sites

Ignore the last post, i figured out that i forgot to add the constants to the language file.

 

However. i got everything looking good. it accepts my tracking number links are all there.

 

BUT. When i click to view it, it does the little "Contacting courier... Please Wait"

 

and then it shows nothing. i dont even get the "cannot contact the server" or anything. just nothing except the "[X] Close" thing.

 

I've got my start & grab code set to

 

$StartGrab = '<html>';
$EndGrab = '</html>';

 

So it should just show me everything.

 

Any ideas?

 

Cheers,

Reece

 

I've fiddled a bit more and i can now get...

 

"Couriers Please - EZYTRAK� Tracking results function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0; i0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i "

 

But that tells me nothing.

 

Thanks,

Reece

Link to comment
Share on other sites

  • 2 months later...

Hello Chris,

 

I installed the FedEx Module. Once I click on the FedEx Tracking #, I see the following weird message:

 

Shipment Travel HistoryHelpSelect time zone:Others:All shipment travel activity is displayed in local time for the locationTo display the shipment travel activity in local time of the scan, please select "Local Scan Time" time zone option. Alert: To determine the destination time zone for this shipment please select from the Others list. Alert: To determine the origin time zone for this shipment please select from the Others list.NoentriesfoundDate/TimeActivityLocationDetails

[x] Close

 

Please help. Thank you.

Link to comment
Share on other sites

  • 3 weeks later...

hi

 

installed the module 12 dec 2007 no problem and royal mail 1.4 no problem

 

everything seems to have installed fine, no errors anywhere, can add tracking numbers ok. The email that goes to the customer works and the link in the email to the royal mail site works.

 

however, within admin and within the customers order area, the spinning ajax_wait.gif does it's thing for a second or two, then all that is left in the results box is " [x] Close "

 

the tracking number i'm using is RJ575241817GB, but i don't know if the issue is related to the tracking numnber (unlikely), my installation (11am here, see no problem with that), or with the module....perhaps royal mail have changed their website since november 2008 (likely?).

 

to overcome the issue of modules going out of date when couriers change their site would it be an idea perhaps to opt for the on-site links to just open a new window, rather than try and embed the results. making them a little more future proof.

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 months later...

I have now updated this contribution to work with 2.3 the download can be found at http://addons.oscommerce.com/info/7864

 

The old "courier" modules will work with this update but need the value '777' changing to '6' in the function install (there is a reminder in the instruction.txt as well)

 

An updated version of the Royal Mail tracking module is already loaded with the contribution - you will need to download both if you require the RM tracking service.

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Link to comment
Share on other sites

  • 4 months later...

Hi Tony,

 

$%£"! Royal Mail!

 

The first one isn't working as there is a bad alt tag in the HTML alt='it's on its way' - note the single quote within single quotes. This is causing strip_tags to choke.

 

The second one works as it's been delivered and doesn't have the offending alt tag.

 

To fix this, edit rm_tracking.php

 

AFTER

 

// Grab delivery status information and POD data.
$text = preg_match('/<div class="track-right-box">(.*)<div class="FlexiList( default| null)">/i', $grab_data, $content);

 

ADD:

 

	$content[1] = addslashes($content[1]);

 

This tidies up the HTML sufficiently for strip_tags to clean the rest. I get the feeling I'm going to be chasing my tail with RM ....

 

HTH

 

Chris

 

This did not work for me so I used...

 

// Grab delivery status information and POD data.
   $text = preg_match('/<div class="track-right-box">(.*)<div class="FlexiList( default| null)">/i', $grab_data, $content);

//$content[1] = addslashes($content[1]);
   $content[1] = str_replace("'", "", $content[1]); //fix for "it's" on RM page - only shows at certain RM stages

Link to comment
Share on other sites

  • 3 months later...

Hello,

 

I'm using the Parcelforce Track & Trace v1.1 module and recently it has stopped working, when checking a delivery it says "Contacting courier...please wait" as usual but then just returns an empty box with no tracking info. The shipping IDs work on the Parcelforce website so I'm guessing Parcelforce have changed their track & trace system. Has anyone else experienced the same problem or have a fix?

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

I am trying to install this and modify it into something i can use. I have done the basic install and installed one module. the problem i am having is on the orders page i get this error. I have replaced the catalog/includes/class file but still no resolve. I do have a module enabled as i can see it in my configuration table.

 

Warning: constant() [function.constant]: Couldn't find constant TRACKING_MODULE_NAME_ in /var/www/web/includes/classes/tracking_module.php on line 227
Warning: constant() [function.constant]: Couldn't find constant ADMIN_LINK_TITLE_ in /var/www/web/includes/classes/tracking_module.php on line 229

Link to comment
Share on other sites

  • 4 weeks later...

Anyone got this to work correct with SAPO? - SA Post office

Added update to contributions.

 

Just, how to get UHTML emails to send customer tracking number when updating in admin??

Getting the Phoenix off the ground

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