Catalog Management
Relevant source files
The following files were used as context for generating this wiki page:
Catalog Management handles the core inventory, categorization, and display logic for the e-commerce platform. It provides the structures necessary to define product behaviors, organize items into hierarchical categories, and configure global shop settings that affect how customers interact with the store's offerings.
This system integrates closely with the Back Office for merchant administration and the Front Office for customer browsing. Developers interact with this module primarily through Domain-driven classes for settings and the core Product class for data persistence and retrieval.
Sources: README.md:16-20, classes/Product.php
Product Architecture and Settings
The Product class serves as the central data model for all items within the catalog. It manages product attributes, pricing, and visibility. Accompanying this is the ProductSettings domain class, which encapsulates global configurations for product behavior across the store.
Key Product Configuration Fields
ProductSettings defines constants and properties that control high-level product features.
| Setting | Type | Description |
|---|---|---|
MAX_QUANTITY_DISCOUNT | int | Maximum allowable discount for bulk purchases (Default: 100). |
catalogMode | bool | Enables/disables the ability to purchase products. |
comparisonMaxProducts | int | Limits how many products a user can compare at once. |
showPrices | bool | Controls if prices are visible to customers. |
newDaysCount | int | Number of days a product is considered "New". |
Sources: src/Core/Domain/Product/ProductSettings.php:26-34, src/Core/Domain/Product/ProductSettings.php:97-133
Product Data Flow
The following diagram illustrates the relationship between global settings and individual product instances.
The Product class utilizes properties like catalogMode and showPrices from ProductSettings to determine if a "Add to Cart" button or price label should render in the UI.
Sources: src/Core/Domain/Product/ProductSettings.php:40-70, classes/Product.php
Category Management
Categories provide the hierarchical structure for the catalog. The CategorySettings class manages the display logic for these groupings, specifically focusing on how products appear within them.
Category Display Configurations
Merchants configure how categories sort and display products through the CategorySettings domain.
| Feature | Description |
|---|---|
rootCategoryVisibility | Determines if the main root category is accessible to users. |
productsOrderBy | Defines the default sort field (e.g., Position, Price, Date Added). |
productsOrderWay | Defines the sort direction (Ascending or Descending). |
Sources: src/Core/Domain/Category/CategorySettings.php:25-78
Category Interaction Logic
Testing and Quality Assurance
Catalog features are validated through comprehensive UI and functional testing suites defined in the project's testing infrastructure.
Catalog Test Campaigns
The testing framework includes specific paths for validating catalog functionality in both the Back Office (BO) and Front Office (FO).
- BO Catalog Tests: Validates product creation, category assignment, and stock management via
campaigns/functional/BO/03_catalog. - FO Catalog Tests: Validates product display, faceted search, and category navigation.
Sources: tests/UI/package.json:54-58
Automated Test Execution
Developers use npm scripts to target catalog-specific validation:
npm run test:functional:BO:catalog: Executes all Back Office catalog functional tests.npm run test:functional:BO:catalog:01-02: Executes specific subsets of catalog tests for faster iteration.
Sources: tests/UI/package.json:55-56
Conclusion
Catalog Management provides the foundational structures for PrestaShop's e-commerce capabilities. By separating global configuration into Domain Settings (ProductSettings, CategorySettings) and item-level data into core classes (Product), the system ensures consistent behavior across large inventories while maintaining flexible merchant control.