Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Tracking Module


chris23

Recommended Posts

See post #26 for a fix for this

Did you remember to add the citylink language constants to catalog\includes\languages\english\tracking_module.php?

 

HTH

 

Chris

 

 

Hi yes i did do that this is what I have added to that file:

 

	// Citylink - Class constants
define('TRACKING_MODULE_NAME_CL','Initial Citylink');
define('INVALID_TK_ID_CL', 'The Initial Citylink ID you have supplied is not valid. Please check and try again. The required format is 2 letters, 6 digits eg AB123456 or 3 letters, 5 digits eg ABC12345. Do not use spaces.');
define('HEADING_CL', 'Add Initial Citylink Tracking Data (<em>if</em> applicable to this order)<p class="smallText">Please enter your 8 digit tracking ID for this order. Do not use spaces. The format is two letters, followed by 6 digits, eg <span style="color: red">AB123456</span></p> or three letters followed by 5 digits e.g. <span style="color: red">ABC12345</span></p>');
define('NO_JS_ALTERNATIVE_CL', 'You appear to have JavaScript disabled. It is therefore not possible to automatically load the Initial Citylink status via AJAX.<br />Please use the link below to be redirected to Initial Citylink\'s website where you can view the tracking status by manually entering the Tracking ID:<br /><a target="_blank" href="http://www.city-link.co.uk/track_parcel/track_parcel.php">http://www.city-link.co.uk/track_parcel/track_parcel.php</a>');
define('TRACK_IMAGE_URL_CL', ' (<a href="http://www.city-link.co.uk/log_in/log_in.php" target="_blank">Need help?</a>)');

 

Also what seems weird in that error is that the the tracking_module.php in includes/classes to the one in includes/languages/english etc.. but seems to be searching on the wrong one. Ie the second tracking_module.php is the one it should be reading.

 

I also checked for the space as advised , but there isnt any in my file.

 

Regards

Chris

Link to comment
Share on other sites

  • Replies 296
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

I am not good in php coding.I have used oscommerce contribution for tracking module in my site (http://addons.oscommerce.com/info/5535).i followed up all notes that mentioned in installation file.But still issue on tracking module.I can't upgrade the tracking module from admin control panel.

 

please anyone can help me.

 

Thanks,

Nadesh.

Link to comment
Share on other sites

Also what seems weird in that error is that the the tracking_module.php in includes/classes to the one in includes/languages/english etc.. but seems to be searching on the wrong one. Ie the second tracking_module.php is the one it should be reading.

 

The error message is correct. catalog/includes/classes/tracking_module.php is trying to include the language constants from the file catalog/includes/languages/english/tracking_module.php. It is to this second file that the citylink language constants should be added.

 

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

Link to comment
Share on other sites

I can't upgrade the tracking module from admin control panel.

 

Which tracking module are you trying to upgrade?

 

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

Link to comment
Share on other sites

  • 2 weeks later...

Hi Chris,

 

This is fantastic, I have just installed this on to my test site. And works great.

 

What I would like to know is on my live site I have your old RM track n trace installed, is it possible for me to install this new one without losing the orders that

already have RM numbers assigned to them?

 

On my test site I just compleatly removed the old mod and installed the new one for testing purposes.

 

If it cant be done where I can keep the current tracking numbers I will just remove the current mod and take a copy of recently dispatched items tracking numbers.

 

Also how difficult is it to write a tracking module? is it a case of I could just edit say the rm or city link mod? I want to create one for business post.

I would like to have a go at doing this my self but I am not a developer at all and really dont have to time to study at the moment as I am studying for CCNA

and that is taking up a hell of a lot my time.

 

Great work Thanks and all the best for 2008

Link to comment
Share on other sites

Also how difficult is it to write a tracking module? is it a case of I could just edit say the rm or city link mod? I want to create one for business post.

 

Well I have had a go a creating one by editing the citylink module.

I made what I thought were all the changes needed to the files.

When I goto admin>modules>tracking the business post one is there but when I click install it doesnt do anything.

 

Also I am not sure what values there id's use so left them to the same as citylink just for testing purposes.

The call back url I believe is http://www.business-post.com/scripts/wsisa...lc_SearchValue=

 

Not sure where I need to look to actually make it install?

 

All I did was change the initial city link to business post and CL to BP ect in all the files, can anyone who has succesfuly made a mod help me to get this to work?

Here are the files I have created

 

Business_Post.zip

Link to comment
Share on other sites

What I would like to know is on my live site I have your old RM track n trace installed, is it possible for me to install this new one without losing the orders that

already have RM numbers assigned to them?

 

On my test site I just compleatly removed the old mod and installed the new one for testing purposes.

 

If it cant be done where I can keep the current tracking numbers I will just remove the current mod and take a copy of recently dispatched items tracking numbers.

 

Hi Shaun,

 

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)

 

