HAMOTECS ONLINE SHOP - DEPLOYMENT GUIDE
======================================
Target folder: /home/hamokpgp/public_html/online-shop/
Compatibility: PHP 5.6+ (uses mysqli and password_hash/password_verify)

IMPORTANT ARCHITECTURE
----------------------
1. Product catalogue/inventory stays in hamokpgp_management.Stock.
2. The dedicated ecommerce database stores only shop orders, order items, buyers and shop admins.
3. This project does NOT overwrite or require replacing the main website dbconnect.php.
4. The existing website route index.php?page=shop remains supported through the root shop.php wrapper.

STEP 1 - UPLOAD
---------------
Upload the CONTENTS of the online-shop/ folder in this ZIP to:
/home/hamokpgp/public_html/online-shop/
Also upload the root wrapper files (shop.php, shop-admin/, shop-account/, shop/ if present) to the website public_html root, preserving the folder structure. Do not overwrite your existing index.php, header.php, dbconnect.php, or other main website files.

STEP 2 - CREATE SHOP DATABASE
-----------------------------
In cPanel > MySQL Databases:
- Create a dedicated database, for example hamokpgp_hamotecs_shop.
- Create or choose a database user and assign it to this database with ALL PRIVILEGES.
- Import sql/shop_database_schema.sql using phpMyAdmin after selecting the new shop database.
Do not import products.sql into this database. Product data remains in hamokpgp_management.Stock.

STEP 3 - CONFIGURE TWO CONNECTIONS
----------------------------------
Edit /online-shop/config.php and replace these placeholders:
- CPANEL_SHOP_DB_USER
- REPLACE_WITH_SHOP_DB_PASSWORD
- CPANEL_SHOP_DATABASE
- CPANEL_MANAGEMENT_DB_USER
- REPLACE_WITH_MANAGEMENT_DB_PASSWORD

Use the full cPanel database and username prefixes as shown in cPanel. The management DB user needs SELECT permission on hamokpgp_management.Stock. The shop DB user needs full permissions on the new ecommerce database. If your host uses one DB user for both, you may use it for both connections, provided it has the necessary permissions.

STEP 4 - CREATE FIRST ADMIN
---------------------------
Visit /online-shop/admin/create_admin.php once, create the first admin account, and then REMOVE or rename create_admin.php immediately. If the page says an admin already exists, use /online-shop/admin/login.php instead. Do not leave the account-creation page publicly available.

STEP 5 - TEST
-------------
1. Open https://hamotecs.com/online-shop/ or https://hamotecs.com/index.php?page=shop
2. Confirm products appear from hamokpgp_management.Stock.
3. Add an item to cart and submit an order using a real name, phone and delivery address.
4. Confirm the order appears in /online-shop/admin/ and WhatsApp opens with the order summary.
5. Test buyer registration/login at /online-shop/account/register.php and /online-shop/account/login.php.

NOTES / TROUBLESHOOTING
-----------------------
- This package is generated but cannot be tested against your live cPanel database from here.
- If the catalogue is blank, verify database credentials, SELECT permission, table name Stock, and columns StockID, Name, Description, Photo, SellingUnitPrice, AvailableProducts, Quantity.
- The Photo field values in your dump look like filenames. This project initially maps filenames to /hamokpgp_management/uploads/. If the real image folder is elsewhere, update that path in online-shop/shop.php.
- Orders are saved before redirecting to WhatsApp. WhatsApp is used for order communication, not as an online payment gateway.
- Check your host's PHP version and error log if any page returns HTTP 500. Never display database passwords in screenshots or public support messages.
