# Electro Shop

Installation Guide — Core PHP + MySQL E-Commerce System

PHP 7.4+ MySQL 5.7+ Apache/Nginx PDO Extension
1
Create Database & Import Schema
Set up your MySQL database

Open phpMyAdmin (or MySQL CLI) and run the SQL file:

    mysql -u root -p < database.sql

Or in phpMyAdmin: Import → select `database.sql` → Go

This creates the electro_shop database with all tables and default data including the admin account.
2
Configure Database Connection
Edit includes/config.php

Open `includes/config.php` and update these lines:

    define('DB_HOST', 'localhost');      // Your MySQL host
    define('DB_NAME', 'electro_shop');  // Database name
    define('DB_USER', 'root');          // Your MySQL username
    define('DB_PASS', '');              // Your MySQL password

    // Your full site URL (no trailing slash)
    define('SITE_URL', 'http://localhost/ecommerce');

SITE_URL must match the exact URL you access the site from. For example:
Local: `http://localhost/ecommerce`
Live: `https://yourdomain.com`
3
Set Folder Permissions
Allow image uploads

The uploads folder must be writable by the web server:

    chmod -R 755 uploads/
    chmod -R 777 uploads/products/

On Windows (XAMPP/WAMP): Right-click `uploads/products/` → Properties → uncheck Read-only

4
Login to Admin Panel
Default credentials
Username
`admin`
Password
`Admin@123`
Important: Change the password immediately after first login via Admin Panel → Change Password.
5
Update Phone Numbers
Admin Panel → Phone Numbers

Go to Admin Panel → Phone Numbers and update all 5 numbers with your real contact numbers.

- Phone Number — used for the "Call Now" button (format: +91XXXXXXXXXX)
- WhatsApp Number — digits only, no + or spaces (format: 91XXXXXXXXXX)

The "Call Now" button randomly picks from active numbers. The WhatsApp button uses the first active WhatsApp number.

📁
File Structure Reference

    ecommerce/
    ├── index.php              ← Homepage
    ├── shop.php               ← Product listing
    ├── product.php            ← Single product page
    ├── database.sql           ← Database schema (import once)
    ├── INSTALL.html           ← This guide
    ├── .htaccess              ← Apache security rules
    │
    ├── includes/
    │   ├── config.php         ← ⭐ Database config (edit this!)
    │   ├── header.php         ← Shared navbar/header
    │   └── footer.php         ← Shared footer
    │
    ├── admin/
    │   ├── login.php          ← Admin login
    │   ├── index.php          ← Dashboard
    │   ├── products.php       ← All products list
    │   ├── product_add.php    ← Add product (up to 8 images)
    │   ├── product_edit.php   ← Edit product & images
    │   ├── product_delete.php ← Delete product
    │   ├── phones.php         ← Manage 5 phone numbers
    │   ├── settings.php       ← Site name, WhatsApp template
    │   ├── change_password.php
    │   ├── logout.php
    │   └── partials/
    │       ├── admin_header.php
    │       └── admin_footer.php
    │
    ├── uploads/
    │   └── products/          ← ⭐ Must be writable (chmod 777)
    │
    └── assets/
        ├── css/               ← Bootstrap + custom styles
        ├── js/
        ├── lib/               ← Owl Carousel, Lightbox
        └── img/               ← Template images

Go to Admin Panel View Website