Jump to content
Sign in to follow this  
Java Roasters

[contribution] Package Tracking for Canada Post

Recommended Posts

Hey Pete

 

I'm not sure if you are still checking this or not, but I was wondering if there is a way that we can add the "tracking" thing into the admin side. I know that the clients get the number, but I'm lazy & I hate having to enter the information 2 or 3 times....

 

Thanks man!


Joel Gallant

Share this post


Link to post
Share on other sites

Hi Fireman,

 

Belated Happy B-Day :thumbsup:

 

Are you wanting to have a button in the Admin that you can click and it will pull up the Canada Post package tracking information for each order?

 

Peter

Share this post


Link to post
Share on other sites

hi guys im a newbie to oscommerce. can anyone help with this error I get this whenever i look at any order (note these are orders before I installed this cp tracking mod.)

 

1054 - Unknown column 'CP_track_num' in 'field list'

 

select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, CP_track_num, date_purchased, orders_status, last_modified from orders where orders_id = '4'

 

[TEP STOP]

Share this post


Link to post
Share on other sites
How did you fix your "pushed to one side problem"...mine is the same...

 

Find the following in tracking.php

 

<!-- body //-->

<table border="0" width="760" cellspacing="0" cellpadding="0" align="center">

<tr>

<!-- body_text //-->

 

 

Replace With:

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

Share this post


Link to post
Share on other sites
Got another problem. In the account_history_info.php I can see the button to push but its not doing anything. Any ideas?

 

I am having the same problem. Is there a fix for this?

Share this post


Link to post
Share on other sites

Not sure if this thread is still active, but I have uploaded an update to your awesome contrib. It fixes the "comment" showing in admin\orders.php, and account_history_info.php. Needed HTML comments instead of PHP code. Also a small type-o in catalog/account_history_info.php:

if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_BOXES . 'downloads.php');

should have remained as in original code:

if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php');

 

Hope this helps someone.

Package Tracking for Canada Post

Edited by mvpdigital

Share this post


Link to post
Share on other sites
Not sure if this thread is still active, but I have uploaded an update to your awesome contrib. It fixes the "comment" showing in admin\orders.php, and account_history_info.php. Needed HTML comments instead of PHP code. Also a small type-o in catalog/account_history_info.php:

if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_BOXES . 'downloads.php');

should have remained as in original code:

if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php');

 

Hope this helps someone.

Package Tracking for Canada Post

Hi,

 

I was wondering where did you get this zisa_popup.js file?! It's not included in the package, and I wasnt able to find it anywhere?!

Thank you.

Share this post


Link to post
Share on other sites
Hi,

 

I was wondering where did you get this zisa_popup.js file?! It's not included in the package, and I wasnt able to find it anywhere?!

Thank you.

 

The script and it's implementation are detailed in the readme file.

Share this post


Link to post
Share on other sites

Hi,

Please could I get some help/advice!!!!

 

