Jump to content
olsonsp4c

Package Tracking with Email Notification Mods

Recommended Posts

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

select customers_name, 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_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, fedex_track_num, ups_track_num, usps_track_num, fedex_freight_track_num, dhl_track_num, currency, currency_value, date_purchased, orders_status, last_modified from orders where orders_id = '134'

 

hi im still having problem with this, and i dont know much about mysql..

 

SELECT * FROM `orders` WHERE 1 insert comments varchar(256) null

 

alter table `orders` insert comments varchar(256) null

 

??? sorry i dont know how! :( can someone teach me?

go to phpmyadmin into table orders and add field comments VARCHAR length 256 Null after cc_expires. if this does not work change type from VAR CHAR 256 to text. this was also addressed here

Share this post


Link to post
Share on other sites

Hello,

 

I've posted an update to the v. 1.23 that includes my changes to the existing package (update is called v. 1.23a).

 

These changes were made after using the package and reading this Community Forum board for this package, and I believe take into account most of the errors and ideas mentioned (more details of changes are in the readme file).

 

1. Could not enter an entire USPS tracking number, so I increased the field size in the "Orders" database table and in the Tracking numbers form entry fields to allow for entire tracking entry.

2. Added a Comments field to the "Orders" database table, using the "tracking.sql" file.

3. Changed the way that the store name is added to the email subject line. It gets automatically added via the existing STORE_NAME variable instead of you manually adding it in the Define('EMAIL_TEXT_SUBJECT_1') statements.

4. Added a Tracking link to the customer's status email. The customer has the choice of going directly to the shipment tracking webpage straight from the email, in addition to going to the "My Account - Order Information" page.

5. Made the Admin-Orders Table Tracking Headings into basic text links, with the corresponding tracking number as a parameter, that goes out to the Package Tracking websites. So you can track an order shipment as easily as your customers. These links can be upgraded by using button images, etc.

6. Fixed the process of deleting an order's Tracking numbers. I removed the check for inserting blanks, and removed the redundant "$order_updated = true;" statements, so you can delete by removing them from the entry field and clicking the "Update" button.

 

Hope this helps make a great package even better!

Share this post


Link to post
Share on other sites

Hey great contrib. Got everything working but one thing. I'm not getting any kind of link or information about tracking in the emails that it sends out when you update an order. Any ideas on how to fix this or what is the problem?

Share this post


Link to post
Share on other sites

Hello everybody,

 

In case you hadn't noticed it, I posted version 1.3 a few days ago which builds on and integrates the solutions posted here on the forum and implemented by some of you! The updated instructions include clarification on email link issues.

 

Appreciate you all. Thanks for making this contrib better. My hope is that it can continue to be refined and improved. I also hope you enjoy the recoded account_history_info.php

 

3 Sept 06 - Changes made to 1 Sept 06 version:

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

(Package Tracking with Email Mods v1.3)

 

1. Further streamlined the instructions and some of the order email functions.

 

2. Fixed the logic in catalog/admin/orders.php for emails to send properly when all 5 shippers are used

 

3. Entirely recoded the catalog/account_history_info.php to include if/then logic and improve appearance :)

 

4. Updated catalog/includes/english/tracking.php with current server information (thanks Irina).

 

5. Have included an "mods" folder which contains the following by Irina:

 

A. The Tracking Buttons mod which includes catalog/admin/orders.php & catalog/account_history_info.php mods placing a clickable "Track" button for customers and administrators to track packages.

 

B. The Tracking Number in Email mod which places a Clickable Short Invoice and Tracking Number in emails to customers.

 

 

Work still to be done that I could use help with:

 

1. Modding catalog/admin/orders.php to be able to accept multiple packages from each shipper.

 

2. Modding catalog/account_history_info.php to be able to show multiple packages from each shipper.

 

3. Modding catalog/includes/english/tracking.php to accept multiple tracking numbers for each shipper.

 

In addition to these mods, the sql would probably need to be adjusted to accomodate the above changes...

Share this post


Link to post
Share on other sites
tracking.JPG

 

