Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nutrition Lab - E-Commerce Platform

PHP MySQL JavaScript Bootstrap

A full-stack e-commerce platform for nutrition supplements featuring integrated payment processing, automated email/SMS notifications, PDF invoice generation, and comprehensive admin dashboard.

Overview

Nutrition Lab is a production-ready online store that handles the complete e-commerce workflow: product browsing, shopping cart management, secure payments via Flouci gateway, order fulfillment, and automated customer communication.

Key Features

  • Complete Shopping Cart System with session management
  • Product Catalog with 6 categories (Endurance, Proteins, Aminos, Vitamins, Snacks, Accessories)
  • User Authentication and account management
  • Flouci Payment Gateway Integration (Tunisian payment processor)
  • Automated Email Notifications with PDF invoices (PHPMailer)
  • SMS Notifications for order updates (Twilio)
  • PDF Invoice Generation with company branding (DomPDF)
  • Admin Dashboard with sales analytics and reporting
  • Order Management System with status tracking
  • Responsive Design (mobile, tablet, desktop)

Tech Stack

Backend

  • PHP (procedural programming)
  • MySQL (database with normalized schema)
  • Composer (dependency management)

Frontend

  • HTML5 / CSS3
  • JavaScript (ES6+)
  • Bootstrap 5 (responsive framework)

Third-Party Integrations

  • PHPMailer - Email automation
  • Twilio PHP SDK - SMS notifications
  • DomPDF - PDF invoice generation
  • Flouci API - Payment processing

Project Structure

projetfinsemestre2/
├── backend/
│   ├── admin/              # Admin panel
│   │   └── page/           # Admin management pages
│   ├── api/                # API endpoints
│   ├── config/             # Database configuration
│   ├── functions/          # Helper functions
│   ├── img/                # Images and assets
│   ├── uploads/            # Uploaded product images
│   ├── index.php           # Homepage
│   ├── cart.php            # Shopping cart
│   ├── checkout.php        # Checkout process
│   ├── flouci.php          # Payment gateway
│   ├── confirmation.php    # Order confirmation
│   └── ...                 # Other pages
├── vendor/                 # Composer dependencies
├── PHPMailer-master/       # Email library
├── twilio-php-main/        # SMS library
├── composer.json           # Dependency configuration
└── nutritionlab-2.sql      # Database schema

Installation & Setup

Prerequisites

  • XAMPP / WAMP / MAMP (or any local server with PHP & MySQL)
  • PHP 7.4+
  • MySQL 5.7+
  • Composer (for dependency management)

Step 1: Clone the Repository

git clone https://github.com/bahadhay/NutritionLab.git
cd NutritionLab

Step 2: Install Dependencies

composer install

Step 3: Database Setup

  1. Start your local server (Apache & MySQL)
  2. Open phpMyAdmin at http://localhost/phpmyadmin
  3. Create a new database named nutritionlab
  4. Import the SQL file:
    • Click on the nutritionlab database
    • Go to Import tab
    • Choose nutritionlab-2.sql from the project root
    • Click Go

Step 4: Configure Database Connection

Edit backend/config/dbcon.php with your database credentials:

<?php
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'nutritionlab';

$conn = mysqli_connect($host, $username, $password, $database);
?>

Step 5: Configure Third-Party Services (Optional)

Email Configuration (PHPMailer)

Edit email settings in backend/mail.php:

$mail->Username = 'your-email@gmail.com';
$mail->Password = 'your-app-password';

SMS Configuration (Twilio)

Add your Twilio credentials in the SMS configuration file.

Payment Gateway (Flouci)

Configure Flouci API credentials in backend/flouci.php.

Step 6: Launch the Application

  1. Copy the project folder to your htdocs directory (XAMPP) or equivalent
  2. Start Apache and MySQL services
  3. Open your browser and navigate to:
    http://localhost/projetfinsemestre2/backend/index.php
    

Default Login Credentials

User Account

Admin Account

Important: Change these credentials after first login for security.

E-Commerce Workflow

  1. Browse Products - Customer views product catalog by category
  2. Add to Cart - Products added with quantity selection
  3. Checkout - Customer enters shipping information
  4. Payment - Secure payment via Flouci gateway
  5. Confirmation - Order confirmation page displayed
  6. Email Notification - Automated email with PDF invoice sent
  7. SMS Notification - SMS sent to customer's phone
  8. Admin Management - Admin updates order status
  9. Fulfillment - Customer receives shipping confirmation

Admin Panel Features

  • Sales overview and revenue charts
  • Recent orders dashboard
  • Product management (CRUD operations)
  • Order status updates (Pending → Processing → Shipped → Delivered)
  • Customer database management
  • Sales reports (daily/monthly/yearly)
  • Low stock alerts
  • Category management

Security Features

  • Password hashing with bcrypt
  • Prepared statements for SQL injection prevention
  • Input sanitization and validation
  • Session security with regeneration
  • HTTPS recommended for production
  • PCI-compliant payment gateway (Flouci)

Database Schema

Main Tables

  • users - Customer accounts
  • products - Product catalog
  • categories - Product categories
  • orders - Order records
  • order_items - Order details
  • cart - Shopping cart sessions

Screenshots

Coming soon - Add screenshots of your application

Development

Adding New Products

  1. Login to admin panel
  2. Navigate to Products → Add Product
  3. Fill in product details (name, price, category, image)
  4. Submit

Managing Orders

  1. Admin panel → Orders
  2. View order details
  3. Update order status
  4. Customer receives automated notifications

Deployment

For production deployment:

  1. Use a production server (not localhost)
  2. Enable HTTPS/SSL
  3. Change default credentials
  4. Configure production database
  5. Set up email/SMS services
  6. Test payment gateway in production mode
  7. Enable error logging (disable display_errors)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the MIT License.

Contact

Developer: Baha Dhay Email: bahadhay7@gmail.com GitHub: @bahadhay


Built with PHP & MySQL | Full-Stack E-Commerce Solution

About

Full-stack e-commerce platform for nutrition supplements with PHP/MySQL backend, Flouci payment integration, automated email/SMS notifications, PDF invoicing, and admin dashboard. Complete shopping cart, order management, and responsive design.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages