Skip to content

davishkar/Petshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐾 Pet Shop Management System

A complete, professional pet shop e-commerce platform with modern UI/UX built using PHP, MySQL, and Tailwind CSS.

PHP MySQL Tailwind CSS License


πŸ“‹ Table of Contents


✨ Features

πŸ‘€ User Panel

  • 🏠 Modern Homepage - Hero banner, featured pets, categories showcase, testimonials
  • πŸ›οΈ Advanced Shop - Category filters, price range, search, pagination (12 items/page)
  • πŸ›’ Smart Shopping Cart - AJAX updates, real-time quantity management, no page reload
  • πŸ’³ Secure Checkout - Multi-step process, multiple payment methods (COD, Card, UPI)
  • πŸ‘¨β€πŸ’Ό User Dashboard - Profile management, complete order history with status tracking
  • πŸ“± Fully Responsive - Mobile-first design, works on all devices

πŸ” Admin Panel

  • πŸ“Š Analytics Dashboard - Real-time statistics (orders, revenue, customers, pets sold)
  • πŸ• Pet Management - Full CRUD operations with image upload and stock tracking
  • πŸ“ Category Management - Add/Edit/Delete categories with pet count display
  • πŸ“¦ Order Management - 7-stage status tracking (Pending β†’ Confirmed β†’ Processing β†’ Packed β†’ Out for Delivery β†’ Delivered)
  • πŸ“ˆ Sales Reports - Comprehensive analytics with CSV export
    • Overall statistics
    • Monthly sales breakdown (12 months)
    • Top 10 best-selling pets
    • Category-wise performance
    • Recent orders (last 20)
  • 🎨 Modern UI - Sidebar navigation, color-coded status badges, responsive tables