Also how difficult is it to write a tracking module? is it a case of I could just edit say the rm or city link mod? I want to create one for business post.

I would like to have a go at doing this my self but I am not a developer at all and really dont have to time to study at the moment as I am studying for CCNA

and that is taking up a hell of a lot my time.

 

This is a tricky one to answer. If you have an intermediate knowledge of PHP then it's not especially hard. The target audience for the class is really other developers e.g. those installing a store for a client having requested a specific courier. I would hope that the finished module would then make its way to the contrib area :-"

 

I feel I should clarify my position regarding writing other modules. I probably came across as too negative. What I was hoping to avoid were "demands" for modules. Like you, I have limited time to devote to osC. What I was hoping to get across was that I'd like people to do the ground work, especially the bits I can't do e.g.

 

1. I don't have accounts with most couriers so don't know the urls needed.

2. I don't know what valid tracking ids there are for all couriers.

 

A lot of the work needed doesn't need any coding knowledge at all

 

Most people could easily write the language entries, find out the formats of valid ids, find the urls etc. If they then struggle with the cURL part of the script and tidying the returned data, then I'm happy to jump in and help.

 

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.

 

Happy New Year

 

Chris

 

PS Have you registered a code for your Business Post module??

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

Link to comment
Share on other sites

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.

 

Happy New Year

 

Chris

 

PS Have you registered a code for your Business Post module??

 

Not sure what you mean by registering my module?

 

I know bis post have a url for tracking which I put in my pevious post.

 

I decided to just remove the old module on my live site and install the new, just copied recent items into note pad and put them in.

 

I will try and remember to find out what our tracking IDs tomorrow (not sure if they are the same for everyone but would imagine they are.)

Will ask the girl at work if we can use their acct details tho I am not sure that will be allowed as its for the company I work for which is not related to my Osc site.

Link to comment
Share on other sites

Not sure what you mean by registering my module?

 

Hi Shaun,

 

In the readme file in the developers folder, there is a url to a form on my own site. This allows me to keep track of which two letter codes are in use so that any conflicts between modules can be avoided.

 

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

Link to comment
Share on other sites

Hi Chris,

 

I understand wot ya mean now by registering my module, Sorry I didnt look in there. Will do it now. Thats something I have missed when creating the business post module.

 

Will go do it now

 

The biz post tracking Id that our books have are 10 numbers no letters.

 

Regards

Shaun

Link to comment
Share on other sites

Well I have amended my module and I can get it to install.

 

Only problems I have now are:

 

When I go into edit an order I have the following error

Warning: constant() [function.constant]: Couldn't find constant NO_JS_ALTERNATIVE_BP in /home/xxxxx/public_html/xxxx/includes/classes/tracking_module.php on line 200

 

I added the following to catalog//includes/languages/english/tracking_module.php

// Business Post - Class constants
define('TRACKING_MODULE_NAME_BP','Business Post');
define('INVALID_TK_ID_BP', 'The Business Post ID you have supplied is not valid. Please check and try again. The required format is 10 Digits eg 1234567890. Do not use spaces.');
define('ADMIN_LINK_TITLE_BP', 'Click to load item\'s current status from Business Post');
define('EMAIL_NOTIFICATION_BP', 'If you would like to track your parcel online using Business Post\'s tracking facility, you can do this by either logging in via our website and viewing your order history using the link above or alternatively, follow the link below:');
define('HEADING_BP', 'Add Business Post Tracking Data (<em>if</em> applicable to this order)<p class="smallText">Please enter your 10 digit tracking ID for this order. Do not use spaces. The format is 10 numbers EG: <span style="color: red">1116715182</span></p>');
define('NO_JS_ALTERNATIVE_CL', 'You appear to have JavaScript disabled. It is therefore not possible to automatically load the Business Post status via AJAX.<br />Please use the link below to be redirected to Business Post\'s website where you can view the tracking status by manually entering the Tracking ID:<br /><a target="_blank" href="http://www.business-post.com/scripts/wsisa.dll/ws_quickpod.html">http://www.business-post.com</a>');
define('TRACK_IMAGE_URL_BP', ' (<a href="http://www.businesspost.biz/index.asp?d=services&h=proof-of-delivery.asp&p=http://www.business-post.com/scripts/wsisa.dll/ws_refquickpod.html&s=1&s2=1" target="_blank">Need help?</a>)');

 

