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:


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:

  1. If not already present, the field named updated_by is added to the database table TABLE_ORDERS_STATUS_HISTORY.
  2. 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.
  3. 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.

  1. Copy the files to your cart, after renaming the YOUR_ADMIN folder to match your Zen Cart's secret admin folder:
    1. /includes/functions/extra_functions/osh_updated_by_functions.php
    2. /YOUR_ADMIN/orders.php
    3. /YOUR_ADMIN/includes/functions/extra_functions/osh_updated_by_admin_functions.php
    4. /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!