Skip to content

Notifications Issued by Edit Orders

lat9 edited this page Mar 14, 2025 · 6 revisions

Edit Orders issues various notifications to enable site-specific (or other plugins) to seamlessly integrate with EO without modifications. Since the processing for EO5 is very different from previous versions, there are some previous notifications that have been removed.

Deprecated Notifications

Note: If not otherwise indicated, the notification was removed in EO5.

Notifier Description
EDIT_ORDERS_PRE_UPDATE_ORDER Issued during the update_order processing, just prior to updating the base order database record.
EDIT_ORDERS_PRE_UPDATE_PRODUCTS Issued during the update_order processing, just prior to the loop that adds/updates each product in the order.
EDIT_ORDER_ORDER_UPDATED_SUCCESS Issued during the update_order processing, when the order has been successfully updated.
EDIT_ORDERS_ORDER_UPDATED Issued at the end of the update_order processing, just prior to the redirect.
EDIT_ORDERS_START_ADD_PRODUCT Issued just prior to the start of the add_prdct processing, after the product's quantity and attributes have been selected.
EDIT_ORDERS_PRODUCT_ADDED Issued near the end of the add_prdct processing, just prior to the order's status-history update and the redirect.
EDIT_ORDERS_ADDITIONAL_ADDRESS_ROWS Issued at the end of the rendering of the order's address block. Removed in EO 4.6.0.
EDIT_ORDERS_STATUS_DISPLAY_ARRAY_INIT Issued just prior to rendering the order's status-history table.
EDIT_ORDERS_ADDITIONAL_OSH_CONTENT Issued just after rendering the Comments input field.
EDIT_ORDERS_ADD_PRODUCT_STOCK_DECREMENT Issued at the start of eo_add_product_to_order, enabling a different stock-handler to manage any stock-decrement. Replaced by NOTIFY_EO_PRODUCT_ADDED and/or NOTIFY_EO_PRODUCT_CHANGED, with different parameters.
NOTIFY_EO_ADD_PRODUCT Issued by eo_add_product_to_order just after creating a product's base orders_products table record. Replaced by NOTIFY_EO_ADD_PRODUCT_TO_CART, NOTIFY_EO_PRODUCT_ADDED and/orNOTIFY_EO_PRODUCT_CHANGED.
NOTIFY_EO_ADD_PRODUCT_ATTRIBUTE Issued by eo_add_product_to_order just after creating a product attribute's orders_products_attributes table record. Replaced by NOTIFY_EO_PRODUCT_ATTRIBUTE_ADDED with different parameters.
NOTIFY_EO_ADD_PRODUCT_DOWNLOAD Issued by eo_add_product_to_order just after creating a product download attribute's orders_products_download table record. Replaced by NOTIFY_EO_PRODUCT_DOWNLOAD_ADDED, with different parameters.
EDIT_ORDERS_ADD_PRODUCT Issued just prior to eo_add_product_to_order's return. EO5 recognizes that an added product is different from a changed one. Replaced by Replaced by NOTIFY_EO_PRODUCT_ADDED and/orNOTIFY_EO_PRODUCT_CHANGED, with different parameters.
EDIT_ORDERS_REMOVE_PRODUCT_STOCK_DECREMENT Issued at the start of eo_remove_product_from_order, enabling a different stock-handler to manage any 'return to stock'. Replaced by NOTIFY_EO_PRODUCT_REMOVED, with different parameters.
EDIT_ORDERS_REMOVE_PRODUCT Issued close to the end of eo_remove_product_from_order, just prior to removal from the "standard" database tables. Replaced by NOTIFY_EO_PRODUCT_REMOVED, with different parameters.
EO_UPDATE_DATABASE_ORDER_TOTALS_MAIN Issued by eo_update_database_order_totals, just prior to the loop that updates the order's totals.
EO_UPDATE_DATABASE_ORDER_TOTALS_ITEM Issued by eo_update_database_order_totals, once for each order-total to be written for the order.
NOTIFY_EO_REMOVE_SHIPPING_TAX Issued at the start of the removeTaxFromShippingCost method, allowing an observer to override EO's normal processing.
NOTIFY_EO_GET_PRODUCTS_STOCK Issued at the start of the getProductsStock method, allowing an observer to supply the specified product's (including attributes) in-stock quantity. Replaced by NOTIFY_EO_GET_PRODUCTS_AVAILABLE_STOCK.