Hi!

 

I have the exact same problem. The shipping status comes upp twice, no matter witch status i select.

Anybody solve this problem yet?

 

/Gustav

Share this post


Link to post
Share on other sites

Just finished installing the contribution and i'm getting the following error on the admin/orders.php page:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'and ups_track_num, fedex_freight_track_num, dhl_track_num, curr

 

select customers_name, 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_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, fedex_track_num, ups_track_num, and ups_track_num, fedex_freight_track_num, dhl_track_num, currency, currency_value, date_purchased, orders_status, last_modified from orders where orders_id = '5'

Share this post


Link to post
Share on other sites

For the shipping 2x without sending emails, have not seen that error as of yet. what other contribs are installed around the mods? Did you install the latest version?

 

For the SQL error. The is an "and" in one of the SQL queries. It is actually there in the code you posted. Check admin/orders.php for the queries and delete this, "and" from "and ups_track_num" - if it is not there, it is in one of the other mods that query the sql. Open the files you modded in the admin one by one in a text editor and search for "and ups_track_num", then delete the "and".

 

Scott

olsonsp4c

Share this post


Link to post
Share on other sites

OK, im getting the same problem that Avail1now was having. Its deleting orders with the update button.

 

I think this is related to Avails fix to the "deleteconfirm" error where thay placed a closing bracked before the statement.

 

I had to put in the bracket to get past that error, now it deletes orders.

 

Im thinking that bracket needs to be elsewhere as it closes whatever before the deleteconform, and selects it as THE case and deletes the order.

 

Does this sound like im on track? Maybe even?

 

Any help would appreciated.

 

Thanks.

Share this post


Link to post
Share on other sites
OK, im getting the same problem that Avail1now was having. Its deleting orders with the update button.

 

I think this is related to Avails fix to the "deleteconfirm" error where thay placed a closing bracked before the statement.

 

I had to put in the bracket to get past that error, now it deletes orders.

 

Im thinking that bracket needs to be elsewhere as it closes whatever before the deleteconform, and selects it as THE case and deletes the order.

 

Does this sound like im on track? Maybe even?

 

Any help would appreciated.

 

Thanks.

 

What version are you installing?

Scott

Share this post


Link to post
Share on other sites

when i goto edit a order i am getting this error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* from orders where orders_id = '319'' at line 1

 

select fedex_track_num, ups_track_num, usps_track_num, * from orders where orders_id = '319'

 

[TEP STOP]

 

any ideas?

Share this post


Link to post
Share on other sites

Wow, great Mod.

I installed 1.52 last night, and it nearly worked perfectly, except for two things:

The Comments box wasn't in the Admin Interface for Orders anymore, and the UPDATE button on that same screen didn't work. As such I had trouble testing the rest of it.

 

Any tips on where to start debugging? I did the install on a nearly stock copy of OSC. only a few small text mods and a professionally made (ie: paid for) payment module. Nothing else has had issues. No error codes. No hints at all.

 

Thanks for any help.

-Neil

Share this post


Link to post
Share on other sites
Wow, great Mod.

I installed 1.52 last night, and it nearly worked perfectly, except for two things:

The Comments box wasn't in the Admin Interface for Orders anymore, and the UPDATE button on that same screen didn't work. As such I had trouble testing the rest of it.

 

Any tips on where to start debugging? I did the install on a nearly stock copy of OSC. only a few small text mods and a professionally made (ie: paid for) payment module. Nothing else has had issues. No error codes. No hints at all.

 

Thanks for any help.

-Neil

 

For clarification, when I hover on the "UPDATE" button, it says only "Update", and not another url, as other buttons do. This is in the Admin interface. I looked and found the part in the orders_status.php file where this is supposedly defined, but it looks the same as before the contrib was installed (i compared)

Share this post


Link to post
Share on other sites

I installed the contribution.. and it doesn't send out the emails.

I don't know what I did wrong.. can anyone help.

thank you

noppie


Peace is possible.. Please don't give up.

 

"War is --the old betraying the young"

Share this post


Link to post
Share on other sites

