-
Orders Status History -- Updated By [Support Thread]
This plugin introduces the ability to track which of your admin users made what changes to an order's status-history. A new column is added to the Zen Cart "orders_status_history" table ... updated_by. This field captures the admin name and id of the person who has made the associated change; that field is displayed via a core-file change to your admin's orders.php file.
Works with Zen Cart versions v1.5.0, v1.5.1 and v1.5.2.
Please note: If you're currently using either Edit Orders or Super Orders (or one of the other plethora of admin-level plugins that make modifications to the orders.php file), you'll need to perform a relatively easy merge to incorporate this change.
Once reviewed, the plugin will be available here: http://www.zen-cart.com/downloads.php?do=file&id=1839
-
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
lat9
This plugin introduces the ability to track which of your admin users made what changes to an order's status-history. A new column is added to the Zen Cart "orders_status_history" table ... updated_by. This field captures the admin name and id of the person who has made the associated change; that field is displayed via a
core-file change to your admin's orders.php file.
Works with Zen Cart versions v1.5.0, v1.5.1 and v1.5.2.
Please note: If you're currently using either Edit Orders or Super Orders (or one of the other plethora of admin-level plugins that make modifications to the orders.php file), you'll need to perform a
relatively easy merge to incorporate this change.
Once reviewed, the plugin will be available here:
http://www.zen-cart.com/downloads.php?do=file&id=1839
Looks like a very useful mod to keep tabs on who did what and when! Thanks for that. :thumbsup:
-
Re: Orders Status History -- Updated By [Support Thread]
Thanks, Frank! I've used it in a couple of my other plugins; it makes it easier for them to update an orders-status history, too.
-
Re: Orders Status History -- Updated By [Support Thread]
Now available for download in the Plugins area ...
-
Re: Orders Status History -- Updated By [Support Thread]
As there have been no changes to /YOUR_ADMIN/orders.php since v1.5.2, this plugin is ready for Zen Cart v1.5.3!
-
Re: Orders Status History -- Updated By [Support Thread]
v1.2.0 is now available from the Plugins area. The update provides downwardly-compatible changes required for Zen Cart v1.5.4.
-
Re: Orders Status History -- Updated By [Support Thread]
Would you consider making a version that is for showing who last updated a product?
create a new field in TABLE_PRODUCTS and have that enter the admin id into there?
Obviously this would have to be integrated into the catalog instead of orders, but is it something you would consider?
-
Re: Orders Status History -- Updated By [Support Thread]
I'll think about it, but it'll be a low-priority item as it's not a feature that I need.
-
Re: Orders Status History -- Updated By [Support Thread]
I'm having problems, I've merged everything, in the comments section it is pulling the data from the table, i.e. if i got to the database and manually enter an updated by value it shows that data.
But it appears to not be updating the table when i update an order.
-
Re: Orders Status History -- Updated By [Support Thread]
I can see the problem, there is a large section
osh_updated_by changes 1/4
where you have commented out part of order.php for i presume, your osh_updated_by_functions.php file, but on my orders.php there are things in those sections I can't comment out, this is where the problem lies.
-
Re: Orders Status History -- Updated By [Support Thread]
can the code for updating the table for who updated the order just be included in orders.php?
-
Re: Orders Status History -- Updated By [Support Thread]
The section below is from my orders.php, i've managed to merge all other tracking mods into your osh_updated_by_functions.php file, but I can't figure this but out.
What do I need to do in this section?
PHP Code:
$email_comments = (zen_not_null($message) && $email_include_message === true) ? (OSH_EMAIL_TEXT_COMMENTS_UPDATE . $message . "\n\n") : '';
PHP Code:
$notify_comments = '';
// BEGIN TY TRACKER 3 - E-MAIL TRACKING INFORMATION ----------------------------------
if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on')) {
if (zen_not_null($comments)) { $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n"; }
if (zen_not_null($track_id1)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_1 . " Tracking ID is " . $track_id1 . " \n<br /><a href=" . CARRIER_LINK_1 . $track_id1 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_1 . $track_id1 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id2)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_2 . " Tracking ID is " . $track_id2 . " \n<br /><a href=" . CARRIER_LINK_2 . $track_id2 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_2 . $track_id2 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id3)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_3 . " Tracking ID is " . $track_id3 . " \n<br /><a href=" . CARRIER_LINK_3 . $track_id3 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_3 . $track_id3 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id4)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_4 . " Tracking ID is " . $track_id4 . " \n<br /><a href=" . CARRIER_LINK_4 . $track_id4 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_4 . $track_id4 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id5)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_5 . " Tracking ID is " . $track_id5 . " \n<br /><a href=" . CARRIER_LINK_5 . $track_id5 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_5 . $track_id5 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id6)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_6 . " Tracking ID is " . $track_id6 . " \n<br /><a href=" . CARRIER_LINK_6 . $track_id6 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_6 . $track_id6 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
// BEGIN TY TRACKER 3 - E-MAIL TRACKING INFORMATION --------------------------------------------------------------------
}
//send emails
$message =
-
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
DigitalShadow
can the code for updating the table for who updated the order just be included in orders.php?
You can certainly pull the $updated_by determination from /includes/functions/extra_functions/osh_updated_by_functions.php and include that in your customized version of orders.php.
You'll need also to copy the zen_updated_by_admin function and the code that adds the updated_by field to the database (if not already present).
Please note: The notifiers issued by the zen_update_orders_history common function are used by a fair number of my other plugins to recognize that an order's status information is being updated and, if so, what has changed.
-
1 Attachment(s)
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
DigitalShadow
The section below is from my orders.php, i've managed to merge all other tracking mods into your osh_updated_by_functions.php file, but I can't figure this but out.
What do I need to do in this section?
PHP Code:
$email_comments = (zen_not_null($message) && $email_include_message === true) ? (OSH_EMAIL_TEXT_COMMENTS_UPDATE . $message . "\n\n") : '';
PHP Code:
$notify_comments = '';
// BEGIN TY TRACKER 3 - E-MAIL TRACKING INFORMATION ----------------------------------
if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on')) {
if (zen_not_null($comments)) { $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n"; }
if (zen_not_null($track_id1)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_1 . " Tracking ID is " . $track_id1 . " \n<br /><a href=" . CARRIER_LINK_1 . $track_id1 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_1 . $track_id1 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id2)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_2 . " Tracking ID is " . $track_id2 . " \n<br /><a href=" . CARRIER_LINK_2 . $track_id2 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_2 . $track_id2 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id3)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_3 . " Tracking ID is " . $track_id3 . " \n<br /><a href=" . CARRIER_LINK_3 . $track_id3 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_3 . $track_id3 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id4)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_4 . " Tracking ID is " . $track_id4 . " \n<br /><a href=" . CARRIER_LINK_4 . $track_id4 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_4 . $track_id4 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id5)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_5 . " Tracking ID is " . $track_id5 . " \n<br /><a href=" . CARRIER_LINK_5 . $track_id5 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_5 . $track_id5 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
if (zen_not_null($track_id6)) { $notify_comments .= "\n\nYour " . CARRIER_NAME_6 . " Tracking ID is " . $track_id6 . " \n<br /><a href=" . CARRIER_LINK_6 . $track_id6 . ">Click here</a> to track your package. \n<br />If the above link does not work, copy the following URL address and paste it into your Web browser. \n<br />" . CARRIER_LINK_6 . $track_id6 . "\n\n<br /><br />It may take up to 24 hours for the tracking information to appear on the website." . "\n<br />"; }
// BEGIN TY TRACKER 3 - E-MAIL TRACKING INFORMATION --------------------------------------------------------------------
}
//send emails
$message =
Oh, let me hunt that up. I created an OSH/orders.php merge that includes Ty Package Tracker support a while ago ...
Ahh, there it is: Attachment 14900
Don't be put off by the zip-file's name, SNAP Affiliates is one of the plugins that depends (heavily) on the notifiers issued by the OSH common function.
-
Re: Orders Status History -- Updated By [Support Thread]
Ok, the tracking info now sends via email, and everything seems to work in that regard, but for some strange reason, it is still not updating the updated by field
-
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
DigitalShadow
Ok, the tracking info now sends via email, and everything seems to work in that regard, but for some strange reason, it is still not updating the updated by field
When the updated-by field is not being updated, what is being updated? Is only the TyPT info being added or is that addition accompanied by an orders-status value change as well?
-
Re: Orders Status History -- Updated By [Support Thread]
everything is being updated, comments, tracking, status, if the customer should be sent and email or not, the only thing not being updated is updated_by
-
Re: Orders Status History -- Updated By [Support Thread]
Any debug-logs being generated?
-
Re: Orders Status History -- Updated By [Support Thread]
nope, is there anything i can echo in order.php to check the status of the functions?
If i change the status of the order without entering a comment or tracking info, a new record is being generated in TABLE_ORDER_STATUS_HISTORY
but nothing is being inserted into updated_by
-
Re: Orders Status History -- Updated By [Support Thread]
Look in /includes/functions/extra_functions/osh_updated_by_functions.php to find the following fragment, adding the line in red:
Code:
error_log (print_r (IS_ADMIN_FLAG, true) . ', ' . print_r ($updated_by, true));
if (!zen_not_null($updated_by)) {
if (IS_ADMIN_FLAG === true && isset($_SESSION['admin_id'])) {
$updated_by = zen_updated_by_admin();
} elseif (IS_ADMIN_FLAG === false && isset($_SESSION['customers_id'])) {
$updated_by = '';
} else {
$updated_by = 'N/A';
}
}
That will create a debug-log file that contains the value of the IS_ADMIN_FLAG (which should be true) and the $updated_by value (which should be null).
-
Re: Orders Status History -- Updated By [Support Thread]
if i don't change anything and just update the order, a new record is also generated in TABLE_ORDER_STATUS_HISTORY
this is what my TABLE_ORDER_STATUS_HISTORY structure is
1 orders_status_history_id
2 orders_id
3 orders_status_id
4 date_added
5 customer_notified
6 comments
7 comment_by
8 track_id1
9 track_id2
10 track_id3
11 track_id4
12 track_id5
13 track_id6
14 rma_number
15 action
16 updated_by
-
Re: Orders Status History -- Updated By [Support Thread]
i put that, there is no log file in logs
would you like a copy of my orders.php file to see if any other mods are breaking your calls?
-
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
DigitalShadow
i put that, there is no log file in logs
would you like a copy of my orders.php file to see if any other mods are breaking your calls?
Sure. Since there's no debug-log, the function isn't being called -- that's why there's no updated_by value!
-
Re: Orders Status History -- Updated By [Support Thread]
that is what i assumed, pm sent
-
Re: Orders Status History -- Updated By [Support Thread]
I've just uploaded v1.2.1 to the Plugins. It contains the correction to properly handle CR/LF sequences in the status-update messages.
-
Re: Orders Status History -- Updated By [Support Thread]
Thanks for this great mod!
I followed the readme and was able to install it successfully, the updated by column is also being updated as it should, however when i do an update i get a 500 server error (the update is actually done but its not redirecting to the order page as it should) I suspect that this is caused by some error when merging the orders.php file, if I upload my orders.php file could someone take a moment to review the issue?
TIA
-
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
ShopVille
Thanks for this great mod!
I followed the readme and was able to install it successfully, the updated by column is also being updated as it should, however when i do an update i get a 500 server error (the update is actually done but its not redirecting to the order page as it should) I suspect that this is caused by some error when merging the orders.php file, if I upload my orders.php file could someone take a moment to review the issue?
TIA
Update:
When I removed the following text marked in bold red from orders.php the 500 server error disappeared however the updated by column would no longer update:
Code:
// BEGIN TY TRACKER 1 - DEFINE VALUES ----------------------------------------------
$track_id1 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id1']));
$track_id2 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id2']));
$track_id3 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id3']));
$track_id4 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id4']));
$track_id5 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id5']));
// END TY TRACKER 1 - DEFINE VALUES ------------------------------------------------------------------
//-bof-c-snap_affiliates-v2.5.0
/* ----- Processing now handled by separate function -----
$order_updated = false;
// BEGIN TY TRACKER 2 - INCLUDE DATABASE FIELDS IN STATUS QUERY ----------------------------------------------
$check_status = $db->Execute("SELECT customers_name, customers_email_address, orders_status, payment_module_code, shipping_module_code,
date_purchased from " . TABLE_ORDERS . "
And
Code:
*/
$check_status = $db->Execute("SELECT orders_status, date_purchased FROM " . TABLE_ORDERS . " WHERE orders_id = '" . (int)$oID . "'");
$customer_notified = (isset($_POST['notify']) && ($_POST['notify'] == 1 || $_POST['notify'] == -1)) ? $_POST['notify'] : 0;
$osh_record_added = zen_update_orders_history($oID, $comments, null, $status, $customer_notified, (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on'));
$order_updated = ($osh_record_added == -1) ? false : true;
//-eof-c-snap_affiliates-v2.5.0
-
Re: Orders Status History -- Updated By [Support Thread]
@ShopVille, that implies to me that the merge into /YOUR_ADMIN/orders.php missed something. If you send me a copy of your orders.php file via PM, I'll give it a look.
What version of Zen Cart? What other plugins have you installed that muck with orders.php?
-
Re: Orders Status History -- Updated By [Support Thread]
I've just submitted v1.3.0 to the plugins for review.
Updates the plugin for Zen Cart v1.5.5 compatibility and to allow the common update function to properly operate when issued from either the admin-console or the storefront.
-
Re: Orders Status History -- Updated By [Support Thread]
v1.3.0 is now available for download.
-
Re: Orders Status History -- Updated By [Support Thread]
I've just submitted v2.0.0 of the plugin for review. This version:
- Supports Zen Cart 1.5.4 and 1.5.5[a] only.
- Minimizes the changes to the ZC-specific /YOUR_ADMIN/orders.php (no more comment-out block), making it easier to incorporate into already-edited files.
- Recognizes that some callers might have previously "prepared" the commentary input (i.e. adding slashes).
- Moves the database initialization to a "more proper" admin-level initialization script.
-
Re: Orders Status History -- Updated By [Support Thread]
v2.0.0 is now available for download.
-
Re: Orders Status History -- Updated By [Support Thread]
Is this now part of ZC156/not necessary?
-
Re: Orders Status History -- Updated By [Support Thread]
Quote:
Originally Posted by
torvista
Is this now part of ZC156/not necessary?
Yes, it is, so no it's not! :cool: ... you asked for it!
Anyway, be sure to grab the update (destined for zc156b and later), where the load point for the function's in-core version was corrected: https://github.com/zencart/zencart/issues/2224
Either that, or make sure that the auto_loader and extra_functions files provided by this plugin are removed prior to any zc156/zc156a installation.
-
Re: Orders Status History -- Updated By [Support Thread]
Updated plugin area to note that this is now built in. Thank you @lat9!