Notifications Issued

Notifier Description
EDIT_ORDERS_START_ACTION_PROCESSING Issued just prior to the start of the EO action processing.
NOTIFY_EO_ADDL_CUSTOMER_ADDRESS_ROWS Issued at the end of rendering the order's customer-address block. Renamed in EO5, was EDIT_ORDERS_ADDL_CUSTOMER_ADDRESS_ROWS.
NOTIFY_EO_ADDL_BILLING_ADDRESS_ROWS Issued at the end of rendering the order's billing-address block. Renamed in EO5, was EDIT_ORDERS_ADDL_BILLING_ADDRESS_ROWS.
NOTIFY_EO_ADDL_SHIPPING_ADDRESS_ROWS Issued at the end of rendering the order's shipping-address block. Renamed in EO5, was EDIT_ORDERS_ADDL_SHIPPING_ADDRESS_ROWS.
NOTIFY_EO_UPDATING_ADDR_FIELD Issued during an order's address-related update when a non-built-in field is found. Added in EO5.
NOTIFY_EO_ADDL_CONTACT_INFO Issued after rendering the 'base' order's contact information. Renamed in EO5, was EDIT_ORDERS_ADDITIONAL_CONTACT_INFORMATION.
NOTIFY_EO_UPDATE_FORM_ADDL_INPUTS Issued just prior to rendering the "Update" block, allowing additional form inputs to be supplied. Renamed in EO5, was EDIT_ORDERS_FORM_ADDITIONAL_INPUTS.
NOTIFY_EDIT_ORDERS_PRODUCTS_HEADING_1 Issued just prior to rendering the first heading-column of the order's products' listing. Renamed in EO5, was EDIT_ORDERS_PRODUCTS_HEADING_1.
NOTIFY_EDIT_ORDERS_PRODUCTS_DATA_1 Issued just prior to rendering the first data-column of the order's products' listing, once for each product in the order. Renamed in EO5, was EDIT_ORDERS_PRODUCTS_DATA_1.
EDIT_ORDERS_DISPLAY_ONLY_TOTALS Issued just prior to rendering the order-totals' section.
EDIT_ORDERS_ADDITIONAL_JS Now issued by EO's javascript handler, loaded during the page's HTML header.
NOTIFY_ADMIN_ORDERS_STATUS_HISTORY_EXTRA_COLUMN_HEADING Issued during the creation of the order's status-history table's header. Shared with the built-in Customers :: Orders detailed display.
NOTIFY_ADMIN_ORDERS_STATUS_HISTORY_EXTRA_COLUMN_DATA Issued once for each of the order's current status-history table's records. Shared with the built-in Customers :: Orders detailed display.
NOTIFY_ADMIN_ORDERS_ADDL_HISTORY_INPUTS Issued once during the rendering of the status-history update modal form.
NOTIFY_EO_ADD_PRODUCT_TO_CART Issued by the addProductToCart method, just after adding/updating a product in EO's "cart". Added in EO5; replaces NOTIFY_EO_ADD_PRODUCT.
NOTIFY_EO_PRODUCT_ATTRIBUTE_ADDED Issued by updateOrderedProductsInDb just after creating a product attribute's orders_products_attributes table record. Replaces NOTIFY_EO_ADD_PRODUCT_ATTRIBUTE with different parameters.
NOTIFY_EO_PRODUCT_DOWNLOAD_ADDED Issued by updateOrderedProductsInDb just after creating a product download attribute's orders_products_download table record. Added EO5; replaces NOTIFY_EO_ADD_PRODUCT_DOWNLOAD with different parameters.
NOTIFY_EO_PRODUCT_ADDED Issued by updateOrderedProductsInDb just after creating a record in the orders_products table. Added in EO5; replaces EDIT_ORDERS_ADD_PRODUCT with different parameters.
NOTIFY_EO_PRODUCT_CHANGED Issued by updateOrderedProductsInDb just after updating a record in the orders_products table. Added in EO5; replaces EDIT_ORDERS_ADD_PRODUCT with different parameters.
NOTIFY_EO_PRODUCT_REMOVED Issued by updateOrderedProductsInDb, just after removing the product from the "standard" order-related database tables. Added in EO5; replaces EDIT_ORDERS_REMOVE_PRODUCT.
EDIT_ORDERS_CHECKS_AND_WARNINGS Issued by eo_checks_and_warnings, giving an observer to add any additional checks and warnings.
NOTIFY_EO_GET_ORDER_SHIPPING_TAX Issued at the start of the calculateOrderShippingTax method, allowing an observer to override the shipping tax value.
NOTIFY_EO_GET_ORDER_SHIPPING_TAX_RATE Issued at the start of the eoGetShippingTaxRate method, allowing an observer to override the shipping tax rate.
NOTIFY_EO_GET_PRODUCTS_AVAILABLE_STOCK Issued at the start of the getProductsAvailableStock method, allowing an observer to supply the specified product's (including attributes) in-stock quantity. Replaces NOTIFY_EO_GET_PRODUCTS_STOCK.