So I am assuming I have something wrong in there.

Also when I enter a code and change the status of an order I get the following error

Warning The Business Post ID you have supplied is not valid. Please check and try again. The required format is 10 Digits eg 1234567890. Do not use spaces.
Warning Warning: Nothing to change. The order was not updated.

 

I modified the line for the table in catalog\includes\modules\tracking\business_post.php

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Business Post tracking ID validation REGEXP', 'TRACKING_REGEXP_BP', '/^(\\\D{2}\\\d{6})|(\\\D{3}\\\d{5})$/', 'Business Post tracking ID validation REGEXP - DO NOT EXIT', '777', '0', '', now())");

 

I think its to do with '/^(\\\D{2}\\\d{6})|(\\\D{3}\\\d{5})$/ part but am not sure what it should be.

 

Also the line below has been modified to

'TRACKING_ID_LENGTH_BP', '10', 'Field length of Business Post Tracking ID

 

 

I will keep hacking away at it, until either I give in or someone replies with something for me to try

Edited by Get-Wireless 2
Link to comment
Share on other sites

I gotta admit I am outta of my depth here :(

Here are the files that I have edited in order to get the module to install.

BusinessPost.zip

Just needs the 10 digit con number to work, and to get rid of the

Couldn't find constant NO_JS_ALTERNATIVE_BP error in the edit orders page,

 

Have also just noticed this error in the order edit page

Warning: constant() [function.constant]: Couldn't find constant TRACKING_MODULE_NAME_BP in /home/xxxxxx/public_html/xxxxx/includes/classes/tracking_module.php on line 137

Edited by Get-Wireless 2
Link to comment
Share on other sites

I gotta admit I am outta of my depth here :(

 

Hi Shaun,

 

I can see where you're going wrong. I'll have a look at the zip for you and finish things off.

 

If you have some (or even one) valid tracking ids, can you PM it to me so I can test and sort out the screen scrape?

 

Thanks for registering the code - BP is yours.

 

Cheers

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

Link to comment
Share on other sites

Hi Shaun,

 

I can see where you're going wrong. I'll have a look at the zip for you and finish things off.

 

If you have some (or even one) valid tracking ids, can you PM it to me so I can test and sort out the screen scrape?

 

Thanks for registering the code - BP is yours.

 

Cheers

 

Hi Chris,

 

I have sent you a valid BP con number via pm but not sure if you have got it as there is nothing in my sent pm box,

dont know if the forum auto removes them.

Link to comment
Share on other sites

Business Post now added,

 

Thanks to Chris for finishing off the code.

 

Appologies for the typos in in the description am sure you will work it out :rolleyes:

Link to comment
Share on other sites

Chris, Thank you for such a wonderful module which, on the whole, works exactly as expected :-)

 

I have a modified store although I can't think of anything that is causing the following error ...

 

When I change the status of the order but DON'T ADD a tracking ID I get the following error message

 

Warning: constant() [function.constant]: Couldn't find constant EMAIL_NOTIFICATION_ in /shop/includes/classes/tracking_module.php on line 186

Warning: Cannot modify header information - headers already sent by (output started at /shop/includes/classes/tracking_module.php:186) in /shop/admin/includes/functions/general.php on line 22

 

When I press BACK the order status has been updated though. I have already deleted the whitespace from the end of the language file.

 

Also, if I wanted to include the Track & Trace ID on the invoice (I use a batch invoice printer to create a proof of postage certificate - this is based on an invoice though so it would be the same thing ;-)) what code would I need to include in the relevent places?

 

Kind Regards, Tony

Link to comment
Share on other sites

Further to my last post, this error only occurs when I am changing the status of the order but not adding any comments or a tracking id AND I request to email the customer.

 

When the customer is not emailed, the error does not occur.

 

HTH

 

Tony

Link to comment
Share on other sites

Further to my last post, this error only occurs when I am changing the status of the order but not adding any comments or a tracking id AND I request to email the customer.

 

When the customer is not emailed, the error does not occur.

 

Hi Tony,

 

Sorry you're having trouble. Can you confirm you're using the Dec 12th module version? The error you describe was happening with the original version due to a bug.

 