Please be more specific and I'll see how I can help.

Did your store send out emails before the contribution?

Does the "update" button work in the admin page?

 

-Neil

Share this post


Link to post
Share on other sites

Hello everybody,

 

I've uploaded and update for those who tried to use the integrated files for an UNMODIFIED store.

 

7 Jan 07 - Changes made to 22 Dec 06 version:

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

(Package Tracking with Email Mods v1.53)

 

I had accidentally deleted the "Comments" form in admin/orders.php in the integrated files included for upload on an UNMODIFIED osCommerce store. It has now been corrected.

 

Below is the missing code in admin/orders.php

 

find:

<!-- Tracking contribution begin -->
<?php
	$usps_track_link = 'http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum= ' . $order->info['usps_track_num'];
	$ups_track_link = 'http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1= ' . $order->info['ups_track_num'] . '&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&TypeOfInquiryNumber=T&UPS_HTML_Version=3.0&IATA=us&Lang=en&submit=Track+Package ';
	$fedex_track_link = 'http://www.fedex.com/cgi-bin/tracking?tracknumbers=' . $order->info['fedex_track_num'] . '&action=track&language=english&cntry_code=us';
	$fedex_freight_track_link = 'http://www.fedex.com/cgi-bin/tracking?tracknumbers=' . $order->info['fedex_freight_track_num'] . '&action=track&language=english&cntry_code=us';
	$dhl_track_link = 'http://track.dhl-usa.com/atrknav.asp?ShipmentNumber=' . $order->info['dhl_track_num'] . '&action=track&language=english&cntry_code=us';
?>

 

and add this before it:

	  </tr>
  <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>
	<td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>

 

that should fix it.

 

Scott

Share this post


Link to post
Share on other sites

Is there a way to implement tracking with this contribution for UK shipping services?

 

-Initial Citylink

-Parcelforce 48

-Royal Mail

 

If not does anyone know of a contribution which can do this?

 

Will this contribution work if I am using UPS or Fedex from the UK ?

 

-Ramsay


Contributions Installed: STSv43 (Simple Template System), Protx Direct v3.0a, Secure Admin Login - Logout 1.5, UK Royal Mail & Overseas Shipping v 1.2 (FULL), Order Editor v2.8.2 With some Bug Fix - New, Ultimate SEO URLs v2.2.1, Easy Populate 2.76d-MS2 (with attributes)

Share this post


Link to post
Share on other sites
Is there a way to implement tracking with this contribution for UK shipping services?

 

-Initial Citylink

-Parcelforce 48

-Royal Mail

 

If not does anyone know of a contribution which can do this?

 

Will this contribution work if I am using UPS or Fedex from the UK ?

 

-Ramsay

 

 

Yes, it would work, the code would need to be modified every place ups, usps, fedex, fedex freight, dhl are mentioned to reflect your local carriers and in admin/orders.php, the database sql would need to reflect your carriers and all links in tracking.php and admin/orders.php would need to reflect the tracking pages for your carriers. So, it would take a bit of work, but it could be done relatively easily.

 

Scott

Share this post


Link to post
Share on other sites

Hi I installed the mod, latest download with added comments fix. Whenever I click "update" I get the update posted twice. The emails go out just fine one time but the posts on the site are duplicated. Also, none of the tracking links on the customer's order history are there.

 

May someone please assist? Thank you.


Onnig

Share this post


Link to post
Share on other sites
Hi I installed the mod, latest download with added comments fix. Whenever I click "update" I get the update posted twice. The emails go out just fine one time but the posts on the site are duplicated. Also, none of the tracking links on the customer's order history are there.

 

May someone please assist? Thank you.

 

Thanks for using my contribution. Did you use the drop in version or did you use the instructions? Please check your catalog/account_history_info.php file to make sure all the mods were made properly and that the defines are there in catalog/includes/database_tables.php and catalog/includes/languages/english/account_history_info.php and the mods were made in catalog/includes/classes/order.php properly per the instructions.

 

Scott

Share this post


