Easy Product Manager
====================

Tested on:
----------
CE Phoenix Cart 1.1.0.6 + PHP 8.2

Purpose
-------
Provide a standalone one-page product add/edit workflow in Phoenix Admin. The
normal Phoenix Catalog page remains installed and unchanged as a fallback.

Core files
----------
No Phoenix core files are changed or replaced.

New files
---------
admin/easy_products.php
admin/includes/epm_product_helpers.php
admin/includes/actions/easy_products/create_category.php
admin/includes/actions/easy_products/save.php
admin/includes/boxes/catalog_easy_products.php
admin/includes/js/easy_products.js
admin/includes/languages/english/easy_products.php
admin/includes/languages/english/modules/boxes/catalog_easy_products.php
admin/includes/languages/english/hooks/catalog/epmProductButton.php
includes/hooks/admin/siteWide/epmProductButton.php
includes/hooks/admin/easy_products/epmUserCss.php

Features
--------
* Search existing products by partial name, model or exact product ID.
* Open directly on the Add new product form.
* Switch to Edit existing product with a clear button; the edit fields remain
  hidden until a product search result is selected.
* Add and edit products through the same one-page form.
* Open an existing product directly in Easy Product Manager from the native
  Phoenix Catalog product page.
* Put descriptions and SEO first in the product form.
* Choose one or more existing Phoenix categories.
* Create a category inline, choose its parent and immediately select it for the
  current product without leaving the form.
* Edit status, availability, manufacturer, importer, model, GTIN, weight,
  quantity, tax class and net/gross price.
* Store a product cost price in products.products_cost_price and show the live
  net-price markup as a combined configured-currency value and percentage.
* Edit product names, descriptions, URLs and SEO fields for every installed
  language.
* Format product descriptions on both Add and Edit with a page-specific
  TinyMCE editor.
* Automatically detect the optional Main + Long Product Descriptions add-on.
  When its products_description.products_long_description column exists, EPM
  shows the required native main description plus an optional long description
  for every installed language, loads TinyMCE on both fields and saves both.
* Keep the native products_description field as the required main description,
  including the add-on's visible-text 500-1,000 character guidance counter.
* Upload a required main image for a new product or retain the current image
  while editing.
* Add, replace, remove and sort gallery images.
* Allocate existing native Phoenix option/value pairs after entering the
  product descriptions and SEO information.
* Keep the attribute editor hidden until Add or edit attributes is selected,
  while showing how many values are already assigned.
* Edit the prefix and product-specific price adjustment for each allocation.
* Use Easy Attribute Manager defaults when its defaults table is installed.
* Preserve orphaned attribute rows for explicit review in Easy Attribute
  Manager rather than deleting them silently.
* Remove connected products_attributes_download rows when a valid product
  attribute is deliberately removed.
* Warn before leaving a changed product without saving.
* Save the database changes in one transaction.

Attribute scope
---------------
This page allocates existing option/value combinations only. It does not create,
rename, reorder or delete option names or values. Use Easy Attribute Manager or
Phoenix's native Products Attributes page for those operations.

The supported attribute fields are native Phoenix:
* products_id
* options_id
* options_values_id
* options_values_price
* price_prefix

QTPro and third-party per-attribute stock, weight, image, wholesale-price or
Option Types fields are not managed.

Installation
------------
Copy the included php and js files to your server, respecting the correct directory structure. (some sub directories may need to be created) Copy the complete code block from epm.css into the store's existing templates/override/static/user.css; do not replace the user's full stylesheet.

TinyMCE
-------
TinyMCE is loaded only on Easy Product Manager and is applied only to product
description fields. It is loaded from the cdnjs-hosted TinyMCE 5.5.1 file used
by the supplied TinyMCE-for-PhoenixCart reference add-on. If the CDN cannot be
reached, the standard textarea remains available.

Main + Long Product Descriptions compatibility
----------------------------------------------
EPM feature-detects the optional products_description.products_long_description
column used by the Main + Long Product Descriptions add-on.

If the column exists:
* products_description remains the required main description.
* products_long_description is shown as an optional second editor.
* both fields are loaded and saved independently for each language.
* TinyMCE is applied to both fields.
* only the required main description participates in EPM's empty-description
  validation.
* the main-description visible-text counter follows the add-on's 500-1,000
  recommended and 5,000 maximum guidance.

If the column does not exist, EPM behaves as before with one required product
description field. EPM does not create or remove the long-description column;
that remains the responsibility of the Main + Long Product Descriptions add-on.

See THIRD_PARTY_NOTICES.txt for attribution and licensing information.

Database change
---------------
When Easy Product Manager is opened, it checks for
products.products_cost_price. If the column is absent, it creates:

products_cost_price DECIMAL(15,4) NOT NULL DEFAULT 0.0000

Uninstall
---------
Delete only the eleven application files listed above. The Product Manager creates no
database tables. The products_cost_price column is deliberately retained so
stored cost data is not destroyed. Products and native product attributes
remain in Phoenix.

Change log
----------
Initial Release V1.0 31 July 2026
Compatibility update 14 August 2026 - optional Main + Long Product Descriptions support