chris23 Posted June 16, 2007 Share Posted June 16, 2007 Support forum for Royal Mail Track and Trace™ - AJAX v1.0 This contribution allows you to easily assign a Royal Mail Track and Trace™ ID to an order via the order admin page. This will do two things: 1. Add a hyperlink to the customers status e-mail allowing them to quickly look up their delivery status on Royal Mail's website. 2. Adds the Royal Mail Track and Trace™ ID to the customer's order history page and the admin order history. Clicking on the Royal Mail Track and Trace™ ID in either the admin order processing page or the customer's order history page will dynamically load the current status of the parcel form Royal Mail using AJAX. All this is done in the background, without a page refresh and without your customer / the order processor leaving the site. Where appropriate, the customer will be offered a hyperlink to view the items Proof of Delivery (POD). Royal Mail PODs consist of a scanned image of the recipient's signature to confirm delivery. Users having JavaScript disabled will be offered an alternative link to Royal Mail's website, bypassing the AJAX function. Download: http://www.oscommerce.com/community/contributions,5216 Quote 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 More sharing options...
chris23 Posted June 17, 2007 Author Share Posted June 17, 2007 Updated version - Fixed JavaScript <div> display bug in IE6. - Added better cURL error handling if problem communicating with Royal Mail's server. - If anyone has 1.0 installed, please PM me via forum for upgrade instructions. Quote 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 More sharing options...
FOD Posted June 19, 2007 Share Posted June 19, 2007 Hi just wondering whether there was a missing </td> in account_history_info.php around line 228 in my version Your code was: ' <td class="main" valign="top">' . (empty($statuses['rm_tracking_id']) ? ' ' : '<a title="' . RM_LINK_TITLE . '" href="java script:void(0);" onclick="ajaxFunction(\'text_box\',\'' . $statuses['rm_tracking_id'] . '\');">' . $statuses['rm_tracking_id'] . '</a> ' . RM_LINK_LABEL) . "\n" . ' </tr>' . "\n"; maybe should be: ' <td class="main" valign="top">' . (empty($statuses['rm_tracking_id']) ? ' ' : '<a title="' . RM_LINK_TITLE . '" href="java script:void(0);" onclick="ajaxFunction(\'text_box\',\'' . $statuses['rm_tracking_id'] . '\');">' . $statuses['rm_tracking_id'] . '</a> ' . RM_LINK_LABEL) . '</td>' . "\n" . ' </tr>' . "\n"; Could be wrong. Apart from that excellent contribution. Nice One!!!! Quote You can kill the King, but you can't kill the King Riddim... Link to comment Share on other sites More sharing options...
chris23 Posted June 19, 2007 Author Share Posted June 19, 2007 (edited) Hi just wondering whether there was a missing </td> in account_history_info.php around line 228 in my version Hi there, You're not wrong and thanks for pointing it out! The missing closing </td> doesn't break the layout on my test site so I missed it. Will correct it and add to next update. Pleased you like the contrib. Edited June 19, 2007 by chris23 Quote 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 More sharing options...
thewrath1 Posted July 5, 2007 Share Posted July 5, 2007 Hi Chris, Excellent contribution. Hope you can help me convert this! I have been attempting to convert it for Parcelforce, done 95% of the work, but without any luck with the captured text being displayed however. The contrib is working fine, spinning please wait, but no result being shown, so I am lost where to look now. The tracking ID for Parcelforce is only 2 letters, 7 digits, no GB required. And not being a coder, I'm assuming this is valid below? // added rm_track_trace $rm_tracking_id = tep_db_prepare_input($HTTP_POST_VARS['tracking_id']); $rm_tracking_id = strtoupper($rm_tracking_id); // now check given id is in correct format i.e. AB1234567 if(!empty($rm_tracking_id)){ if(!preg_match("/^\D{2}\d{7}/", $rm_tracking_id, $trash)){ $messageStack->add_session(INVALID_RMTT_ID, 'warning'); $id_failed = true; } } // end added rm_track_trace Also, I believe these are the correct div's that Ajax requires for Parcelforce? // set html start and end grab $StartGrab = '<div class="POLarger">'; $EndGrab = '<div class="Footer-Region">'; The Parcelforce URL's seem to be identical, but not sure 100% on this. But I have replaced all url 'royalmail' references with 'parcelforce' and url's with '/rm/' with '/pw/' Even the Help link is identical and works! (same company). I have noticed a small differece on Parcelforce compared to RM url's, that may be worth noting, but may not be any help. http://www.parcelforce.com/portal/pw/track? http://www.royalmail.com/portal/rm/trackresults? For extra help: Here are also 2 working tracking ids for Parcelforce/Royalmail if required. -------------------------------------------------------- valid parcelforce track trace id: IP1540982 valid royalmail track trace id: DK841795072GB Below is the Altered install file I done so far, I can send the catalog/rm_track_trace.php if required. The sql I just changed to VARCHAR( 9 ). ========================================================================== ========================================================================== 1. Run rm_track_trace.sql ** this is not optional! ** 2. Upload new files: catalog/rm_track_trace.php catalog/images/ajax_wait.gif 3. Modify the following files: ----------------------------- i) catalog/stylesheet.css at the end of the file ADD (style as you wish): .rm_div { background-color: #f3f3f3; border: solid 2px #e5e5e5; padding: 10px; font-size: 10px; margin: 10px 0 0 0; width: 50%; font-family: Verdana, Arial, sans-serif; } .hiddenDiv { visibility: hidden; } ----------------------------- ii) catalog/includes/general.js at the end of the file ADD: /* rm_track_trace ajax v1.0 2007/06/16 clefty Provides a set of additional site features using an AJAX / PHP framework. This instance provides Parcelforce Track & Trace functionality */ // Test for browser support and create ajaxRequest object function ajaxFunction(div_id,id){ var elemId = document.getElementById(div_id); var ajaxRequest; // Instantiate ajaxRequest object var myRand = parseInt(Math.random()*999999999999999); // fix ie6 cache issues try{ // Opera 8.0+, Firefox, Safari, IE7, Konqueror ajaxRequest = new XMLHttpRequest(); } catch (e){ // IE 6 try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Error or unsupported browser. alert("Unsupported browser or error"); return false; } } } // Function to receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ if(ajaxRequest.status == 200 || ajaxRequest.status == 301 || ajaxRequest.status == 302){ // rm use multiple redirects elemId.className="rm_div"; elemId.innerHTML=ajaxRequest.responseText+'<br /><a href="java script:void(0)" onclick="this.parentNode.className=\'hiddenDiv\'">[x] Close</a>'; } else{ elemId.className="rm_div"; elemId.innerHTML='Error communicating with Parcelforce\'s server. Please try later.<br /><a href="java script:void(0)" onclick="this.parentNode.className=\'hiddenDiv\'">[x] Close</a>'; } } else{ elemId.className="rm_div"; elemId.innerHTML= '<img src="images/ajax_wait.gif" height="16" width="16" border="0" alt="Please wait" /><br />Contacting Parcelforce ... Please wait'; // load animated "waiting" gif } } ajaxRequest.open("GET", "rm_track_trace.php?tracking_id="+id+"&iecache="+myRand, true); ajaxRequest.send(null); } ----------------------------- iii) catalog/account_history_info.php AFTER: <link rel="stylesheet" type="text/css" href="stylesheet.css"> ADD: <script language="javascript" src="includes/general.js"></script> FIND: $statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' order by osh.date_added"); REPLACE WITH: $statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments, osh.rm_tracking_id from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' order by osh.date_added"); FIND: while ($statuses = tep_db_fetch_array($statuses_query)) { echo ' <tr>' . "\n" . ' <td class="main" valign="top" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" . ' <td class="main" valign="top" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" . ' <td class="main" valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" . ' </tr>' . "\n"; } REPLACE WITH: while ($statuses = tep_db_fetch_array($statuses_query)) { echo ' <tr>' . "\n" . ' <td class="main" valign="top" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" . ' <td class="main" valign="top" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" . ' <td class="main" valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" . ' <td class="main" valign="top">' . (empty($statuses['rm_tracking_id']) ? ' ' : '<a title="' . RM_LINK_TITLE . '" href="java script:void(0);" onclick="ajaxFunction(\'text_box\',\'' . $statuses['rm_tracking_id'] . '\');">' . $statuses['rm_tracking_id'] . '</a> ' . RM_LINK_LABEL) . "\n" . ' </tr>' . "\n"; } AFTER (line 223): ?> </table></td> </tr> </table> ADD: <div id="text_box" style="margin: 10px 0 0 0"><noscript> <div class="messageStackError"><?php echo RM_NO_JS_ALTERNATIVE; ?></div> </noscript></div> AFTER: <script language="javascript" src="includes/general.js"></script> ADD: <script language="JavaScript" type="text/javascript"> <!-- // added rm_track_trace pic1= new Image(16,16); pic1.src="images/ajax_wait.gif"; //--> </script> ----------------------------- iv) catalog/includes/languages/english/account_history_info.php BEFORE closing ?> ADD: // rm_track_trace define('RM_LINK_TITLE','Click to load this order\'s Parcelforce Track & Trace™ tracking status'); define('RM_NO_JS_ALTERNATIVE','You appear to have JavaScript disabled. It is therefore not possible to automatically load the Parcelforce Track & Trace™ status.<br />Please use the link below to be redirected to Parcelforce\'s website where you can view the tracking status by manually entering the Tracking ID:<br /><a target="_blank" href="http://www.parcelforce.com/portal/pw/track">http://www.parcelforce.com/portal/pw/track</a>'); define('RM_LINK_LABEL',' [ Your Parcelforce Track & Trace™ tracking ID - click ID for full status ]'); ----------------------------- v) catalog/admin/includes/languages/english/orders.php BEFORE closing ?> ADD: // added rm_track_trace define('TABLE_HEADING_RM_TT', 'Parcelforce Track & Trace™ ID<br />[Click ID to view status]'); define('INVALID_RMTT_ID','The Parcelforce Track & Trace™ ID you have supplied is not valid. Please check and try again. The required format is 2 letters, 7 digits eg AB1234567. Do not use spaces.'); define('RM_ADMIN_LINK_TITLE','Click to load item\'s current status from Parcelforce'); define('EMAIL_RM_NOTIFICATION','If you would like to track your parcel online using Parcelforce\'s Track & Trace™ 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('RM_HEADING','Add Parcelforce Trace & Trace™ Data (<em>if</em> applicable to this order)<p class="smallText">Please enter your 9 digit Track & Trace™ ID for this order. Do not use spaces. The format is two letters, followed by 7 digits, eg <span style="color: red">AB1234567</span></p>'); define('RM_NO_JS_ALTERNATIVE','You appear to have JavaScript disabled. It is therefore not possible to automatically load the Parcelforce Track & Trace™ status.<br />Please use the link below to be redirected to Parcelforce\'s website where you can view the tracking status by manually entering the Tracking ID:<br /><a target="_blank" href="http://www.parcelforce.com/portal/pw/track">http://www.parcelforce.com/portal/pw/track</a>'); define('RM_TRACK_IMAGE_URL',' (<a href="http://www.parcelforce.com/portal/pw/content2?catId=400145&mediaId=15400472" target="_blank">Need help?</a>)'); ----------------------------- vi) catalog/admin/includes/stylesheet.css at the end of the file ADD (style as you wish): .rm_div { background-color: #f3f3f3; border: solid 2px #e5e5e5; padding: 10px; font-size: 10px; margin: 10px 0 0 0; width: 50%; font-family: Verdana, Arial, sans-serif; } .hiddenDiv { visibility: hidden; } ----------------------------- vii) catalog/admin/includes/general.js at the end of the file ADD (NB THIS JS CODE IS ** NOT ** THE SAME AS catalog/includes/general.js !!!!!) /* rm_track_trace ajax v1.0 2007/06/16 clefty Provides a set of additional site features using an AJAX / PHP framework. This instance provides Parcelforce Track & Trace functionality */ // Test for browser support and create ajaxRequest object function ajaxFunction(div_id,id){ var elemId = document.getElementById(div_id); var ajaxRequest; // Instantiate ajaxRequest object var myRand = parseInt(Math.random()*999999999999999); // fix ie6 cache issues try{ // Opera 8.0+, Firefox, Safari, IE7, Konqueror ajaxRequest = new XMLHttpRequest(); } catch (e){ // IE 6 try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Error or unsupported browser. alert("Unsupported browser or error"); return false; } } } // Function to receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ if(ajaxRequest.status == 200 || ajaxRequest.status == 301 || ajaxRequest.status == 302){ // rm use multiple redirects elemId.className="rm_div"; elemId.innerHTML=ajaxRequest.responseText+'<br /><a href="java script:void(0)" onclick="this.parentNode.className=\'hiddenDiv\'">[x] Close</a>'; } else{ elemId.className="rm_div"; elemId.innerHTML='Error communicating with Parcelforce\'s server. Please try later.<br /><a href="java script:void(0)" onclick="this.parentNode.className=\'hiddenDiv\'">[x] Close</a>'; } } else{ elemId.className="rm_div"; elemId.innerHTML= '<img src="../images/ajax_wait.gif" height="16" width="16" border="0" alt="Please wait" /><br />Contacting Parcelforce ... Please wait'; // load animated "waiting" gif } } ajaxRequest.open("GET", "../pw_track_trace.php?tracking_id="+id+"&iecache="+myRand, true); ajaxRequest.send(null); } ----------------------------- viii) catalog/admin/orders.php AFTER: $currencies = new currencies(); ADD: $rm_get_receiver_url = "http://www.parcelforce.com/portal/pw/track?trackNumber="; // added rm_track_trace AFTER: $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); ADD: // added rm_track_trace $rm_tracking_id = tep_db_prepare_input($HTTP_POST_VARS['tracking_id']); $rm_tracking_id = strtoupper($rm_tracking_id); // now check given id is in correct format i.e. AB123456789GB if(!empty($rm_tracking_id)){ if(!preg_match("/^\D{2}\d{7}/", $rm_tracking_id, $trash)){ $messageStack->add_session(INVALID_RMTT_ID, 'warning'); $id_failed = true; } } // end added rm_track_trace FIND: if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) { REPLACE WITH: if ( (($check_status['orders_status'] != $status) || tep_not_null($comments) || tep_not_null($rm_tracking_id)) && $id_failed == false ) { AFTER: $notify_comments = ''; ADD: $notify_rm = !empty($rm_tracking_id) ? EMAIL_RM_NOTIFICATION . "\n\n" . $rm_get_receiver_url . $rm_tracking_id . "\n\n" : ""; // added rm_track_trace FIND: $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]); REPLACE WITH: $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]) ."\n" . $notify_rm; // added rm_track_trace FIND: tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); REPLACE WITH: tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments, rm_tracking_id) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "', '" . tep_db_input($rm_tracking_id) . "')"); AFTER: <script language="javascript" src="includes/general.js"></script> ADD: <script language="JavaScript" type="text/javascript"> <!-- // added rm_track_trace pic1= new Image(16,16); pic1.src="../images/ajax_wait.gif"; //--> </script> FIND: $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added"); REPLACE WITH: $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments, rm_tracking_id from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added"); FIND: echo ' <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" . ' <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" . ' </tr>' . "\n"; REPLACE WITH: echo ' <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" . ' <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" . ' <td class="smallText"><a title="' . RM_ADMIN_LINK_TITLE . '" href="java script:void(0);" onclick="ajaxFunction(\'text_box\',\'' . $orders_history['rm_tracking_id'] . '\');">' . $orders_history['rm_tracking_id'] . '</a> </td>' . "\n" . ' </tr>' . "\n"; AFTER (around line 313) ?> </table> ADD: <div id="text_box" class="smallText" style="margin: 10px 0 0 0"><noscript> <div class="messageStackError"><?php echo RM_NO_JS_ALTERNATIVE; ?></div> </noscript></div> AFTER: <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> </tr> ADD: <tr> <td class="main"><br><b><?php echo RM_HEADING; ?></b></td> </tr> <tr> <td class="main"><?php echo tep_draw_input_field('tracking_id', '','maxlength="9"') . RM_TRACK_IMAGE_URL; ?></td> </tr> ** END install.txt ** Quote Q/ How many therapist's does it take to change a lightbulb? A/ Two. But the lightbulb has to really 'want' to change. Link to comment Share on other sites More sharing options...
chris23 Posted July 5, 2007 Author Share Posted July 5, 2007 Hi Gaz, Thanks for the post. You've made a pretty good fist of adapting the code. You've changed the regular expression that checks for a valid ID correctly and the sql modification is fine Also, I believe these are the correct div's that Ajax requires for Parcelforce? // set html start and end grab $StartGrab = '<div class="POLarger">'; $EndGrab = '<div class="Footer-Region">'; This I will need to check - I've got a debug version of rm_track_trace.php that I can use to see if these are the correct start and end points for the screen grab. Bear with me a few days, just back from 2 weeks hols today so I'm pretty backed up! As to your blank screen, I suspect you've stumbled on two issues: i) finding the correct url ii) accounting for the cURL redirects royal mail / parcelforce put you through. cURL has a really neat feature that will automatically follow all reasonable redirects sent by the server, BUT unfortunately this is disabled on nearly all shared servers. The rm_track_trace.php manually copes with the 2 redirects used by royalmail.com. Parcelforce may be using a different number of redirects so rm_track_trace.php will need modifying to cope with them. Again, leave this with me. Your provided PF tracking ID is all I need to sort this. Thanks for the upgrade instructions - much appreciated. If I can get Parcelforce to play, I will eventually bundle it up as a parcelforce contribution. I may modify some of the constants and other code to allow the use of both contributions concurrently. I did originally consider coding both RM and Parcelforce in the one contribution, but this would make maintaining the code messy, especially if RM / Parcelforce started messing with their sites independently. Kind regards, Chris Quote 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 More sharing options...
thewrath1 Posted July 5, 2007 Share Posted July 5, 2007 Thanks for the upgrade instructions - much appreciated. If I can get Parcelforce to play, I will eventually bundle it up as a parcelforce contribution. Excellent!!! Hi Chris, Nice to see my stabbing in the dark hasn't been fruitless! I agree a double-whammy contrib would be messy and dangerous to maintain for the future. If I can help in any way making things work, let me know. I await your expert results for the Parcelforce Ajax! There are so many people using Parcelforce, it will be very useful and popular I'm sure. I tapped down the grab sections with FireBug as best I could, but I'm really out of my depth to debug from there on to get it to play. I didn't want to tread on your toes with the code, so I left all the rm refs for the variables, tho tempted to make them all pw. :thumbsup: thanks for the reply so soon, I await your response. Quote Q/ How many therapist's does it take to change a lightbulb? A/ Two. But the lightbulb has to really 'want' to change. Link to comment Share on other sites More sharing options...
chris23 Posted July 10, 2007 Author Share Posted July 10, 2007 I have uploaded a modification of this contribution today - Parcelforce Track & Trace: http://www.oscommerce.com/community/contributions,5282 I'll be supporting both contributions on this forum due to the high degree of commonality between the two codebases. Contrib details: Provides identical functionality to Royal Mail Track and Trace for store owners using Parcelforce. Quote 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 More sharing options...
Monteverde Posted July 11, 2007 Share Posted July 11, 2007 I have uploaded a modification of this contribution today - Parcelforce Track & Trace: http://www.oscommerce.com/community/contributions,5282 I'll be supporting both contributions on this forum due to the high degree of commonality between the two codebases. Contrib details: Provides identical functionality to Royal Mail Track and Trace for store owners using Parcelforce. I am just having a look at you contribution and I may say... it is great. I can't test it properly now because my site is not live yet... I am still selling through ebay at the moment. One question, though: I usually buy the shipping service (DHL or Parceline) from guys who have a contract and have great discounts... I am still a small seller and I dispach only 3 to 5 parcel a day (I send the small packet by RM, cheaper for me). What can you suggest about Parcelforce? I haven't found anyone yet that re-sells at a good price their Parcelforce service. Thanks in advance for your advices, Roberto Quote Link to comment Share on other sites More sharing options...
Monteverde Posted July 11, 2007 Share Posted July 11, 2007 Hi Chris, I installed the RM contribution, really nice but it seems that the link (to check the RM status) on the admin side doesn't work (everything's fine on the customer side). I also looked at the parcelforce contribution and I hoped it was adding up, but it seems it is replacing it :-( Last time I tried to modify myself a contribution I ended up reinstalling everything from scratch ;-) Any idea on how to implement them both? I'd like to use RM for small and light packets and PF for heavier parcels. Thanks again, Roberto Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 11, 2007 Author Share Posted July 11, 2007 Hi Roberto, I installed the RM contribution, really nice but it seems that the link (to check the RM status) on the admin side doesn't work (everything's fine on the customer side). Can you let me know what exactly happens when you click on the Tracking ID within the admin side? Do you get a box appearing or not? I also looked at the parcelforce contribution and I hoped it was adding up, but it seems it is replacing it :-( Apologies if I've confused you here. The Parcelforce contribution is NOT replacing the Royal Mail version. I've done the Parcelforce version in conjunction with 'thewrath1' - see previous posts. The RM version continues as before. I'm supporting both contributions via this forum as they share a common (but not identical) codebase. Any idea on how to implement them both? I have thought about it - briefly! I haven't bundled them together for various reasons: i) not everyone uses Royal Mail for small post and Parcelforce for parcels (I don't use Parcelforce at all and won't even be using this pf contrib!) ii) whilst there is a good deal of similarity in the code, Parcelforce and Royal Mail, despite being the same company, implement their systems differently. Combining the code means that if RM make a change to their site independently of PF, the contribution breaks for both That said, it should be possible to get both contributions to work concurrently. As the PF contribution only went up last night, I was waiting to gauge the demand for running both together before coming up a "howto" Regards, Chris Quote 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 More sharing options...
♥stubbsy Posted July 12, 2007 Share Posted July 12, 2007 Hi Chris, I like the sound of this and I have a question before I try an install. Basically I wondered how the tracking numbers were entered against each order? Is it a manual job after you run the end of day to go and physically type each tracking number against each order, or is there another method? I'm interested in this and also if you have integrated parcelforce with oscommerce in any other way? I've gone a little way into streamlining the order import process into parcelforce and wondered if you have made any inroads into this? Thanks Dave Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 12, 2007 Author Share Posted July 12, 2007 Hi Chris,Basically I wondered how the tracking numbers were entered against each order? Is it a manual job after you run the end of day to go and physically type each tracking number against each order, or is there another method? Hi Dave, Unfortunately the entering of the ID is by manual entry into a form input box on the orders page. The client's site I have it running on is fairly low volume. If you wanted a fully automated process and don't mind spending about 30 quid, you can get a USB barcode reader off eBay. I've had a play with a mate's reader and it does work well. All you do then is what the Post Office do and scan the barcode off the recorded / special docket. With a bit of JavaScript you could get the order form to autosubmit after scanning the ID into the form (for a handsfree operation) Other than that, I can't see how you're going to get the 13 character code into the osc store database Hope this helps, Rgds Chris Quote 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 More sharing options...
♥stubbsy Posted July 13, 2007 Share Posted July 13, 2007 Hi Chris, Thanks for the reply, we do a few too many to have time to put the tracking numbers in by hand. I like the sound of this "All you do then is what the Post Office do and scan the barcode off the recorded / special docket. With a bit of JavaScript you could get the order form to autosubmit after scanning the ID into the form (for a handsfree operation)" £30 for a scanner is not an issue, it would be doing the coding for it that I would struggle with. Anyway, its food for thought! Thanks Dave Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 13, 2007 Author Share Posted July 13, 2007 it would be doing the coding for it that I would struggle with. Dave, A USB scanner is plug and play, so no work involved here. As for the coding, this is pretty straightforward and something that could be done for you as a one off. All you'd have to do is make sure that the very last step on the order processing page was the scanning of the barcode as the act of scanning would both add in the tracking ID and automatically submit the form, completing the process. Hope this makes some sort of sense. If you do go ahead and get a code reader and want a JS snippet, let me know. All the best, Chris Quote 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 More sharing options...
Monteverde Posted July 14, 2007 Share Posted July 14, 2007 Hi Roberto,Can you let me know what exactly happens when you click on the Tracking ID within the admin side? Do you get a box appearing or not? Hi Chris, thanks for your reply. Problem solved. I logged off and logged in again in admin and now it works... To integrate Parcelforce, would it be sufficient repeating the same steps I did for Royal Mail? ...this time I will backup ;-) Thanks again, Roberto Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 14, 2007 Author Share Posted July 14, 2007 To integrate Parcelforce, would it be sufficient repeating the same steps I did for Royal Mail? ...this time I will backup ;-) This won't be enough unfortunately. Some modification will be necessary. For example, when you click on a tracking ID it calls a JavaScript function. This function has the same name in RM and PF so you'll have an error. This is just an example of one issue - there are more! When I get a chance, I will write up a howto. I'll also need to provide a modified AJAX function that will call either rm_track_trace.php or pf.track_trace.php I can do this, but my workload this week is huge so I can't give you a definite timeframe .... sorry Quote 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 More sharing options...
Monteverde Posted July 14, 2007 Share Posted July 14, 2007 This won't be enough unfortunately. Some modification will be necessary. For example, when you click on a tracking ID it calls a JavaScript function. This function has the same name in RM and PF so you'll have an error. This is just an example of one issue - there are more! When I get a chance, I will write up a howto. I'll also need to provide a modified AJAX function that will call either rm_track_trace.php or pf.track_trace.php I can do this, but my workload this week is huge so I can't give you a definite timeframe .... sorry Thanks a lot for your time and support... Roberto Quote Link to comment Share on other sites More sharing options...
yubnub Posted July 20, 2007 Share Posted July 20, 2007 hi, Many thanks for this great contrib, Just wondered if you could help me, When the customer looks at their account history info and clicks on the royal mail track and trace number, the result appears at the bottom of the page on the left hand side - how do i get the result centered? many thanks for the contrib again Quote Link to comment Share on other sites More sharing options...
Get-Wireless 2 Posted August 18, 2007 Share Posted August 18, 2007 (edited) Just like to say thanks for this mod :D just a shame RM is currently down so cant fully test it :( I currently only use Royalmail but I am looking to find a courier aswell as royalmail are becoming expensive on bulky\heavy items. Like £18 to send a £23.50 keyboard and mouse set, Would it be possible to make a mod similar to this for couriers ? Dont know if this is possible but: Say a shop has 3 delivery methods Royalmail Courier 1 Courier 2 Since Osc knows what delivery method has been selected can your mod change to reflect this and ask a tracking number be put in for which ever service was selected by the customer IE Customer A buys a product(s) and selects Rm for delivery the admin get the option to put Rm number in and it links to Rm like it does now. Customer B buys a product(s) but selects Courier 1 or 2 as its cheaper, then in admin we are presented with a box to put in a tracking number for Courier 1 and that will auto goto their website for the details. I know it would be a lot of work as there are so many couriers out there but if its possible just start with the big ones like business post TNT ect ect I also like the Idea of the barcode scanner. Did you make the mod to auto update the order after the tracking Id was scanned in? Edited August 18, 2007 by Get-Wireless 2 Quote Contributions installed so far Discount Coupon Codes Ultimate SEO Urls Star Product Product Description Header template Modern design Search box Add to favorites Discount Plus All Manufacturers Loginbox Best Lightbox V2 Optional Related Products Plus Many more Link to comment Share on other sites More sharing options...
chris23 Posted August 19, 2007 Author Share Posted August 19, 2007 Would it be possible to make a mod similar to this for couriers ?Since Osc knows what delivery method has been selected can your mod change to reflect this and ask a tracking number be put in for which ever service was selected by the customer IE Undoubtedly! However, like you said this would involve a lot of work, depending on the courier. Royal Mail and Parcelforce are actually the hardest as they don't provide any sort of API (it was mostly educated guesses and trail and error that got things working..). The independent couriers tend to be more helpful and offer APIs to connect with their systems. Customer A buys a product(s) and selects Rm for delivery the admin get the option to put Rm number in and it links to Rm like it does now.Customer B buys a product(s) but selects Courier 1 or 2 as its cheaper, then in admin we are presented with a box to put in a tracking number for Courier 1 and that will auto goto their website for the details. This would definitely be the way to proceed. I would need to write an API to allow tracking modules to be written and plugged-in (preferable not by me :-") , much like the credit card modules. This would be a big one-off task and I'd want to gauge the interest before jumping in with this. Judging by the downloads, there hasn't been a huge uptake of the existing Rm & PF modules (not as much as I thought there would be), so I'm wary of committing efforts to say an Amtrak module if only two people are ever going to use it! It might be helpful if people start registering their interest for other couriers on this thread so we can see if there is a demand and which are the most used couriers. I also like the Idea of the barcode scannerDid you make the mod to auto update the order after the tracking Id was scanned in? No I haven't added any code for this, BUT having tried a Metrologic barcode reader again, I discovered that when the RM barcode is scanned, the orders.php form gets autosubmitted anyway. I can't confirm that this is the default behaviour of other readers but the Metrologic one works a charm. HTH Chris Quote 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 More sharing options...
Get-Wireless 2 Posted August 19, 2007 Share Posted August 19, 2007 now that royalmail is working I have been able to test it properly, it works great except I get the following The�electronic�Proof�of�Delivery�may�not�be�available�for�th is�item�yet.�Please�allow�up�to�72�hours�after�delivery�bef ore�checking but its all on one line Is this to do with royalmail or have I done something wrong? Also after clicking on the link (customer side) and then closing the box I am left with a huge space at the top the page unless I refresh it or goto another page, Again is this something I have done wrong? If you wish to see it please goto http://get-wireless.co.uk/dev login is [email protected] testtest and there is an order with a valid RM number This is my test site which is a mirror image of my live site. I too thought there would be more interest in this, Maybe we could promote it bit more. I only came across it by accident was actually looking for a parcelforce shipping mod. This mod will certainly save me a lot of time in the updating of orders, No Longer do I have to manually type in the comments box the customers tracking number and type out the url for royalmail everytime. I just need to get my emails working properly now, I did a test purchase on my website and updated the order but the emails are not been sent in html format the text is there for link to royalmail but its not clickable and I have my email client (outlook) Also the link to the customers account doesnt display the full url it starts from the folder where the my shop is IE. Instead of displaying http://get-wireless.co.uk/dev/account_hist...hp?order_id=159 in the email it displays /dev/account_history_info.php?order_id=159 And I am not sure how to go about fixing this :( Quote Contributions installed so far Discount Coupon Codes Ultimate SEO Urls Star Product Product Description Header template Modern design Search box Add to favorites Discount Plus All Manufacturers Loginbox Best Lightbox V2 Optional Related Products Plus Many more Link to comment Share on other sites More sharing options...
Get-Wireless 2 Posted August 19, 2007 Share Posted August 19, 2007 Have also noticed in the admin orders section my table is a bit wrong looks like this I dont get the table heading and the borders look a bit off Quote Contributions installed so far Discount Coupon Codes Ultimate SEO Urls Star Product Product Description Header template Modern design Search box Add to favorites Discount Plus All Manufacturers Loginbox Best Lightbox V2 Optional Related Products Plus Many more Link to comment Share on other sites More sharing options...
Get-Wireless 2 Posted August 19, 2007 Share Posted August 19, 2007 I have fixed the table thing in admin side, In catalog\admin\orders.php After <td class="smallText" align="center"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td> Add <td class="smallText" align="center"><b><?php echo TABLE_HEADING_RM_TT; ?></b></td> That fixed the table in admin side for me Quote Contributions installed so far Discount Coupon Codes Ultimate SEO Urls Star Product Product Description Header template Modern design Search box Add to favorites Discount Plus All Manufacturers Loginbox Best Lightbox V2 Optional Related Products Plus Many more Link to comment Share on other sites More sharing options...
chris23 Posted August 19, 2007 Author Share Posted August 19, 2007 I have fixed the table thing in admin side, In catalog\admin\orders.php After <td class="smallText" align="center"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td> Add <td class="smallText" align="center"><b><?php echo TABLE_HEADING_RM_TT; ?></b></td> That fixed the table in admin side for me Which is exactly what I have in my orders.php and the orders.php I uploaded - just a pity that I missed this step out of the installation.txt! Good catch and apologies. Will sort this in next upload. Quote 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 More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.