Detailed Descriptions

The sections below document the variables supplied by each notification.

Start Action Processing

This notifier fires at the very beginning of EO's processing, just prior to its start of action processing.

A watching observer can inspect the contents of the $_GET and $_POST arrays to determine what to do next.

Form Additional Inputs

This notifier fires just prior to rendering the "Update" block, enabling additional upper-form inputs to be supplied.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) Contains the order-object that represents the order.
$p2 (r/w) Contains a reference to the $additional_inputs string, to which an observer can append its additional inputs. The value is initialized as an empty string.

Additional Address Rows

These notifiers (one for each of the Customers, Billing and Delivery addresses) enable an observer to insert additional data-entry fields into an address-change modal form. Any fields supplied are added after the built-in address fields.

The additional fields' information is provided by a collection of associative arrays in the following format; all fields are required:

$p2[] = [
    'label' => 'The text to include for the field label',
    'field_id' => 'label "for" attribute, must match id of input field'
    'input' => 'The form-field to be output, one per entry',
];

Note: If the 'label' is specified as an empty string, the label tag isn't generated and the 'field_id' is not used. Observers can use this to insert hidden fields into the address form.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) Contains an associative array containing the order object's formatting of the address.
$p2 (r/w) Contains a reference to the $additional_rows array. Any additional by the observer must be formatted as described above.

Updating Address Field

This notifier fires during EO's building of a SQL query to update one of the addresses within the order, when an updated field is one that an observer has added via its response to NOTIFY_EO_ADDL_CUSTOMER_ADDRESS_ROWS, NOTIFY_EO_ADDL_BILLING_ADDRESS_ROWS or NOTIFY_EO_ADDL_SHIPPING_ADDRESS_ROWS.

The watching observer can change the form-field name to reflect any orders table database field name and/or identify the 'type' of value to be sanitized (see this Zen Cart docs' article for additional information).

The following variables are passed with the notification:

Variable 'name' Description
$p1 An associative array containing:
'original_values'. The order's original values for all the address' fields, an array.
'field_prefix'. Identifies which 'type' of address is being processed. One of customer_, billing_ or delivery_.
'field_name'. Identifies the form-field's name, a string.
'updated_value'. Identifies the to-be-applied updated value for the field.
$p2 (r/w) Contains a reference to the $key_change variable. If the database field-name is different from the form-field name, the observer sets that string name to be used for the database update.
$p3 (r/w) Contains a reference to the $key_type variable. If the field value is to be stored in the database with a sanitization type other than stringIgnoreNull, the observer sets that string sanitization type.

Products Heading 1

This notifier fires just prior to rendering the first products' table heading, allowing an observer to insert the heading for 'leading' columns.

A watching observer appends its additions to the second parameter ($p2, below) as arrays formatted as

array(
    'align' => $alignment,  // One of 'center', 'right' or 'left' (optional)
    'text' => the heading text string
)

The following variables are passed with the notification:

Variable 'name' Description
$p1 (n/a)
$p2 (r/w) Contains a reference to the $extra_headings array, formatted as described above. The value is initialized to (bool)false. Observers should check that the $p2 value is specifically (bool)false before initializing, since multiple observers might be injecting content!

Products Data 1

This notifier fires just prior to rendering the first products' table data, once per product in the order, allowing an observer to insert the data for 'leading' columns.

A watching observer appends its additions to the second parameter ($p2, below) as arrays formatted as

array(
    'align' => $alignment,  // One of 'center', 'right' or 'left' (optional)
    'text' => the data's text string
)

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array that contains the orders_products values for the current product.
$p2 (r/w) Contains a reference to the $extra_data array, formatted as described above. The value is initialized to (bool)false. Observers should check that the $p2 value is specifically (bool)false before initializing, since multiple observers might be injecting content!

Additional Contact Information

This notifier fires after the 'base' contact information, e.g. telephone, email address, has been rendered, giving an observer the opportunity to supply additional data for the output.

A watching observer appends its additions to the second parameter ($p2, below) as arrays formatted as

array(
    'label' => label_text,
    'content' => the entry's content
)

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) Contains the order-object that represents the order.
$p2 (r/w) Contains a reference to the $additional_content_info array, formatted as described above. The value is initialized to an empty array.

