Introduction to PrestaShop
Relevant source files
The following files were used as context for generating this wiki page:
PrestaShop is an Open Source e-commerce web application written in PHP. It provides a customizable shopping cart experience for merchants and customers, supporting major payment services, multiple languages, and localized configurations. The platform features a fully responsive design for both front and back office interfaces.
Sources: README.md:27-33
The project uses a hybrid architecture, incorporating legacy PHP components alongside modern Symfony-based structures. It follows an open-source model where the core is licensed under OSL 3.0 and modules/themes are licensed under AFL 3.0.
Sources: README.md:214-217, CONTRIBUTING.md:22-25
System Architecture and Stack
PrestaShop operates on a standard LAMP/LEMP stack. It requires specific server configurations and PHP extensions to function correctly.
Core Requirements
To run PrestaShop 9.0, the environment must meet the following criteria:
- PHP: Version 8.1 or higher.
- Database: MySQL 5.6 or higher (including MariaDB or Percona).
- Web Server: Apache or Nginx (recommended).
- PHP Extensions: SimpleXML and Zip extensions are mandatory.
Sources: README.md:52-57, INSTALL.txt:33-35, install-dev/missing_requirement.php:104-114
Directory Permissions
The application requires write access to the var/cache directory to manage critical temporary files.
Sources: install-dev/missing_requirement.php:121-125
Component Relationship
The following diagram illustrates the high-level interaction between the server environment and PrestaShop components:
The diagram shows how the Web Server handles requests and interacts with the PHP environment and data storage.
Sources: README.md:52-57, install-dev/missing_requirement.php:104-125
Installation and Deployment
PrestaShop provides multiple installation paths depending on the target environment (development vs. production).
Development Environment (Docker)
A complete Docker-based environment is available for rapid setup. It binds the local port 8001 to the web server by default.
- Frontend:
http://localhost:8001 - Backend:
http://localhost:8001/admin-dev - Email Testing:
http://localhost:1080(Maildev)
Sources: README.md:73-82
Manual Installation Process
Manual setup involves several stages managed by the Installation Assistant.
| Step | Action | Description |
|---|---|---|
| 1 | File Upload | Upload index.php and prestashop.zip. |
| 2 | Extraction | Browse index.php to unzip files. |
| 3 | Requirements | Validate PHP version and extensions. |
| 4 | License | Accept OSL 3.0 and AFL 3.0 terms. |
| 5 | Database | Configure server address, login, and prefix. |
| 6 | Shop Config | Set admin credentials and shop name. |
| 7 | Process | Execute installation steps and create tables. |
| Sources: INSTALL.txt:47-53, install-dev/theme/views/database.php:14-43, install-dev/theme/views/process.php:26-33 |
The flow shows the sequence of actions required to complete a manual installation.
Sources: INSTALL.txt:47-56, install-dev/missing_requirement.php:102-125, install-dev/theme/views/database.php:47-49
Testing Infrastructure
PrestaShop employs a comprehensive testing strategy divided into three main categories.
Test Categories
- Unit Tests: Powered by PHPUnit. Each PHP class corresponds to one test file. Dependencies must be replaced by test doubles.
- Integration Tests: Powered by Behat. These tests cover scenarios involving hard-coded dependencies or static calls.
- UI/End-to-End Tests: Powered by Playwright, Mocha, and Chai. These mimic user behavior in a browser environment.
Sources: tests/README.md:9-45
UI Test Configuration
UI tests require Node.js (v10+) and can be executed against various environments using environment variables.
| Parameter | Default Value | Description |
|---|---|---|
URL_FO | http://localhost/prestashop/ | Front Office URL |
URL_BO | URL_FO + admin-dev/ | Back Office URL |
DB_SERVER | 127.0.0.1 | Database address |
BROWSER | chromium | Browser for UI tests |
| Sources: tests/UI/README.md:65-79, tests/UI/README.md:126-128 |
API Development
Modern PrestaShop features are built using a Symfony-based API structure located in src/PrestaShopBundle.
API Implementation Workflow
- Route Declaration: Define routes in YAML files under
Resources/config/routing/api/. - Controller Creation: Extend
ApiControllerand returnJsonResponse. Controllers should be registered inservices.yml. - Logic Separation: Move complex logic into Repositories or Services rather than legacy classes.
Sources: src/PrestaShopBundle/Controller/Api/Readme.md:7-60
Standard Data Format
The API uses a specific JSON nomenclature for consistency. Lists of data are returned under a data key, while metadata (pagination) is returned under an info key.
Sources: src/PrestaShopBundle/Controller/Api/Readme.md:62-113
Contributing Guidelines
PrestaShop follows a "Git Flow" branching strategy.
8.x/ Supported Branches: Used for bug fixes.developBranch: Used for new features (currently targeting version 9.1).
Sources: README.md:39-44, CONTRIBUTING.md:31-36
Licensing
Contributors must ensure files follow these licenses:
- Core files: Open Software License (OSL 3.0).
- Modules/Themes: Academic Free License (AFL 3.0).
Sources: CONTRIBUTING.md:22-25
PrestaShop provides a robust framework for e-commerce, balancing a legacy foundation with modern development practices like API-first design and extensive automated testing. Successful deployment requires strict adherence to PHP 8.1+ requirements and the removal of the installation directory post-setup for security.
Sources: INSTALL.txt:55, README.md:52