I you have the latest version, please PM a copy of your admin/orders.php so I can see what the problem is.

 

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

Link to comment
Share on other sites

Hi Chris, sorry I was using the original upload. I found the Nov 14th Upgrade afterwards and forgot to post that it was resolved.

 

Thanks for the excellent module, I do have two requests/updates though if it is possible, if not I am sorry for pushing my luck ;-)

 

1, Is there any way of pulling the POD image from the Royal Mail website if its available?

 

2, I use a builk invoicing tool to print my orders (and also my proof of postage), is there any way of bulk updating the order tracking ID's?

I have idea's on how it could be done, just no idea how to actually do it.

 

Tony

Edited by datajammer
Link to comment
Share on other sites

Thanks for the excellent module, I do have two requests/updates though if it is possible, if not I am sorry for pushing my luck ;-)

 

Hi Tony,

 

Pleased you got your problem fixed. As to update requests, as I say in the readme, I'm always open to suggestions - it was a suggestion by another forum user to write this whole contribution in the first place!

 

 

1, Is there any way of pulling the POD image from the Royal Mail website if its available?

 

To clarify this, are you saying instead of a link to the POD page that's currently displayed within the returned data, you want the POD image to appear in the box that appears?

 

2, I use a builk invoicing tool to print my orders (and also my proof of postage), is there any way of bulk updating the order tracking ID's?

I have idea's on how it could be done, just no idea how to actually do it.

 

Can you elaborate on your bulk invoicing? Do you have a contribution that allows you to update multiple orders on one page and want the tracking element adding to this page?

 

Sorry to sound thick - brain sluggish tonight!

 

Cheers

 

Chris

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

Link to comment
Share on other sites

To clarify this, are you saying instead of a link to the POD page that's currently displayed within the returned data, you want the POD image to appear in the box that appears?
Yes please, if its possible.
Can you elaborate on your bulk invoicing? Do you have a contribution that allows you to update multiple orders on one page and want the tracking element adding to this page?
I have a contribution (http://addons.oscommerce.com/info/3155) that gives me a tick box in the list in orders.php so I can click which orders I am shipping and then just click print invoice at the bottom. This then gives a pop-up with all my selected invoices with CSS to pagebreak it. It has the additional option to update the status of the orders (usually to Dispatched).

 

Tracking_1-orders-php.jpg

 

I further hacked it to give me an option of two different invoices (one is the proof of postage slip which just displays the oID and delivery address in a list without the page breaks)

 

Tracking_2-POP.jpg

 

I assume that it just sends an array of the oID's to the invoice processor to display the list. Wouldn't know the code to do it but i guess ideally (for me) it would just display the order info (oID and Customer Name), input box for the tracking id, and then a drop down list for the courier - something like this ....

Tracking_3-bulkupdatemock.jpg

 

I can send a copy of the Proof of Postage slip invoice file if you need one.

Sorry to sound thick - brain sluggish tonight!
Not sounding think at all and based on the module you are anything but ;-) its probably more to do with my failure to elaborate and explain what I meant earlier.

 

Tony

Link to comment
Share on other sites

Hi

 

I try to develop a swisspost module (I changed the parceline add-on). I think I changed all the required things, but i get following error:

 

"The Swisspost Consignment Number you have supplied is not valid. Please check and try again. The required format is 18 digits, e.g. 123456789012345678. Do not use spaces."

 

the Parcel number in Switzerland looks like this 990089520003045034

 

 

Swisspost tracking ID validation REGEXP

/^d{18}$/

 

Swisspost Tracking ID length

18

 

 

Can anyone help me?

 

Thanks

Rolf

Link to comment
Share on other sites

the Parcel number in Switzerland looks like this 990089520003045034

Swisspost tracking ID validation REGEXP

/^d{18}$/

 

Hi Rolf,

 

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

 

I must confess that I discovered yesterday a slight problem with storing the regexp in the MySQL database.

 

If you try disabling and then re-enabling a tracking module, the oscommerce string functions strip out the \, invalidating the regexp, when the update is applied. This may have happened in your case.

 

A temporary fix to repair the regexp is to uninstall and reinstall the module.

 

I am working on a permanent fix where a backslash is represented by a ~ and is replaced by the tracking class. I thought I had accounted for the backslash issue; I knew storing the regexp in the db would be a problem .... :angry:

 

This fix will be a one line change to the tracking class but will need each module having its regexp manually changed from within admin.

 

HTH

 

Regards

 

Chris

 

PS the code SP is yours

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

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