A full-featured e-commerce web application built with PHP, MySQL, and vanilla JavaScript.
- Product browsing — category filter, search with live suggestions, featured products, related products
- Product detail — image, price, stock indicator, description, quantity selector, AJAX add-to-cart, star ratings with reviews
- Shopping cart — session-based, add/update/remove items, quantity controls, subtotal/total calculation
- Checkout — address form, order notes, order placement with stock validation
- Order management — order history with accordion view, printable invoice
- User accounts — register, login, logout, profile editing (name, email, password)
- Reviews — star rating picker, AJAX submission, average score display
- Admin panel — dashboard stats, product CRUD (with image upload), order status management, review moderation, category management, user management
- Password reset — forgot password flow with time-limited tokens
- Pagination — page navigation on product listings
- Contact & FAQ pages — static support pages
- Import
schema.sqlinto your MySQL database. - Configure credentials in
config/database.php. - Run
seed.phpto populate demo data. - Access the site at your local domain.
| Role | Password | |
|---|---|---|
| Admin | admin@shopalpha.com | admin123 |
| User | test@example.com | password123 |
- Backend: PHP 8+, PDO/MySQL, custom MVC-like structure
- Frontend: Vanilla JS, CSS custom properties, Font Awesome 6
- Auth: Session-based with bcrypt password hashing
- Prepared statements with PDO (no SQL injection)
- CSRF tokens on all POST forms
- Open redirect validation on login
- Bcrypt password hashing
- Admin routes enforce
isAdmin()check
├── admin.php # Admin dashboard & management
├── index.php # Homepage with featured/products grid
├── product.php # Product detail with reviews
├── forgot_password.php # Password reset request
├── reset_password.php # Password reset with token
├── contact.php # Contact page
├── faq.php # Frequently asked questions
├── cart.php # Shopping cart
├── checkout.php # Order checkout
├── orders.php # User order history
├── invoice.php # Printable invoice
├── login.php # User login
├── register.php # User registration
├── profile.php # User profile (name, email, password)
├── 404.php # Custom 404 error page
├── privacy.php # Privacy policy
├── seed.php # Demo data seeder
├── schema.sql # Database schema
├── classes/
│ ├── Product.php # Product model
│ ├── Cart.php # Cart model
│ ├── Order.php # Order model
│ ├── User.php # User model
│ └── Review.php # Review model
├── api/
│ ├── cart_add.php # Add to cart endpoint
│ ├── cart_update.php # Update cart endpoint
│ ├── submit_review.php # Submit review endpoint
│ └── search.php # Product search endpoint
├── config/
│ └── database.php # DB connection & site config
├── includes/
│ ├── header.php # Site header & nav
│ ├── footer.php # Site footer
│ └── auth.php # Auth guard
└── assets/
├── css/style.css # Stylesheet
└── js/app.js # Frontend scripts