If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Admin Tools / Orders Status History -- Updated By [Support Thread]

Orders Status History -- Updated By [Support Thread]

Started by lat9 on 20 Mar 2014, 12:22 PM · Views: 9,859

Results 1 to 20 of 35
20 Mar 2014, 12:22 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #1 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

20 Mar 2014, 1:44 PM
#2
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Post #2 by frank18

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:

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

20 Mar 2014, 5:54 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #3 by lat9

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.

29 Mar 2014, 11:43 AM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #4 by lat9

Now available for download in the Plugins area ...

13 Jul 2014, 11:38 AM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #5 by lat9

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!

28 Dec 2014, 9:08 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #6 by lat9

v1.2.0 is now available from the Plugins area. The update provides downwardly-compatible changes required for Zen Cart v1.5.4.

24 Jan 2015, 12:17 PM
#7
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #7 by digitalshadow

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?

24 Jan 2015, 12:52 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #8 by lat9

I'll think about it, but it'll be a low-priority item as it's not a feature that I need.

24 Jan 2015, 1:28 PM
#9
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #9 by digitalshadow

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.

24 Jan 2015, 1:33 PM
#10
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #10 by digitalshadow

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.

24 Jan 2015, 1:50 PM
#11
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #11 by digitalshadow

can the code for updating the table for who updated the order just be included in orders.php?

24 Jan 2015, 2:38 PM
#12
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #12 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?

$email_comments = (zen_not_null($message) && $email_include_message === true) ? (OSH_EMAIL_TEXT_COMMENTS_UPDATE . $message . "\n\n") : '';
            $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 =
24 Jan 2015, 2:41 PM
#13
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #13 by lat9

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.

24 Jan 2015, 2:42 PM
#14
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #14 by lat9

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?

$email_comments = (zen_not_null($message) && $email_include_message === true) ? (OSH_EMAIL_TEXT_COMMENTS_UPDATE . $message . "\n\n") : '';

> 
> ```php
            $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.

24 Jan 2015, 3:26 PM
#15
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #15 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

24 Jan 2015, 3:58 PM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #16 by lat9

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?

24 Jan 2015, 4:03 PM
#17
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #17 by digitalshadow

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

24 Jan 2015, 4:12 PM
#18
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #18 by lat9

Any debug-logs being generated?

24 Jan 2015, 4:21 PM
#19
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Post #19 by digitalshadow

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

24 Jan 2015, 4:27 PM
#20
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #20 by lat9

Look in /includes/functions/extra_functions/osh_updated_by_functions.php to find the following fragment, adding the line in red:

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