Orders Status History — Updated By
Version 1.1.0 by lat9
Created from the discussions on the Zen Cart Forums: http://www.zen-cart.com/showthread.php?209162-Add-admin_id-field-to-orders_status_history-table
Version History:
- v0.0.3, 2013-08-03: Initial release.
- v0.0.4, 2013-08-05:
- Pass the order_id value on the old/new orders status notification
- Added ZEN_UPDATE_ORDERS_HISTORY_PRE_EMAIL notifier to allow plugins to add to the email message to be sent to the customer.
- "unset" the global variables created by the zen_update_orders_history function.
- v1.0.0, 2013-09-02:
- Add an optional input to allow an override of the orders-status update email's subject line.
- Add an optional input to allow an override of the admin email-copy address.
- BUGFIX: Orders-status emails indicated a status change event if the status hasn't changed.
- BUGFIX: Orders-status change notifier happened before orders status adjusted.
- Included the core-file overwrite of /YOUR_ADMIN/orders.php to show the use of the feature.
- Added an OSH_ prefix to all language constants used, to make sure that those associated with this plugin are used.
- v1.0.1, 2013-09-08:
- BUGFIX: Incorrect variable referenced after email comment notification.
- Allow email message to be updated by observer prior to processing.
- v1.0.2, 2013-09-20:
- BUGFIX: Incomplete integration into /YOUR_ADMIN/orders.php, the updated_by field does not show.
- v1.1.0, 2013-11-29:
- Incorporated downwardly-compatible changes introduced by Zen Cart v1.5.2.
- Allow admin-only messages to be sent.
What it does
This plugin provides a common framework that other Zen Cart plugins can use to manipulate a newly-created field — updated_by — in the orders_status_history database table. The plugin includes a SQL-installation script to create the database field and a set of functions that provide a common-use manipulation of that field.
The primary processing file (/includes/functions/extra_functions/osh_updated_by_functions.php) contains the functionality used by both the Zen Cart storefront and admin:
- If not already present, the field named updated_by is added to the database table TABLE_ORDERS_STATUS_HISTORY.
- If running on the admin-side, a function named zen_updated_by_admin is defined (if it doesn't already exist). The function creates a common-format value for the updated_by when an order's status is updated by a Zen Cart admin.
- If not already present, the function zen_update_orders_status_history is defined to provide common handling/creation of an orders_status_history record (including the value for the updated_by field).
Installation
There are is one core-file overwrite in this plugin; you should always backup your cart's database and files prior to making any changes.
- Copy the files to your cart, after renaming the YOUR_ADMIN folder to match your Zen Cart's secret admin folder:
- /includes/functions/extra_functions/osh_updated_by_functions.php
- /YOUR_ADMIN/orders.php
- /YOUR_ADMIN/includes/functions/extra_functions/osh_updated_by_admin_functions.php
- /YOUR_ADMIN/includes/languages/english/extra_definitions/osh_updated_by.php
Un-install
Delete the three new files you copied to your store's filesystem. Note: If you installed another plugin that relies on this framework, make sure to remove any additional filesystem changes that have been made by that plugin!