Jump to content
chris23

[contribution] Tracking Module

Recommended Posts

just a quickie on the edit orders updating issue, i had a friend help me get mine going with this line change around 300 in edit_orders.php:

 

// always update date and time on order_status

//check to see if can download status change

if ( ($check_status['orders_status'] != $status) || $comments != '' || ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) || ($check_status['shipment_track_num'] != $shipment_track_num) || ($check_status['shipment_method'] != $shipment_method) ) {

 

 

check yours and compare to see the changes, this casued my tracking to be updated when i wanted to change shipping methods or tracking numbers after they were already entered. Hope this helps everyone :)

 

G

 

almost forgot, just above that code add these two variables to be posted :)

 

// status comments

 

$status = tep_db_prepare_input($_POST['status']);

$comments = tep_db_prepare_input($_POST['comments']);

$shipment_track_num = (isset($_POST['shipment_track_num'])) ? $_POST['shipment_track_num'] : '';

$shipment_method = (isset($_POST['shipment_method'])) ? $_POST['shipment_method'] : '';

Edited by ggbig

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

Best Regards,

 

ggbig (maestro)

Share this post


Link to post
Share on other sites
Hi Rolf,

 

The REGEXP you need is /^\d{18}$/

 

PS the code SP is yours

 

thanks Chris

 

now the regexp works, but i can't see informations of the tracking....

 

tracking.gif

Share this post


Link to post
Share on other sites
thanks Chris

 

now the regexp works, but i can't see informations of the tracking....

 

 

Hi Rolf,

 

I've found when writing modules that a totally blank return is caused by incorrect start and end points for the screen grab. These both need to be unique for the returned html.

 

When I'm debugging I find it helpful to call the tracking script directly. To do this, comment out:

 

if (!isset($_GET['tracking_id'])) {
   die('Direct call to script. Exiting.');
}

 

Then comment out:

$tracking_number = $_GET['tracking_id'];

 

and hardcode a valid tracking id eg

 

$tracking_number = 123456789;

 

Also turn on error reporting if it's off so you can see if your tracking file is generating any errors.

 

When you have the screen grab working, reverse the changes above and you're done.

 

HTH

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Hi Rolf,

 

I've found when writing modules that a totally blank return is caused by incorrect start and end points for the screen grab. These both need to be unique for the returned html.

 

When I'm debugging I find it helpful to call the tracking script directly. To do this, comment out:

 

if (!isset($_GET['tracking_id'])) {
   die('Direct call to script. Exiting.');
}

 

Then comment out:

$tracking_number = $_GET['tracking_id'];

 

and hardcode a valid tracking id eg

 

$tracking_number = 123456789;

 

Also turn on error reporting if it's off so you can see if your tracking file is generating any errors.

 

When you have the screen grab working, reverse the changes above and you're done.

 

HTH

 

Chris

 

hi chris

 

Parse error: syntax error, unexpected T_VARIABLE in /home/httpd/vhosts/ahornsirup.ch/httpdocs/catalog/sp_tracking.php on line 31

 

that's on line 31

 

$pl_get_receiver_url = TRACKING_GET_URL_SP;

 

and this is the url in the database

http://www.post.ch/swisspost-tracking?formattedParcelCodes=

 

here you can see the url from swiss post

URL-Swisspost

 

hope you can help me...

 

thanks

rolf

Share this post


Link to post
Share on other sites

Hi Chris, sorry to push it, but did you see my post on the previous page of this thread about the invoicing/bulk updating thing?

 

Tony


Tony Lloyd - "Backbone of the Making Tracks Online Experience" - See GE Manual p19 :lol:

lloydy_sig.jpg

Share this post


Link to post
Share on other sites
Hi Chris, sorry to push it, but did you see my post on the previous page of this thread about the invoicing/bulk updating thing?

Tony

 

Hi Tony,

 

I have been giving this some thought.

 

1. The Royal Mail image. I can't see an easy way of doing this. It would require another bunch of cURL calls to Royal Mail to try and get the image, but I'm not sure Royal Mail would allow hotlinking to their images (this would need testing)

 

2. I can see the benefit of a bulk updating facility, although I feel the best option would be to integrate it into a stock oSC install, rather than an existing contribution like yours so that it appeals to a wider audience.

 

