NEXORA STORE V12 — PRODUCT SAVE / IMAGE UPLOAD FIX
==============================================
Base: Nexora Store V11 Full

Changed:
  admin/product_form.php
  includes/functions.php

Fixes:
1. Show clear errors for PHP upload_max_filesize / post_max_size, interrupted uploads,
   invalid images, unwritable upload folder, database fields, and invalid form data.
2. Keep all entered product fields if a save fails, instead of wiping the form.
3. Existing product photo remains if no new image was selected.
4. Remove a newly uploaded image if the product database save rolls back.
5. Do not report an already-saved product as a failed creation when OPTIONAL bulk
   stock import fails. Display a separate stock-import warning instead.
6. Synchronize the stock cache in the product-save transaction.
7. Do not expose raw SQL exceptions to administrators; log them in PHP error_log.

INSTALL:
- Back up existing site files AND MySQL database first.
- If you have V11, replace ONLY admin/product_form.php and includes/functions.php
  from the small Changed Files ZIP. No SQL needed for the code changes.
- If you have an older version, install the Full ZIP only after verifying your
  current database has already had the previous migrations applied.
- Test Admin > Products > Add Product first without an image, then with a small
  JPG or PNG (under 1 MB), then optionally with a larger image.
- If a database field is missing, back up and apply the provided existing
  migrations/2026_10_07_admin_upgrade.sql to that legacy schema as appropriate.
  Do not re-run uncertain migrations blindly.
- On cPanel, check PHP upload_max_filesize and post_max_size in MultiPHP INI
  Editor. A typical configuration is upload_max_filesize=8M, post_max_size=12M.
  The app itself only accepts images up to 5 MB.
- Check that assets/uploads/products/ can be written to by PHP; recommended
  directory permissions 0755 (or host-specific permissions, not 0777).
- In case of failure, error is displayed on the form and more details logged
  in the cPanel PHP error log.

No new SQL migration in V12. Existing data is not deliberately changed.
Offline PHP syntax and upload-failure tests completed; a live MySQL/cPanel
integration test is still needed on the deployed installation.