I have just finished adding this (Java Roasters') contribution to a cart I am testing and I am a little confused about -

 

1. How and Where I actually get the CP Tracking number

2. There is no "Shipped" status selectable on the ../catalog/admin/orders.php page when I go to revise the Admin/Customers/Orders page - I have reviewed the changes and see no reference to this there :'(

 

I have the CP account on the CP admin site set to "TEST" as I did not want to place any false orders could this have anything to do with 1.

Share this post


Link to post
Share on other sites

Using 2.2 RC1.

 

When I installed I try modify orders from the admin site, I get an Redirect Loop error from Firefox, and IE7 just keeps on trying to load the page. Has anyone else experienced this?

 

Regards

Share this post


Link to post
Share on other sites

Canada Post has changed things recently. Please note the changes in the form submission compared to the current release of this module.

Assuming personal tracking, english page.

 

<form method="post" action="http://www.canadapost.ca/cpotools/apps/track/personal/findByTrackNumber" target="_blank">
<input type="text" name="trackingNumber" value="<?php echo $track_num; ?>">
<input type="hidden" name="LOCALE" value="en">
<input type="submit" value="<?php echo TEXT_BUTTON_CANADAPOST; ?>">
</form>

 

This took a long time searching on the web, phoning Canada Post repeatedly trying vainly to find someone who knew wtf a form api was. Someone eventually came through with the goods.

 

My gift to you.

 

PG


This email is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Share this post


Link to post
Share on other sites

As stated, Canada Post has changed the way they handle the Tracking Form info.

 

This fix allows customers to check their tracking as in the past. When they receive their status update emails, the Tracking link will take them to their Account History page for that order, where their Order Tracking Number will be auto input. They just hit "Track Package", and they will go directly to the Canada Post Track history for their order.

 

Open- account_history _info.php

 

Either Comment out, or Change :

 

<form name="basicPinForm" method="post" action="https://obc.canadapost.ca/emo/basicPin.do" target="_blank">
<input type="hidden" name="trackingId">
<input type="hidden" name="trackingCode">
<input type="hidden" name="action" value="query">
<input type="hidden" name="fromPage" value="basicPin">
<input type="text" name="temp_trkid1" maxlength="35" size="25" value="<?php echo $order->info['CP_track_num']; ?>">
<input type="button" value="<?php echo TEXT_BUTTON_CANADAPOST; ?>" onclick="submitPIN('basicPinForm');">
</form>

 

 

To:

 

<form method="post" name="basicPinForm" action="https://www.canadapost.ca/cpotools/apps/track/business/findByTrackNumber" target="_blank">
<input type="text" name="trackingNumber" maxlength="35" size="25" value="<?php echo $order->info['CP_track_num']; ?>">
<input type="hidden" name="LOCALE" value="en">
<input type="submit" value="<?php echo TEXT_BUTTON_CANADAPOST; ?>">				
</form>

 

-----

My example uses https and Canada Post's business site.

For non secure, and CP's personal site, substitute this for the first line:

 

<form method="post" name="basicPinForm" action="http://www.canadapost.ca/cpotools/apps/track/personal/findByTrackNumber" target="_blank">

 

----

 

Hope this helps.

 

Cheers!

Edited by mvpdigital

Share this post


Link to post
Share on other sites
Using 2.2 RC1.

 

When I installed I try modify orders from the admin site, I get an Redirect Loop error from Firefox, and IE7 just keeps on trying to load the page. Has anyone else experienced this?

 

Regards

 

I have the same issue. The stock orders.php and html_output.php files in the admin folder are slightly different then what the readme indicates. I'm pretty sure this is what is causing the issue. I'm replying from work so I don't have access to the files to post the differences.

 

When I installed as per the instructions the orders page in admin content wouldn't load and on the catalog side it broke the connection to Canada post.

 

I have osCommerce Online Merchant v2.2 Release Candidate 2a.

Share this post


Link to post
Share on other sites

This is a great contrib and I appreciate the update. It works like a charm except for one problem...

 

It was fairly straightforward to install, even for a code breaker like me, but I seem to have screwed something up. Sending order update emails no longer works. I get a message that the order has been successfully updated, but no email is sent. All other email functions are still working, including the automatically generated order confirmation email. In every other regard, the contrib works and the updated information shows up in 'My Account', including the tracking link and number (love the autofill feature, by the way- congrats James!)

 

In addition to being able to keep customers informed of their order status, I naturally want to use this function in order to let them know that they can now easily track their shipment. It's a bit frustrating and any help would be gratefully appreciated.

Share this post


Link to post
Share on other sites

HI there,

I have downloaded the canada post trackig packeage.. and i've opened my account history info page.. but i don't see any of the lines you asked to change..

could you please help?

here is the output in my account history info page..

<?php

/*

$Id: account_history_info.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) {

tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));

}

 

$customer_info_query = tep_db_query("select o.customers_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s where o.orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1'");

$customer_info = tep_db_fetch_array($customer_info_query);

if ($customer_info['customers_id'] != $customer_id) {

tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));

}

 

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

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));

$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));

$breadcrumb->add(sprintf(NAVBAR_TITLE_3, $HTTP_GET_VARS['order_id']), tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $HTTP_GET_VARS['order_id'], 'SSL'));

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order($HTTP_GET_VARS['order_id']);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

 

<body>

<table width="100%" cellspacing="0" cellpadding="0">

<tr>

<td align="center" valign="top"><table width="1002" cellspacing="0" cellpadding="0">

 

<tr>

<td align="center" valign="top"><?php require(DIR_WS_INCLUDES . 'header.php'); ?>

</td>

</tr>

<tr>

<td align="left" valign="top" class="middle_color"><table width="100%" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="205" align="left" valign="top">

 

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

</td>

<td align="left" valign="top" class="td_">

<!-- Middle Section -->

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php // echo tep_image(DIR_WS_IMAGES . 'table_background_history.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td>

<table width="100%" border="0" cellspacing="10" cellpadding="0" class="account_table_border">

<tr>

<td><p><strong><?php echo sprintf(HEADING_ORDER_NUMBER, $HTTP_GET_VARS['order_id']) . ' <small>(' . $order->info['orders_status'] . ')</small>'; ?>

</strong><br /><br />

 

</p>

<p><strong><?php echo HEADING_ORDER_DATE . ' ' . tep_date_long($order->info['date_purchased']); ?></strong><br />

<br />

</p>

<p><strong> Order Total: <?php echo $order->info['total'];?> </strong></p></td>

</tr>

 

</table>

 

</td>

</tr>

<tr><td> </td></tr>

<tr>

<td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="2" class="account_table_border">

<tr>

<td colspan="3"><h3>Products</h3></td>

</tr>

<tr class="infoBoxContents">

<?php

if ($order->delivery != false) {

?>

 

<?php

}

?>

<td width="<?php echo (($order->delivery != false) ? '70%' : '100%'); ?>" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

if (sizeof($order->info['tax_groups']) > 1) {

?>

<tr>

<td width="24%">Product Image </td>

<td width="26%" class="main"><b><?php echo HEADING_PRODUCTS; ?></b></td>

<td width="27%" align="right" class="smallText"><b><?php echo HEADING_TAX; ?></b></td>

<td width="23%" align="right" class="smallText"><b><?php echo HEADING_TOTAL; ?></b></td>

</tr>

<?php

} else {

?>

<tr>

<td class="main" colspan="3"><b><?php echo HEADING_PRODUCTS; ?></b></td>

</tr>

<?php

}

 

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

// echo "select products_image from products where products_id='".$order->products[$i]['id']."'";

$image=tep_db_fetch_array(tep_db_query("select products_image from products where products_id='".$order->products[$i]['id']."'"));

 

echo ' <tr> <td><img src="images/'.$image['products_image'].'" width="60" height="48" /></td> ' . "\n" .

' <td class="main" align="left" valign="top">' . $order->products[$i]['qty'] . ' x' . "\n" .

' ' . $order->products[$i]['name'];

 

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

// echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

}

}

 

echo '</td>' . "\n";

 

if (sizeof($order->info['tax_groups']) > 1) {

echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";

}

 

echo ' <td class="main" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td align="left" valign="top"><table width="100%" border="0" cellspacing="10" cellpadding="0" class="account_table_border">

<tr>

<td colspan="3"><h3>Total Info</h3></td>

</tr>

 

 

<?php

for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {

echo ' <tr>' . "\n" .

' <td width="50%">' . $order->totals[$i]['title'] . '</td>' . "\n" .

' <td class="main" align="right" width="50%">' . $order->totals[$i]['text'] . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

 

</table></td></tr>

<tr>

<td class="main"><b><?php // echo HEADING_BILLING_INFORMATION; ?></b></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox1">

<tr class="infoBoxContents">

<td width="40%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo HEADING_BILLING_ADDRESS; ?></b></td>

</tr>

<tr>

<td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo HEADING_PAYMENT_METHOD; ?></b></td>

</tr>

<tr>

<td class="main"><?php echo $order->info['payment_method']; ?></td>

</tr>

</table></td>

<?php

if ($order->delivery != false) {

?>

<td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo HEADING_DELIVERY_ADDRESS; ?></b></td>

</tr>

<tr>

<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

</tr>

<?php

if (tep_not_null($order->info['shipping_method'])) {

?>

<tr>

<td class="main"><b><?php echo HEADING_SHIPPING_METHOD; ?></b></td>

</tr>

<tr>

<td class="main"><?php echo $order->info['shipping_method']; ?></td>

</tr>

<?php

}

?>

</table></td>

<?php

}

?>

 

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

 

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="account_table_border">

<tr>

<td class="main"><h3><?php echo HEADING_ORDER_HISTORY; ?></h3></td>

</tr>

<tr class="infoBoxContents">

<td valign="top" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="2">

 

<?php

$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 . "' and os.public_flag = '1' order by osh.date_added");

while ($statuses = tep_db_fetch_array($statuses_query)) {

echo ' <tr>' . "\n" .

' <td class="main" valign="top">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" .

' <td class="main" valign="top">' . $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";

}

?>

</table></td>

</tr>

</table></td>

</tr>

<?php

if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php');

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox1">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, tep_get_all_get_params(array('order_id')), 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

 

 

<!-- Middle Section end -->

</td>

<td align="left" valign="top" width="210" class="right_side"><?php require(DIR_WS_INCLUDES . 'column_right.php'); ?></td>

</tr>

 

<tr>

<td> </td>

<td align="left" valign="top"> </td>

</tr>

</table></td>

</tr>

<tr>

<td align="center" valign="top">

 

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

</td>

</tr>

</table></td>

</tr>

</table>

 

 

<map name="Map" id="Map"><area shape="rect" coords="3,3,76,33" href="#" /><area shape="rect" coords="89,7,226,30" href="#" /><area shape="rect" coords="236,5,329,31" href="#" /><area shape="rect" coords="346,4,371,32" href="#" /></map></body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

Hi I have an unusual problem with the canadapost.php service.

 

The site is in Canada. US Customers are not seeing the 'Expedited Parcel US' shipping option.

 

My request is valid. My response is valid. I get xpresspost. But I dont get Expedited Parcel - USA.

 

Is anyone else with US shipments from Canadian websites - using canadapost shipping quotes - for US based customers?

 

Gotta put it out there, maybe someone else may have this problem, or know why it is happening. I have emails in to Canada post and to the creators to the module. Anybody know why this is going on?


This email is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Share this post


Link to post
Share on other sites
My request is valid. My response is valid. I get xpresspost. But I dont get Expedited Parcel - USA

 

I'm having the same problem... Was there a resolution?

 

Thank you in advance.

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
Sign in to follow this  

×