Display Only Totals

This notifier fires just prior to rendering the order's totals' block, enabling an observer to indicate that there are additional order-totals that should be considered display-only. The observer returns a comma-separated string of order-total module names, e.g. ot_balance_due, ot_payment_received that, if found in the order, should be displayed but not enabled as inputs.

Note: Other observers might have previously added their display-only fields, so an observer should check to see if the $p2value is an empty string before appending its updates. If the value is not '', then a leading ', ' should be added.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (n/a)
$p2 (r/w) Contains a reference to the $display_only_totals_list string, initially set to an empty string.

Status History Table Headings

This notifier fires during the rendering of the order's status-history table, enabling an observer to add heading content between the Status and Comments columns. The notification is shared with the built-in Zen Cart orders.php, so an observer can be written to support both the base orders' display and Edit Orders'.

A watching observer appends its additions to the second parameter ($p2, below) as arrays formatted as

array(
    'align' => $alignment,    // One of 'center', 'right', or 'left' (optional)
    'text' => $value
)

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An empty array.
$p2 (r/w) Contains a reference to the $extra_headings array, formatted as described above. The value is initialized to (bool)false. Observers should check that the $p2 value is specifically (bool)false before initializing, since multiple observers might be injecting content!

Status History Table Content

This notifier fires during the rendering of the order's status-history table, once for each existing history record, enabling an observer to add the data associated with the heading(s) added. The notification is shared with the built-in Zen Cart orders.php, so an observer can be written to support both the base orders' display and Edit Orders'.

A watching observer appends its additions to the second parameter ($p2, below) as arrays formatted as

array(
    'align' => $alignment,    // One of 'center', 'right', or 'left' (optional)
    'text' => $value
)

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An array containing the fields associated with the current status-history record.
$p2 (r/w) Contains a reference to the $extra_data array, formatted as described above. The value is initialized to (bool)false. Observers should check that the $p2 value is specifically (bool)false before initializing, since multiple observers might be injecting content!

Status History Modal Input

This notifier fires during EO's creation of the modal-input form through which an additional status-history record is created. No pertinent information is passed by this notification; the observer is expected to directly output any additional form elements.

Additional JS

This notifier fires during the load of EO's javascript handler, allowing an observer to include additional jQuery/javascript handlers for the page. Each filename specified must exist in the site's /admin/includes/javascript sub-directory with a .js extension for inclusion.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (n/a)
$p2 (r/w) Contains a reference to the $addl_js_files string, initialized as an empty string. The observer appends the filename(s) of additional .js files to be included as a comma-separated string. Note that other observers might have previously included their additional files, so a leading ', ' should be included if the value is not empty when received.

Add Product to Cart

This notifier is fired by the addProductToCart, just after creating shopping-cart formatted product. Added in EO5.

Note: This notification does not actually update the database, only the in-memory copy of the to-be-added product.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array containing the added product's 'uprid' (a string), the product's current quantity in the cart ('qty', an int or float) and the product array containing the added/updated product's information.
$p2 (r/w) A reference to the shopping-cart's formatting of the product.

