Promotion Flow
Flow Overview
Process Description
-
Initial Promo Visit
- Customer visits with promo code in URL
- CheckForPromo middleware intercepts request
- PromotionService validates and records visit statistics
- Tracks user agent and host information (up to 50 entries)
-
Cart Addition with Promo
- Customer adds product to cart with promo code
- CreateCartAction validates promo code against product
- PromotionService verifies eligibility:
- Checks if promotion applies to product
- Validates promotion duration
- Records 'added to cart' statistics
-
Order Processing
- Order created with promotion details
- CartHelper's syncProductsWithOrder:
- Processes unique promotion codes
- Increments order statistics per promotion
- Upon successful payment:
- OrderObserver triggers promotion updates
- Updates promotion sales statistics
- Records completed order count
- Order created with promotion details
Statistics Tracking
-
Visit Tracking
- Records each unique promo code visit
- Captures basic visitor information
- Maintains daily visit counts
-
Cart Statistics
- Tracks products added to cart with promo
- Maintains conversion funnel data
-
Sales Analytics
- Monitors amount of orders created with promo
- Monitors successful orders using promo
- Tracks total sales amount per promotion
- Records completed vs attempted orders
Key Models
-
Promotion: Manages promotion campaigns with:
- Unique promo codes
- Duration settings
- Product associations
- Platform specific settings
-
PromotionStatistic: Tracks daily metrics:
- Visit counts
- Cart additions
- Sales figures
- Orders count
- Order completions
- Visitor metadata