I will be working on a v2 of the module (this will be backwardly compatible before anyone starts to panic). In addition to bulk updating, I'm thinking of including (optional) SMS support whereby the tracking url and ID is texted to customers. I get this from certain companies and personally find it useful. There are lots of very cheap SMS gateways out there now.

 

HTH

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
hope you can help me...

 

thanks

rolf

 

Hi Rolf,

 

Please e-mail me your sp_tracking.php file and if you have one, a valid tracking ID. My email address is in the readme.html in the developers folder. I'll have a look at what's going wrong.

 

Cheers

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
You can keep your existing rm ids but you'll need to perform two steps using phpMyAdmin

 

1. Select table orders_status_history. Tick the box next to rm_tracking_id. Click change (the pencil). In the form that appears, change rm_tracking_id to tracking_id and change the field length from 13 to 32. Then click 'Save'

 

2. The new tracking numbers are the same as the old but they also contain the module type as a suffix. e.g. AB123456789GB is stored as AB123456789GB|rm

 

The |rm bit allows the contrib to know which type of tracking id it is.

 

You now need to browse the table orders_status_history and edit any entry with a rm tracking_id, add |rm to the end of GB and save. You could of course export the table, drop it, manually amend the sql by doing a search/replace on GB to GB|rm and reimport (I'd do this as I'm lazy)

 

Hi Chris,

 

Thank you for a great contribution.

I changed my database using mysql, which hopefully will help someone

 

Remember to backup your database first!

 

UPDATE orders_status_history SET

`tracking_id`= CONCAT(`pf_tracking_id`, '|pf') where `pf_tracking_id` != '';

UPDATE orders_status_history SET

`tracking_id`= CONCAT(`rm_tracking_id`, '|rm') where `rm_tracking_id` != '';

 

Then I deleted the rm_tracking_id and pf_tracking_id fields.

 

Simon

Share this post


Link to post
Share on other sites

To those of you having issues with the supplied tracking id being inserted into the database, there appears to be an issue with some versions of PHP4.

 

If you're getting this issue,

 

EDIT includes/classes/tracking_module.php

 

FIND:

 

$track_id_failed = 0;

		while (list($key, $val) = each($HTTP_POST_VARS)) {
			if ((preg_match("/^tracking_id_\D{2}$/", $key, $matches)) && !empty($val)) {
				$this->tracking_id_fields[] = $matches[0];
			}
		}

 

Replace with:

 

$track_id_failed = 0;
		reset($HTTP_POST_VARS);
		while (list($key, $val) = each($HTTP_POST_VARS)) {
			if ((preg_match("/^tracking_id_\D{2}$/", $key, $matches)) && !empty($val)) {
				$this->tracking_id_fields[] = $matches[0];
			}
		}

 

Sorry this has taken so long to fix; I've only just seen this issue on a box running an OLD PHP4 (4.3.9)!


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hi Chris,

I've installed this on my heavily modded store but cannot turn it on ? When I click on tracking in modules I end up back at payments even though the url is showing as http://www.*********.co.uk/admin/modul...hp?set=tracking

 

I've checked all the code changes and I'm sure i've got it correct.

Edited by ihatedeskjets

Share this post


Link to post
Share on other sites
Hi Chris,

I've installed this on my heavily modded store but cannot turn it on ? When I click on tracking in modules I end up back at payments even though the url is showing as http://www.*********.co.uk/admin/modul...hp?set=tracking

 

I've checked all the code changes and I'm sure i've got it correct.

 

Ken,

 

Please double check you have the following in admin/modules.php:

 

	// added for tracking module
		case 'tracking':
		$module_type = 'tracking';
		$module_directory = DIR_FS_CATALOG_MODULES . 'tracking/';
		$module_key = 'MODULE_TRACKING_INSTALLED';
		define('HEADING_TITLE', HEADING_TITLE_MODULES_TRACKING);
		break;
		// end added tracking module

 

HTH

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Thnx Chris

 

Here we go

 

