Ecommerce Overview
Ecommerce Overview
UltraViolet Pro includes a comprehensive ecommerce system with product management, order processing, and customer features designed for modern online stores.
Features Overview
Core Ecommerce Functionality
- Product Catalog: Complete product management with variants, categories, and inventory
- Shopping Cart: Persistent cart with session management
- Order Processing: Full order lifecycle from cart to fulfillment
- Customer Management: User accounts with order history
- Payment Integration: Ready for payment gateway integration
- Inventory Management: Stock tracking and low stock alerts
- Shipping Management: Multiple shipping options and rates
Product Page Features
The product page includes several key components that work together to provide an excellent shopping experience:
Product Image Carousel
The product page features a responsive image carousel that allows customers to view multiple product images:
<div id="productCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#productCarousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#productCarousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#productCarousel" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="./images/products/product-1.jpg" class="d-block w-100" alt="Product Image 1">
</div>
<div class="carousel-item">
<img src="./images/products/product-2.jpg" class="d-block w-100" alt="Product Image 2">
</div>
<div class="carousel-item">
<img src="./images/products/product-3.jpg" class="d-block w-100" alt="Product Image 3">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#productCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#productCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
Product Information Section
<div class="product-info">
<h1 class="product-title">Premium Wireless Headphones</h1>
<div class="product-rating">
<div class="stars">
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-half"></i>
</div>
<span class="rating-text">(4.5) 128 reviews</span>
</div>
<div class="product-price">
<span class="current-price">$299.99</span>
<span class="original-price">$399.99</span>
<span class="discount-badge">25% OFF</span>
</div>
<div class="product-description">
<p>Experience premium sound quality with our wireless headphones featuring noise cancellation, 30-hour battery life, and comfortable over-ear design.</p>
</div>
</div>
Product Variants
<div class="product-variants">
<div class="variant-group">
<label class="variant-label">Color:</label>
<div class="variant-options">
<button class="variant-option active" data-variant="black">
<span class="color-swatch" style="background-color: #000;"></span>
Black
</button>
<button class="variant-option" data-variant="white">
<span class="color-swatch" style="background-color: #fff; border: 1px solid #ddd;"></span>
White
</button>
<button class="variant-option" data-variant="blue">
<span class="color-swatch" style="background-color: #007bff;"></span>
Blue
</button>
</div>
</div>
<div class="variant-group">
<label class="variant-label">Size:</label>
<div class="variant-options">
<button class="variant-option active" data-variant="small">S</button>
<button class="variant-option" data-variant="medium">M</button>
<button class="variant-option" data-variant="large">L</button>
</div>
</div>
</div>
Add to Cart Section
<div class="add-to-cart-section">
<div class="quantity-selector">
<label for="quantity">Quantity:</label>
<div class="quantity-controls">
<button type="button" class="btn btn-outline-secondary" onclick="decreaseQuantity()">-</button>
<input type="number" id="quantity" class="form-control" value="1" min="1" max="10">
<button type="button" class="btn btn-outline-secondary" onclick="increaseQuantity()">+</button>
</div>
</div>
<div class="cart-actions">
<button type="button" class="btn btn-primary btn-lg" onclick="addToCart()">
<i class="bi bi-cart-plus"></i> Add to Cart
</button>
<button type="button" class="btn btn-outline-primary btn-lg" onclick="buyNow()">
<i class="bi bi-lightning"></i> Buy Now
</button>
</div>
<div class="product-actions">
<button type="button" class="btn btn-outline-secondary" onclick="addToWishlist()">
<i class="bi bi-heart"></i> Add to Wishlist
</button>
<button type="button" class="btn btn-outline-secondary" onclick="shareProduct()">
<i class="bi bi-share"></i> Share
</button>
</div>
</div>
Ecommerce Architecture
Database Structure
The ecommerce system uses a well-structured database design:
-- Products table
CREATE TABLE products (
id BIGINT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
slug VARCHAR(255) UNIQUE,
description TEXT,
short_description TEXT,
sku VARCHAR(100) UNIQUE,
price DECIMAL(10,2),
compare_price DECIMAL(10,2),
cost_price DECIMAL(10,2),
stock_quantity INT DEFAULT 0,
low_stock_threshold INT DEFAULT 5,
weight DECIMAL(8,2),
dimensions JSON,
status ENUM('active', 'inactive', 'draft'),
featured BOOLEAN DEFAULT FALSE,
meta_title VARCHAR(255),
meta_description TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
-- Product categories
CREATE TABLE categories (
id BIGINT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
slug VARCHAR(255) UNIQUE,
description TEXT,
parent_id BIGINT NULL,
image VARCHAR(255),
sort_order INT DEFAULT 0,
status ENUM('active', 'inactive'),
created_at TIMESTAMP,
updated_at TIMESTAMP
);
-- Product images
CREATE TABLE product_images (
id BIGINT PRIMARY KEY,
product_id BIGINT,
image_path VARCHAR(255),
alt_text VARCHAR(255),
sort_order INT DEFAULT 0,
is_primary BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP
);
-- Orders
CREATE TABLE orders (
id BIGINT PRIMARY KEY,
order_number VARCHAR(50) UNIQUE,
user_id BIGINT,
status ENUM('pending', 'processing', 'shipped', 'delivered', 'cancelled'),
subtotal DECIMAL(10,2),
tax_amount DECIMAL(10,2),
shipping_amount DECIMAL(10,2),
discount_amount DECIMAL(10,2),
total_amount DECIMAL(10,2),
currency VARCHAR(3) DEFAULT 'USD',
shipping_address JSON,
billing_address JSON,
payment_method VARCHAR(50),
payment_status ENUM('pending', 'paid', 'failed', 'refunded'),
notes TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
Laravel Models
// Product Model
class Product extends Model
{
protected $fillable = [
'name', 'slug', 'description', 'short_description',
'sku', 'price', 'compare_price', 'cost_price',
'stock_quantity', 'low_stock_threshold', 'weight',
'dimensions', 'status', 'featured'
];
protected $casts = [
'dimensions' => 'array',
'featured' => 'boolean',
'price' => 'decimal:2',
'compare_price' => 'decimal:2',
'cost_price' => 'decimal:2',
];
public function images()
{
return $this->hasMany(ProductImage::class)->orderBy('sort_order');
}
public function categories()
{
return $this->belongsToMany(Category::class);
}
public function variants()
{
return $this->hasMany(ProductVariant::class);
}
public function getPrimaryImageAttribute()
{
return $this->images()->where('is_primary', true)->first()
?? $this->images()->first();
}
public function getIsInStockAttribute()
{
return $this->stock_quantity > 0;
}
public function getDiscountPercentageAttribute()
{
if ($this->compare_price && $this->compare_price > $this->price) {
return round((($this->compare_price - $this->price) / $this->compare_price) * 100);
}
return 0;
}
}
// Order Model
class Order extends Model
{
protected $fillable = [
'order_number', 'user_id', 'status', 'subtotal',
'tax_amount', 'shipping_amount', 'discount_amount',
'total_amount', 'currency', 'shipping_address',
'billing_address', 'payment_method', 'payment_status'
];
protected $casts = [
'shipping_address' => 'array',
'billing_address' => 'array',
'subtotal' => 'decimal:2',
'tax_amount' => 'decimal:2',
'shipping_amount' => 'decimal:2',
'discount_amount' => 'decimal:2',
'total_amount' => 'decimal:2',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function items()
{
return $this->hasMany(OrderItem::class);
}
public function generateOrderNumber()
{
do {
$orderNumber = 'ORD-' . strtoupper(Str::random(8));
} while (static::where('order_number', $orderNumber)->exists());
return $orderNumber;
}
}
Integration Features
Payment Gateway Integration
UltraViolet Pro is designed to work with popular payment gateways:
- Stripe: Credit card processing
- PayPal: PayPal and credit card payments
- Square: Point of sale integration
- Razorpay: International payment processing
Shipping Integration
- UPS: Shipping rates and tracking
- FedEx: Express and ground shipping
- USPS: Domestic and international shipping
- DHL: International express shipping
Inventory Management
- Real-time stock tracking
- Low stock alerts
- Automatic reorder points
- Multi-location inventory
- Barcode scanning support
Performance Optimization
Image Optimization
- Automatic image resizing and compression
- WebP format support
- Lazy loading for product images
- CDN integration ready
Caching Strategy
- Product catalog caching
- Category tree caching
- Search result caching
- Session-based cart persistence
Database Optimization
- Indexed product searches
- Optimized category queries
- Efficient order processing
- Pagination for large datasets
Security Features
- CSRF protection on all forms
- SQL injection prevention
- XSS protection
- Secure payment processing
- PCI compliance ready
- GDPR compliance features
Mobile Optimization
- Responsive product pages
- Touch-friendly carousel controls
- Mobile-optimized checkout
- Progressive Web App features
- Offline cart functionality
This ecommerce system provides a solid foundation for building modern online stores with all the features customers expect from a professional ecommerce platform.