🎨 Design & UX

  • βœ… Warm pet-themed color palette (Orange #FF8C42, Cream #FFF4E6, Brown #8B4513)
  • βœ… Smooth animations and hover effects
  • βœ… Card-based modern layouts
  • βœ… Loading spinners and notifications
  • βœ… Auto-dismissing flash messages
  • βœ… Mobile-responsive navigation

πŸ”’ Security Features

  • βœ… SQL injection prevention (prepared statements)
  • βœ… Password hashing (bcrypt via password_hash())
  • βœ… XSS protection (htmlspecialchars())
  • βœ… Secure file uploads (type/size validation)
  • βœ… Session-based authentication
  • βœ… Role-based access control (admin/user)
  • βœ… CSRF token generation ready

πŸ“Έ Screenshots

User Interface

  • Homepage: Modern hero banner with featured pets
  • Shop Page: Advanced filtering and responsive grid layout
  • Shopping Cart: Real-time AJAX updates
  • Checkout: Multi-step secure checkout process

Admin Interface

  • Dashboard: Comprehensive statistics and analytics
  • Pet Management: CRUD operations with image preview
  • Order Management: Enhanced status tracking with 7 stages
  • Reports: Visual analytics with CSV export

πŸš€ Installation

Prerequisites

  • XAMPP/WAMP/LAMP (Apache + MySQL + PHP 7.4+)
  • Web Browser (Chrome, Firefox, Edge, Safari)
  • Text Editor (Optional - VS Code, Sublime, etc.)

Step-by-Step Setup

1️⃣ Download/Clone Project

# Place the Petshop folder in your htdocs directory
C:\xampp\htdocs\Petshop

2️⃣ Import Database

Option A - phpMyAdmin (Recommended):

  1. Open http://localhost/phpmyadmin
  2. Create new database: petshop
  3. Select the database
  4. Go to Import tab
  5. Choose file: database/petshop.sql
  6. Click Go

Option B - MySQL Command Line:

mysql -u root -p
CREATE DATABASE petshop;
USE petshop;
SOURCE C:/xampp/htdocs/Petshop/database/petshop.sql;

3️⃣ Configure Database (Optional)

Open includes/config.php and verify:

define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');  // Your MySQL password
define('DB_NAME', 'petshop');
define('SITE_URL', 'http://localhost/Petshop');

4️⃣ Setup Pet Images

Run the image setup script:

http://localhost/Petshop/update_images.php

This will:

  • Copy images to assets/uploads/pets/
  • Update database with image paths
  • Show preview of all pets

5️⃣ Enable Enhanced Order Statuses

Import the status migration:

  1. Open phpMyAdmin β†’ petshop database β†’ SQL tab
  2. Import: database/add_order_statuses.sql
  3. Click Go

6️⃣ Start Using!

  • User Panel: http://localhost/Petshop
  • Admin Panel: http://localhost/Petshop/admin/login.php

πŸ”‘ Default Credentials

Admin Account

Username: admin
Password: admin123
Email: admin@petshop.com

Test User Account

Register a new account at:

http://localhost/Petshop/user/register.php

πŸ“– Usage

For Customers

  1. Browse Pets

    • Visit homepage or shop page
    • Use filters (category, price, search)
    • View pet details
  2. Purchase Process

    • Add pets to cart
    • Update quantities as needed
    • Register/Login
    • Complete checkout with shipping details
    • Choose payment method
  3. Track Orders

    • View order history in dashboard
    • Check order status
    • Update profile information

For Administrators

  1. Login

    • Access: http://localhost/Petshop/admin/login.php
    • Use admin credentials
  2. Manage Pets

    • Add new pets with images
    • Edit existing pet details
    • Update stock and prices
    • Delete pets
  3. Process Orders

    • View all orders with filters
    • Update order status:
      • Pending β†’ Confirmed
      • Confirmed β†’ Processing
      • Processing β†’ Packed
      • Packed β†’ Out for Delivery
      • Out for Delivery β†’ Delivered
    • View customer details
  4. Generate Reports

    • View analytics dashboard
    • Export comprehensive CSV reports
    • Track monthly sales
    • Identify best sellers

πŸ“ Project Structure

Petshop/
β”œβ”€β”€ admin/                      # Admin panel
β”‚   β”œβ”€β”€ includes/              # Admin components
β”‚   β”‚   β”œβ”€β”€ sidebar.php        # Navigation sidebar
β”‚   β”‚   └── footer.php         # Admin footer
β”‚   β”œβ”€β”€ dashboard.php          # Analytics dashboard
β”‚   β”œβ”€β”€ login.php              # Admin login
β”‚   β”œβ”€β”€ manage_pets.php        # Pet CRUD operations
β”‚   β”œβ”€β”€ manage_categories.php  # Category management
β”‚   β”œβ”€β”€ manage_orders.php      # Order management
β”‚   └── reports.php            # Sales reports & CSV export
β”‚
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── style.css          # Custom styles & animations
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   └── main.js            # JavaScript utilities
β”‚   └── uploads/
β”‚       └── pets/              # Pet images (auto-created)
β”‚
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ petshop.sql            # Main database schema
β”‚   β”œβ”€β”€ add_order_statuses.sql # Order status migration
β”‚   └── update_images.sql      # Image update script
β”‚
β”œβ”€β”€ includes/
β”‚   β”œβ”€β”€ config.php             # Database & site config
β”‚   β”œβ”€β”€ functions.php          # Utility functions
β”‚   β”œβ”€β”€ header.php             # HTML head
β”‚   β”œβ”€β”€ navbar.php             # Navigation bar
β”‚   └── footer.php             # Footer
β”‚
β”œβ”€β”€ user/
β”‚   β”œβ”€β”€ ajax/                  # AJAX endpoints
β”‚   β”‚   β”œβ”€β”€ add_to_cart.php    # Add to cart
β”‚   β”‚   └── update_cart.php    # Update cart
β”‚   β”œβ”€β”€ cart.php               # Shopping cart
β”‚   β”œβ”€β”€ categories.php         # Category browsing
β”‚   β”œβ”€β”€ checkout.php           # Checkout process
β”‚   β”œβ”€β”€ dashboard.php          # User dashboard
β”‚   β”œβ”€β”€ login.php              # User login
β”‚   β”œβ”€β”€ logout.php             # Logout
β”‚   β”œβ”€β”€ order_success.php      # Order confirmation
β”‚   β”œβ”€β”€ register.php           # User registration
β”‚   └── shop.php               # Product listing
β”‚
β”œβ”€β”€ images/                     # Source images
β”œβ”€β”€ index.php                   # Homepage
β”œβ”€β”€ check_system.php            # System diagnostic
β”œβ”€β”€ debug_admin.php             # Admin debug tool
β”œβ”€β”€ update_images.php           # Image setup script
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ IMAGE_SETUP_GUIDE.md        # Image setup guide
└── ORDER_STATUS_GUIDE.md       # Order status guide

πŸ› οΈ Technologies Used

Backend

  • PHP 7.4+ - Core programming language
  • MySQL 5.7+ - Database management
  • mysqli - Database connectivity (prepared statements)

Frontend

  • HTML5 - Structure
  • Tailwind CSS 3.0 - Utility-first CSS framework
  • JavaScript (Vanilla) - Client-side interactivity
  • AJAX - Asynchronous updates

Libraries & Tools

  • Font Awesome 6.4 - Icons
  • Google Fonts (Poppins) - Typography

πŸ”’ Security Features

Database Security

// All queries use prepared statements
$stmt = $conn->prepare("SELECT * FROM users WHERE username = ?");
$stmt->bind_param("s", $username);

Password Security

// Hashing on registration
$hashed = password_hash($password, PASSWORD_DEFAULT);

// Verification on login
password_verify($password, $stored_hash);

Input Sanitization

// All user inputs sanitized
function sanitize_input($data) {
    return htmlspecialchars(strip_tags(trim($data)));
}

File Upload Security

  • File type validation (MIME type checking)
  • File size limits (5MB max)
  • Unique filename generation
  • Secure storage path
  • Extension whitelist

πŸ“š Documentation

Additional Guides

Database Schema

  • users - User accounts with role-based access
  • categories - Pet categories
  • pets - Pet inventory with images
  • orders - Customer orders
  • order_items - Order line items

Key Functions

Located in includes/functions.php:

  • sanitize_input() - Input sanitization
  • is_logged_in() - Authentication check
  • is_admin() - Admin role check
  • add_to_cart() - Cart management
  • upload_image() - Secure file upload
  • format_price() - Currency formatting

πŸ”§ Troubleshooting

Common Issues

❌ Database Connection Error

Solution: Check config.php credentials and ensure MySQL is running

❌ Images Not Showing

Solution: Run http://localhost/Petshop/update_images.php

❌ Admin Login Not Working

Solution: Run http://localhost/Petshop/debug_admin.php

❌ Order Modal Not Opening

Solution: Clear browser cache and refresh page

❌ Page Not Found (404)

Solution: Verify SITE_URL in config.php matches your setup

System Diagnostic

Run comprehensive system check:

http://localhost/Petshop/check_system.php

This checks:

  • PHP version and extensions
  • Database connection and tables
  • Admin user existence
  • File permissions
  • Image availability
  • Order status configuration
  • Page accessibility

🎯 Features Highlights

User Experience

βœ… One-click add to cart
βœ… Real-time cart updates (no page reload)
βœ… Advanced product filtering
βœ… Secure checkout process
βœ… Order tracking
βœ… Profile management

Admin Capabilities

βœ… Complete pet inventory control
βœ… 7-stage order status tracking
βœ… Comprehensive sales analytics
βœ… CSV export for reports
βœ… Category management
βœ… Real-time statistics

Technical Excellence

βœ… SQL injection prevention
βœ… XSS protection
βœ… Password hashing
βœ… Secure file uploads
βœ… Session management
βœ… Mobile-responsive design


πŸ“Š Sample Data

The system includes:

  • βœ… 1 Admin user (admin/admin123)
  • βœ… 5 Categories (Dogs, Cats, Birds, Fish, Small Pets)
  • βœ… 8 Sample pets with images
  • βœ… Complete database schema

πŸš€ Quick Start Commands

# 1. Start XAMPP
# Open XAMPP Control Panel
# Start Apache and MySQL

# 2. Import Database
mysql -u root -p petshop < database/petshop.sql

# 3. Setup Images
# Visit: http://localhost/Petshop/update_images.php

# 4. Enable Order Statuses
# Import: database/add_order_statuses.sql in phpMyAdmin

# 5. Access Application
# User: http://localhost/Petshop
# Admin: http://localhost/Petshop/admin/login.php

πŸ“ License

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


πŸ‘¨β€πŸ’» Developer Notes

Customization

  • Colors: Edit Tailwind config in includes/header.php
  • Styles: Modify assets/css/style.css
  • Functions: Add to includes/functions.php
  • Database: Extend schema as needed

Best Practices

  • Always use prepared statements
  • Sanitize all user inputs
  • Hash passwords with bcrypt
  • Validate file uploads
  • Test on multiple devices

πŸŽ‰ Acknowledgments

Built with ❀️ for pet lovers and e-commerce enthusiasts.

Key Technologies:

  • PHP for robust backend
  • MySQL for reliable data storage
  • Tailwind CSS for modern UI
  • Vanilla JavaScript for performance

πŸ“ž Support

For issues or questions:

  1. Check Troubleshooting section
  2. Run system diagnostic: check_system.php
  3. Review documentation files
  4. Check browser console for JavaScript errors

🐾 Enjoy managing your pet shop! 🐾


Last Updated: February 15, 2026
Version: 1.0.0
Status: Production Ready βœ…

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors