Phoenix Sitewide Low Stock Message V1.0
=======================================

Compatibility
-------------
CE Phoenix Cart 1.1.0.6
PHP 8.2

Purpose
-------
When an active product has a stock quantity at or below the configured trigger
level, the add-on removes the quantity and Add to Cart controls and replaces
them with:

Low Stock - Please Contact Us

"Contact Us" links to contact_us.php.

Coverage
--------
* Product information pages.
* Standard Phoenix product cards used by category, manufacturer, search,
  New Products, Specials, index and nested-index modules.
* Core add_product and buy_now requests.
* Conventional third-party wishlist/cart transfer action names.
* Shopping-cart quantity updates.
* Items already in the cart when their stock later reaches zero.
* Every standard checkout entry point, including checkout_process.
* Admin > Reports > Low Stock Management.

The Admin report provides:
* An editable trigger level (default 0; values such as 2 or 5 are supported).
* A current list of every product at or below the trigger.
* Active/inactive status and direct product-edit links.
* Products modified back above the trigger during the last seven days.

The server-side checks prevent a hidden or manually constructed request from
bypassing the unavailable-product rule. The rule applies regardless of the
native STOCK_CHECK and STOCK_ALLOW_CHECKOUT settings.

Installation
------------
1. Upload the catalog-side folders to the catalog root, preserving the included
   folder structure.
2. Upload the contents of the supplied admin folder to your real Phoenix Admin
   directory if that directory has been renamed.
3. Open Admin > Reports > Low Stock Management.
4. Enter the required trigger level and click Save Trigger Level. Until it is
   saved, the storefront safely defaults to 0.
5. No manual SQL or module installation is required.
6. Clear any server opcode cache if your hosting retains old PHP class maps.

No Phoenix core file is replaced. The files in includes/system/override are
purpose-built, reversible class overrides loaded by Phoenix's own autoloader.
Saving the trigger creates one configuration row with the key
LOW_STOCK_CONTACT_TRIGGER_LEVEL.

Testing
-------
1. Save a trigger level of 0, set an active product quantity to 1 and confirm
   its normal quantity and Add to Cart controls appear everywhere.
2. Set its quantity to 0 and confirm the controls are replaced by the linked
   Low Stock message on the product page and all standard product cards.
3. Try a previously copied buy_now or add_product URL and confirm the product
   is not added.
4. Add a product to the cart, then change its stock to 0 in Admin. Open the cart
   and confirm it is removed with the Low Stock message.
5. Repeat step 4 while progressing to checkout and confirm checkout returns to
   the cart before an order is inserted.
6. Return the quantity to a value above the trigger and confirm normal
   purchasing is restored automatically.
7. Set the trigger to 5 and confirm a product at quantity 5 is unavailable but
   becomes purchasable at quantity 6.
8. Confirm both report tables and the product-edit links work in Admin.

Customising the text
--------------------
Edit:
includes/languages/english/hooks/shop/siteWide/lowStock.php

Customising the appearance
--------------------------
Edit:
ext/low_stock_contact/low_stock_contact.css

The CSS is isolated from template user.css.

Uninstallation
--------------
Delete only the files supplied in this package. The native Phoenix PI Buy and
Quantity modules resume immediately. The saved setting is harmless if left in
place; to remove it as well, delete the configuration row whose key is:

LOW_STOCK_CONTACT_TRIGGER_LEVEL