Link to post
Share on other sites
Whenever I click "update" I get the update posted twice. The emails go out just fine one time but the posts on the site are duplicated.

 

Please post the code from admin/orders.php or email it to me. Thanks!

Scott

Share this post


Link to post
Share on other sites
Please post the code from admin/orders.php or email it to me. Thanks!

Scott

 

<?php

/*

$Id: orders.php,v 1.112 2003/06/29 22:50:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright (c) 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

$orders_statuses = array();

$orders_status_array = array();

$orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");

while ($orders_status = tep_db_fetch_array($orders_status_query)) {

$orders_statuses[] = array('id' => $orders_status['orders_status_id'],

'text' => $orders_status['orders_status_name']);

$orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];

}

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'update_order':

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

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

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

//Tracking contribution begin

$ups_track_num = tep_db_prepare_input($HTTP_POST_VARS['ups_track_num']);

$usps_track_num = tep_db_prepare_input($HTTP_POST_VARS['usps_track_num']);

$fedex_track_num = tep_db_prepare_input($HTTP_POST_VARS['fedex_track_num']);

$fedex_freight_track_num = tep_db_prepare_input($HTTP_POST_VARS['fedex_freight_track_num']);

$dhl_track_num = tep_db_prepare_input($HTTP_POST_VARS['dhl_track_num']);

//Tracking contribution end

 

$order_updated = false;

//Tracking contribution begin

$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, fedex_track_num, ups_track_num, usps_track_num, fedex_freight_track_num, dhl_track_num, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

//Tracking contribution end

$check_status = tep_db_fetch_array($check_status_query);

 

if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {

tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

 

if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {

tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

 

//Tracking contribution begin

$customer_notified = '0';

if ($HTTP_POST_VARS['notify'] == 'on' & ($ups_track_num == '' & $fedex_track_num == '' & $usps_track_num == '' & $fedex_freight_track_num == '' & $dhl_track_num == '' ) ) {

$notify_comments = '';

if ($HTTP_POST_VARS['notify_comments'] == 'on') {

$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n";

if ($comments == null)

$notify_comments = '';

}

 

$email = 'Dear ' . $check_status['customers_name'] . ',' . "\n\n" . STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . (int)$oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . (int)$oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1. (int)$oID . EMAIL_TEXT_SUBJECT_2 . $orders_status_array[$status], $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';

 

}else if ($HTTP_POST_VARS['notify'] == 'on' & ($ups_track_num == '' or $fedex_track_num == '' or $usps_track_num == '' or $fedex_freight_track_num == '' or $dhl_track_num == '' ) ) {

$notify_comments = '';

if ($HTTP_POST_VARS['notify_comments'] == 'on') {

$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n";

if ($comments == null)

$notify_comments = '';

}

if ($ups_track_num == null) {

$ups_text = '';

}else{

$ups_text = 'UPS: ';

$ups_track_num_noblanks = str_replace(' ', '', $ups_track_num);

$ups_link = 'http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=' . $ups_track_num_noblanks . '&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&TypeOfInquiryNumber=T&UPS_HTML_Version=3.0&IATA=us&Lang=en&submit=Track+Package ' . "\n";

}

if ($usps_track_num == null) {

$usps_text = '';

}else{

$usps_text = 'USPS: ';

$usps_track_num_noblanks = str_replace(' ', '', $usps_track_num);

$usps_link = 'http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=' . $usps_track_num_noblanks . "\n";

}

if ($fedex_track_num == null) {

$fedex_text = '';

}else{

$fedex_text = 'Fedex: ';

$fedex_track_num_noblanks = str_replace(' ', '', $fedex_track_num);

$fedex_link = 'http://www.fedex.com/Tracking?tracknumbers=' . $fedex_track_num_noblanks . '&action=track&language=english&cntry_code=us' . "\n";

}

if ($fedex_freight_track_num == null) {

$fedex_freight_text = '';

}else{

$fedex_freight_text = 'FedEx Freight: ';

$fedex_freight_track_num_noblanks = str_replace(' ', '', $fedex_freight_track_num);

$fedex_freight_link = 'http://www.fedex.com/Tracking?tracknumbers=' . $fedex_freight_track_num_noblanks . '&action=track&language=english&cntry_code=us' . "\n";

}

if ($dhl_track_num == null) {

$dhl_text = '';

}else{

$dhl_text = 'DHL: ';

$dhl_track_num_noblanks = str_replace(' ', '', $dhl_track_num);

$dhl_link = 'http://track.dhl-usa.com/atrknav.asp?ShipmentNumber=' . $dhl_track_num_noblanks . '&action=track&language=english&cntry_code=us' . "\n";

}

 

$email = 'Dear ' . $check_status['customers_name'] . ',' . "\n\n" . STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . (int)$oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . (int)$oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n\n" . EMAIL_TEXT_TRACKING_NUMBER . "\n" . $usps_text . $usps_link . $ups_text . $ups_link . $fedex_text . $fedex_link . $fedex_freight_text . $fedex_freight_link . $dhl_text . $dhl_link . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1. (int)$oID . EMAIL_TEXT_SUBJECT_2 . $orders_status_array[$status], $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';

 

}else if ($HTTP_POST_VARS['notify'] == 'on' & (tep_not_null($ups_track_num) & tep_not_null($fedex_track_num) & tep_not_null($usps_track_num) & tep_not_null($fedex_freight_track_num) & tep_not_null($dhl_track_num) ) ) {

$notify_comments = '';

$ups_text = 'UPS: ';

$ups_track_num_noblanks = str_replace(' ', '', $ups_track_num);

$ups_link = 'http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=' . $ups_track_num_noblanks . '&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&TypeOfInquiryNumber=T&UPS_HTML_Version=3.0&IATA=us&Lang=en&submit=Track+Package ' . "\n";

$usps_text = 'USPS: ';

$usps_track_num_noblanks = str_replace(' ', '', $usps_track_num);

$usps_link = 'http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=' . $usps_track_num_noblanks . "\n";

$fedex_text = 'Fedex: ';

$fedex_track_num_noblanks = str_replace(' ', '', $fedex_track_num);

$fedex_link = 'http://www.fedex.com/Tracking?tracknumbers=' . $fedex_track_num_noblanks . '&action=track&language=english&cntry_code=us' . "\n";

$fedex_freight_text = 'FedEx Freight: ';

$fedex_freight_track_num_noblanks = str_replace(' ', '', $fedex_freight_track_num);

$fedex_freight_link = 'http://www.fedex.com/Tracking?tracknumbers=' . $fedex_freight_track_num_noblanks . '&action=track&language=english&cntry_code=us' . "\n";

$dhl_text = 'DHL: ';

$dhl_track_num_noblanks = str_replace(' ', '', $dhl_track_num);

$dhl_link = 'http://track.dhl-usa.com/atrknav.asp?ShipmentNumber=' . $dhl_track_num_noblanks . '&action=track&language=english&cntry_code=us' . "\n";

if ($HTTP_POST_VARS['notify_comments'] == 'on') {

$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n";

if ($comments == null)

$notify_comments = '';

}

 

$email = 'Dear ' . $check_status['customers_name'] . ',' . "\n\n" . STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . (int)$oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . (int)$oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n\n" . EMAIL_TEXT_TRACKING_NUMBER . "\n" . $usps_text . $usps_link . $ups_text . $ups_link . $fedex_text . $fedex_link . $fedex_freight_text . $fedex_freight_link . $dhl_text . $dhl_link . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1 . (int)$oID . EMAIL_TEXT_SUBJECT_2 . $orders_status_array[$status], $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';

}

//Tracking contribution end

 

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) . "')");

 

$order_updated = true;

}

 

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) . "')");

 

$order_updated = true;

}

//Tracking contribution begin

tep_db_query("update " . TABLE_ORDERS . " set ups_track_num = '" . tep_db_input($ups_track_num) . "' where orders_id = '" . tep_db_input($oID) . "'");

tep_db_query("update " . TABLE_ORDERS . " set usps_track_num = '" . tep_db_input($usps_track_num) . "' where orders_id = '" . tep_db_input($oID) . "'");

tep_db_query("update " . TABLE_ORDERS . " set fedex_track_num = '" . tep_db_input($fedex_track_num) . "' where orders_id = '" . tep_db_input($oID) . "'");

tep_db_query("update " . TABLE_ORDERS . " set fedex_freight_track_num = '" . tep_db_input($fedex_freight_track_num) . "' where orders_id = '" . tep_db_input($oID) . "'");

tep_db_query("update " . TABLE_ORDERS . " set dhl_track_num = '" . tep_db_input($dhl_track_num) . "' where orders_id = '" . tep_db_input($oID) . "'");

$order_updated = true;

//Tracking contribution end

 

if ($order_updated == true) {

$messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');

} else {

$messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');

}

 

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));

break;

case 'deleteconfirm':

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

tep_remove_order($oID, $HTTP_POST_VARS['restock']);

 

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));

break;

}

}

 

if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) {

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

$order_exists = true;

if (!tep_db_num_rows($orders_query)) {

$order_exists = false;

$messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');

}

}

 

include(DIR_WS_CLASSES . 'order.php');

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

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

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

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

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php

require(DIR_WS_INCLUDES . 'header.php');

?>

<!-- header_eof //-->

 

<!-- body //-->

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

<tr>

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

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

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

<?php

if (($action == 'edit') && ($order_exists == true)) {

$order = new order($oID);

?>

<tr>

<td width="100%"><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_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>

<td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

</tr>

</table></td>

</tr>

<tr>

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

<tr>

<td colspan="3"><?php echo tep_draw_separator(); ?></td>

</tr>

<tr>

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

<tr>

<td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td>

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

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

</tr>

<tr>

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

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

</tr>

<tr>

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

<td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>

</tr>

</table></td>

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

<tr>

<td class="main" valign="top"><b><?php echo ENTRY_SHIPPING_ADDRESS; ?></b></td>

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

</tr>

</table></td>

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

<tr>

<td class="main" valign="top"><b><?php echo ENTRY_BILLING_ADDRESS; ?></b></td>

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

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

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

</tr>

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

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

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

</tr>

<?php

if (tep_not_null($order->info['cc_type']) || tep_not_null($order->info['cc_owner']) || tep_not_null($order->info['cc_number'])) {

?>

<tr>

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

</tr>

<tr>

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

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

</tr>

<tr>

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

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

</tr>

<tr>

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

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

</tr>

<tr>

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

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

</tr>

<?php

}

?>

</table></td>

</tr>

<tr>

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

</tr>

<tr>

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

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>

</tr>

<?php

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

echo ' <tr class="dataTableRow">' . "\n" .

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

' <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

 

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

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

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

if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

echo '</i></small></nobr>';

}

}

 

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

' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .

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

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

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

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

' <td class="dataTableContent" align="right" valign="top"><b>' . $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']) . '</b></td>' . "\n";

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

}

?>

<tr>

<td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">

<?php

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

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

' <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .

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

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

}

?>

</table></td>

</tr>

</table></td>

</tr>

<tr>

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

</tr>

<tr>

<td class="main"><table border="1" cellspacing="0" cellpadding="5">

<tr>

<td class="smallText" align="center"><b><?php echo TABLE_HEADING_DATE_ADDED; ?></b></td>

<td class="smallText" align="center"><b><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></b></td>

<td class="smallText" align="center"><b><?php echo TABLE_HEADING_STATUS; ?></b></td>

<td class="smallText" align="center"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>

</tr>

<?php

$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");

if (tep_db_num_rows($orders_history_query)) {

while ($orders_history = tep_db_fetch_array($orders_history_query)) {

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

' <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" .

' <td class="smallText" align="center">';

if ($orders_history['customer_notified'] == '1') {

echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";

} else {

echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";

}

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";

}

} else {

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

' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .

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

}

?>

</table></td>

</tr>

<tr>

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

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

</tr>

<tr><?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>

<td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>

</tr>

<tr>

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

</tr>

<!-- Tracking contribution begin -->

<?php

$usps_track_link = 'http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=' . $order->info['usps_track_num'];

$ups_track_link = 'http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=' . $order->info['ups_track_num'] . '&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&TypeOfInquiryNumber=T&UPS_HTML_Version=3.0&IATA=us&Lang=en&submit=Track+Package';

$fedex_track_link = 'http://www.fedex.com/Tracking?tracknumbers=' . $order->info['fedex_track_num'] . '&action=track&language=english&cntry_code=us';

$fedex_freight_track_link = 'http://www.fedex.com/Tracking?tracknumbers=' . $order->info['fedex_freight_track_num'] . '&action=track&language=english&cntry_code=us';

$dhl_track_link = 'http://track.dhl-usa.com/atrknav.asp?ShipmentNumber=' . $order->info['dhl_track_num'] . '&action=track&language=english&cntry_code=us';

?>

<tr>

<td class="main"><b><a href="<?php echo $ups_track_link; ?>" target="_blank"><?php echo TABLE_HEADING_UPS_TRACKING; ?></a></b>  <?php echo tep_draw_textbox_field('ups_track_num', '40', '40', '', $order->info['ups_track_num']); ?></td>

</tr>

<tr>

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

</tr>

<tr>

<td class="main"><b><a href="<?php echo $fedex_track_link; ?>" target="_blank"><?php echo TABLE_HEADING_FEDEX_TRACKING; ?></a></b>  <?php echo tep_draw_textbox_field('fedex_track_num', '40', '40', '', $order->info['fedex_track_num']); ?></td>

</tr>

<tr>

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

</tr>

<tr>

<td class="main"><b><a href="<?php echo $usps_track_link; ?>" target="_blank"><?php echo TABLE_HEADING_USPS_TRACKING; ?></a></b>  <?php echo tep_draw_textbox_field('usps_track_num', '40', '40', '', $order->info['usps_track_num']); ?></td>

</tr>

<tr>

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

</tr>

<tr>

<td class="main"><b><a href="<?php echo $fedex_freight_track_link; ?>" target="_blank"><?php echo TABLE_HEADING_FEDEX_FREIGHT_TRACKING; ?></a></b>  <?php echo tep_draw_textbox_field('fedex_freight_track_num', '40', '40', '', $order->info['fedex_freight_track_num']); ?></td>

</tr>

<tr>

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

</tr>

<tr>

<td class="main"><b><a href="<?php echo $dhl_track_link; ?>" target="_blank"><?php echo TABLE_HEADING_DHL_TRACKING; ?></a></b>  <?php echo tep_draw_textbox_field('dhl_track_num', '40', '40', '', $order->info['dhl_track_num']); ?></td>

</tr>

<tr>

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

</tr>

<!-- Tracking contribution end -->

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo ENTRY_STATUS; ?></b> <?php echo tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo ENTRY_NOTIFY_CUSTOMER; ?></b> <?php echo tep_draw_checkbox_field('notify', '', true); ?></td>

 


Onnig

Share this post


Link to post
Share on other sites
Thanks for using my contribution. Did you use the drop in version or did you use the instructions? Please check your catalog/account_history_info.php file to make sure all the mods were made properly and that the defines are there in catalog/includes/database_tables.php and catalog/includes/languages/english/account_history_info.php and the mods were made in catalog/includes/classes/order.php properly per the instructions.

 

Scott

 

Hi,

 

I used the instructions. I verfied all the files and found a missing code on /includes/classes/order.php:

 

//Tracking contribution begin
					  'ups_track_num' => $order['ups_track_num'],
					  'usps_track_num' => $order['usps_track_num'],
					  'fedex_track_num' => $order['fedex_track_num'],
					  'fedex_freight_track_num' => $order['fedex_freight_track_num'],
					  'dhl_track_num' => $order['dhl_track_num'],
//Tracking contribution end

 

This fixed the order history page. It now shows the hyperlinked tracking numbers.

 

I created a new order as a customer, created a new tracking number on the admin order page and updated, and the comments did duplicate again.


Onnig

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

×