if (tep_not_null($set)) {
switch ($set) {
  case 'shipping':
	$module_type = 'shipping';
	$module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';
	$module_key = 'MODULE_SHIPPING_INSTALLED';
	define('HEADING_TITLE', HEADING_TITLE_MODULES_SHIPPING);
	break;
  case 'ordertotal':
	$module_type = 'order_total';
	$module_directory = DIR_FS_CATALOG_MODULES . 'order_total/';
	$module_key = 'MODULE_ORDER_TOTAL_INSTALLED';
	define('HEADING_TITLE', HEADING_TITLE_MODULES_ORDER_TOTAL);
	break;
  case 'payment':
  default:
	$module_type = 'payment';
	$module_directory = DIR_FS_CATALOG_MODULES . 'payment/';
	$module_key = 'MODULE_PAYMENT_INSTALLED';
	define('HEADING_TITLE', HEADING_TITLE_MODULES_PAYMENT);
	break;
	// added for tracking module
	case 'tracking':
	$module_type = 'tracking';
	$module_directory = DIR_FS_CATALOG_MODULES . 'tracking/';
	$module_key = 'MODULE_TRACKING_INSTALLED';
	define('HEADING_TITLE', HEADING_TITLE_MODULES_TRACKING);
	break;
	// end added tracking module
}
 }

Share this post


Link to post
Share on other sites

Damn Damn Damn, My apologies, I'd forgotten to upload that file :blush:

 

It seems to be working now, although I dont see anywhere to add the tracking number in orders, using royal mail 1.3

Edited by ihatedeskjets

Share this post


Link to post
Share on other sites

Hmmm,

 

Bit odd. You should only get bounced back to payment if no module type is specified (payment is the default).

 

Do you have any courier modules installed yet? Even if you haven't you should still be able to enter the tracking page of modules.php , even though you just see an empty list.

 

If you haven't installed a module, try one and see if you still have a problem.

 

Also ensure you've created the two required tracking directories.

 

Cheers

 

Chris

 

[EDIT] - just seen your reply so please ignore these ramblings ... :thumbsup:

Edited by chris23

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hi there, I am creating a tacking module for FEDEX and have got the following problems / errors:

 

Warning: constant() [function.constant]: Couldn't find constant TRACKING_MODULE_NAME_ in /homepages/45/d121888388/htdocs/osc_development_ds/includes/classes/tracking_module.php on line 227

 

Warning: constant() [function.constant]: Couldn't find constant ADMIN_LINK_TITLE_ in /homepages/45/d121888388/htdocs/osc_development_ds/includes/classes/tracking_module.php on line 229

On account_history_info.php

 

and

 

Warning: constant() [function.constant]: Couldn't find constant TRACKING_MODULE_NAME_ in /homepages/45/d121888388/htdocs/osc_development_ds/includes/classes/tracking_module.php on line 227

 

Warning: constant() [function.constant]: Couldn't find constant ADMIN_LINK_TITLE_ in /homepages/45/d121888388/htdocs/osc_development_ds/includes/classes/tracking_module.php on line 229

On /admin/orders.php

  • The order has an Tracking ID which I added in admin.
  • My fedex mod has been installed
  • Add tracking ID / ref to an order works fine!

I see its not getting the two digit reference (FX in this case).

 

I have gone through the instructions several times, but not found anything missing.

 

Can anyone help pin point the problem and suggest a fix.

 

Thanks,

 

Gareth

Share this post


Link to post
Share on other sites
Can anyone help pin point the problem and suggest a fix.

 

Thanks,

 

Gareth

 

Hi Gareth,

 

I've just PMd you

 

Cheers

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hi guys, firstly, this is a fantastic script!

 

I am seeing the following error message when I look at the tracking modules page within the admin section:

 

 

Error!

 

Unable to determine connection method on a link!

 

Known methods: NONSSL SSL

 

Function used:

 

tep_href_link('modules.php', 'set=tracking&module=royalmail', '')

 

I have this installed on a very heavily modded CREloaded software.

 

I have placed the files in the appropriate places to make it work, just seeing this error and is not allowing me to install any of the modules.

 

I have missed up step 9 for now, the order page, but this wouldn't stop the app from working...

 

Many thanks in advance

Share this post


Link to post
Share on other sites

OK found the answer to this bit, it is CRE specific, answer from wroughtec on CRE forums:

 

admin/modules.php:

 

Code::

// added for tracking module

case 'tracking':

$module_type = 'tracking';

$module_directory = DIR_FS_CATALOG_MODULES . 'tracking/';