Add Product Attribute

This notifier is fired by updateOrderedProductsInDb, just after creating anorders_products_attributes record for a product's attribute. Added in EO5.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array containing the $sql_data_array ('sql') just written to the orders_products_attributes table, an array containing the attribute's base information ('attribute') and the attribute's additional information ('attribute_values').

Add Product Download

This notifier is fired by updateOrderedProductsInDb, just after creating anorders_products_download record for a product's download. Added in EO5.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array containing the just-created orders_products_download table index ('opd_insert_id') and the SQL data written to that table ('sql').

Add Product

This notifier fires during updateOrderedProductsInDb, just after inserting a new record in the orders_products table. This gives an observer the opportunity to handle the associated product's in-stock quantity and/or update additional database fields.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array containing the sql (the $sql_data_array used to create that new record) and the updated_product array containing the just added product's information. The sql array's orders_products_id identifies the newly-added orders_products table record.
$p2 (r/w) A reference to the boolean $products_quantity_updated. If the observer sets its value to something other than (bool)false, EO will bypass its update of the product's products_quantity field value.

Update Product

This notifier fires during updateOrderedProductsInDb, just after updating an existing record in the orders_products table. This gives an observer the opportunity to handle the associated product's in-stock quantity and/or update additional database fields.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array containing:
'orders_products_id'. The orders_products_id record just updated.
'original_product'. An associative array containing the original order's product information.
'updated_product'. An associative array containing the updated order's product information.
'changed_qty'. An `int
$p2 (r/w) A reference to the boolean $products_quantity_updated. If the observer sets its value to something other than (bool)false, EO will bypass its update of the product's products_quantity field value.

Remove Product

This notifier fires during updateOrderedProductsInDb, just after removing the product from the "standard" database tables, indicating that the product removal has completed. The observer has the opportunity to remove the product from any other database tables and/or update the removed product's in-stock quantity..

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An associative array containing:
'orders_products_id'. The orders_products_id record just updated.
'original_product'. An associative array containing the original order's product information.
$p2 (r/w) A reference to the boolean $products_quantity_updated. If the observer sets its value to something other than (bool)false, EO will bypass its update of the product's products_quantity field value.

Checks and Warnings

This notifier fires by eo_checks_and_warnings, giving an observer to add their specific checks and warnings prior to editing the order. Note that the observer has the opportunity to redirect to another page if the order cannot be edited. Only the superglobal values, i.e. $_GET are available to determine the to-be-edited order!

Globally available: $db, $messageStack.

There are no other variables passed in this notification.

Get Order Shipping Tax

This notifier fires at the very start of the calculateOrderShippingTax method, allowing a watching observer to override the shipping tax value for the order.

Globally available: $order.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) A copy of the current $order object.
$p2 (r/w) Contains a reference to the $shipping_tax value, initialized as (bool)false. The observer sets this value to the shipping tax value to be returned by the method.
$p3 (r/w) Contains a reference to the $shipping_tax_rate value, initialized as (bool)false. The observer sets this value to the shipping tax-rate value to be recorded by the method.

Get Order Shipping Tax Rate

This notifier fires at the very start of the eoGetShippingTaxRate method, allowing a watching observer to override the shipping tax rate for the order.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) A copy of the current $order object.
$p2 (r/w) Contains a reference to the $shipping_tax_rate value, initialized as (bool)false. The observer sets this value to the shipping tax rate (a value between 0 and 100) to be returned by the method.

Get Products Stock

This notifier fires at the very start of the getProductsAvailableStock method, allowing a watching observer to supply the specified product's in-stock quantity.

The following variables are passed with the notification:

Variable 'name' Description
$p1 (r/o) An array containing the 'uprid' (product's unique product id) and 'attributes' containing the shopping-cart formatted array of the product's attributes, for which the quantity should be returned.
$p2 (r/w) Contains a reference to the method's $stock_quantity value, returned by the method if $p3 is other than (bool)false upon return from the notification.
$p3 (r/w) Contains a reference to the $stock_handled value, initialized as (bool)false. The observer sets this value to (bool)true if it has supplied a 'stock_quantity' override.