Usage
How It Works
Pricing Modes
The module supports two pricing modes that can be configured in the admin panel:
Static Pricing Mode
- Historical prices are stored directly in product attributes
- Prices are updated manually or through product save events
- Suitable for stores with infrequent price changes
- Data is stored in
historical_priceandhistorical_price_updated_atattributes
Dynamic Pricing Mode
- Historical prices are pre-calculated and stored in a dedicated index table
- Prices are automatically updated through the indexer system
- Provides better performance for stores with frequent price changes
- Data is stored in
qoliber_omnibus_directive_min_price_indextable
Price Tracking Logic
The module implements logic to determine when to update historical prices:
- Price Increases: When a product's regular price increases, the previous price is stored as the historical price
- Special Price Removal: When a special price is removed and the regular price is higher than the previous special price, the special price becomes the historical price
- Price Decreases: When prices decrease, the historical price is not updated (maintains the lowest price)
- 30-Day Window: Historical prices are tracked within a 30-day rolling window
Frontend Display
On product pages, when the historical price feature is enabled, customers will see: - The current price prominently displayed - A secondary line showing "The lowest price in the last 30 days:" followed by the historical price - This information helps customers make informed purchasing decisions
The display can be controlled separately for: - Product Listing Pages (PLP) - Product Detail Pages (PDP)
Technical Implementation
Core Components
- Configuration Model: Manages module settings and feature flags
- Historical Price Model: Handles price tracking logic and updates
- Observer: Monitors product save events to update historical prices
- Pricing Renderer: Displays historical prices on the frontend
- Setup Patch: Creates necessary product attributes during installation
- Indexer: Maintains minimum price index for dynamic pricing mode
- Service Layer: Provides dynamic price retrieval functionality
- ViewModel: Frontend integration for historical price display
Indexer System
The module includes a custom indexer (qoliber_omnibus_directive_min_price_index) that:
- Pre-calculates minimum prices for all products
- Updates prices on a daily basis
- Supports website and customer group-specific pricing
- Provides fast access to historical pricing data
To reindex the historical prices:
Service Architecture
The GetDynamicPrice service provides:
- Efficient database queries for historical pricing
- Support for website and customer group-specific pricing
- Integration with the minimum price index table
- Fallback to customer session data when parameters are not provided
Event Integration
The module integrates with Magento's product save events to automatically track price changes:
- Listens to
catalog_product_save_afterevents - Compares original and new product data
- Updates historical prices based on configured logic
- Respects the pricing mode configuration (static vs dynamic)
EU Compliance
Omnibus Directive Requirements
This module helps merchants comply with EU Directive 2019/2161 (Omnibus Directive), which requires:
- Display of the lowest price from the previous 30 days
- Transparency in pricing practices
- Clear labeling of price information
Legal Considerations
- Merchants are responsible for ensuring full compliance with all applicable regulations
- The module provides technical implementation but does not guarantee legal compliance
- Consult with legal professionals for specific compliance requirements in your jurisdiction