$module_key = 'MODULE_TRACKING_INSTALLED';

define('HEADING_TITLE', HEADING_TITLE_MODULES_TRACKING);

$SSL= 'NONSSL';

break;

// end added tracking module

 

Anyway, I have everything installed and running however, when i try to add a tracking code, nothing is added, nor do i see any error messages...

 

A little help please?

Share this post


Link to post
Share on other sites
OK found the answer to this bit, it is CRE specific, answer from wroughtec on CRE forums:

 

William (wroughtec) is your man over at CRE for all things tracking module.

 

Anyway, I have everything installed and running however, when i try to add a tracking code, nothing is added, nor do i see any error messages...

 

Have a look at post #109 further up this page.

 

HTH

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hello to all :) Thanks for this great contributioni. After the PHP fix it works perfectly.

 

1 Question. How to manage if a courrier has 2 different leghts of shipping numbers: 1 with 13 characters (numbers and letters) and 1 with 18 digits ( only numbers). We installed the Swisspost module.

 

Thanks for your help :)

 

Greetings

Share this post


Link to post
Share on other sites
13 characters (numbers and letters)

 

Hi,

 

Can you give me the exact format of the 13 character tracking id e.g 3 letters + 10 numbers, 2 letters + 11 numbers etc?

 

I can then supply you a modified regular expression that will validate both types of tracking id

 

Regards,

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Hi,

 

Can you give me the exact format of the 13 character tracking id e.g 3 letters + 10 numbers, 2 letters + 11 numbers etc?

 

I can then supply you a modified regular expression that will validate both types of tracking id

 

Regards,

 

Chris

 

Hello Chris

 

Thanks for answering. The 13 characters are used for shippings to abroad. The syntax is

2 letters then 9 numbers then 2 letters

e.x: RN555666777CH

 

The use of 2 different trackingnumber is used by the SwissPost. So its needed for the Swisspost module.

 

Thanks a lot :) and best regards

Share this post


Link to post
Share on other sites
Hello Chris

 

Thanks for answering. The 13 characters are used for shippings to abroad. The syntax is

2 letters then 9 numbers then 2 letters

e.x: RN555666777CH

 

The use of 2 different trackingnumber is used by the SwissPost. So its needed for the Swisspost module.

 

Thanks a lot :) and best regards

 

 

Here's your fix.

 

Go to Admin -> Modules -> Tracking and "Uninstall" Swisspost.

 

Now EDIT catalog/includes/modules/tracking/swisspost.php

 

FIND

 

'/^\\\d{18}$/'

 

REPLACE WITH:

 

'/^(\\\d{18})|(\\\D{2}\\\d{9}\\\D{2})$/'

 

Now back in admin, Modules -> Tracking and "Install" Swisspost.

 

Your Swisspost will now recognise either 18 digits or 2 letter + 9 digits + 2 letters

 

Cheers

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Here's your fix.

 

Go to Admin -> Modules -> Tracking and "Uninstall" Swisspost.

 

Now EDIT catalog/includes/modules/tracking/swisspost.php

 

FIND

 

'/^\\\d{18}$/'

 

REPLACE WITH:

 

'/^(\\\d{18})|(\\\D{2}\\\d{9}\\\D{2})$/'

 

Now back in admin, Modules -> Tracking and "Install" Swisspost.

 

Your Swisspost will now recognise either 18 digits or 2 letter + 9 digits + 2 letters

 

Cheers

 

Chris

 

Hello Chris

 

Thanks really a lot for helping me. I followed your instruction and modified the string you posted. Entering the Tracking number works now. In the confirmation email the link works too. Only thing missing is if you click on the tracking number in the admin panel or in the costumer's account history, Clickng on the tracking (aboveYour tracking ID - click ID for full status) doesn't give any result. Do you have a hint?

 

Greeting and thanks again for your precious help

Share this post


Link to post
Share on other sites

Hello chris,

 

I am still changing the code for my couriers. But I have a problem with a tracking code :

I entered '/^\\\d{1}\\\D{1}\\\d{11}$/' for a tracking code which is 1 digit + 1 letter + 11 digits (8D00432154798)

Could you help me ?

 

EDIT: it accepted the code but it tells me that the order has not been updated...

 

 

Thx ya

 

JD

Edited by JdBk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×