Enterprise-Specific Guidelines

Global Guidelines

🚨 All Modules Must Be Compliant

For a store to be classified as PrestaShop Enterprise and enjoy its full benefits, all custom modules must adhere to these guidelines without exception.

⚠️ Do Not Modify or Override the Core Codebase

Modifying or overriding the original PrestaShop Core files conflicts with seamless upgrades.

  • Core modifications: Any changes to the PrestaShop Core are incompatible with future upgrades. Modifying source code without proper disclosure violates the license agreement.

  • Core overrides: Avoid overriding Core files to introduce new behaviors or alter native functionalities. Overrides hinder the upgrade process and should only be used in rare, unavoidable cases. Be prepared to justify your choice during PrestaShop’s analysis. If in doubt, contact PrestaShop for guidance.

  • Checksum verification: PrestaShop will perform a checksum comparison to detect any unauthorized modifications.

✔ Use Hooks Instead

Rather than modifying or overriding Core files, prioritize using hooks. An extensive list of hooks is available in the Open Source documentation. Feel free to contribute to the Open Source by adding more.

Security and Access Control

🚨 No ROOT Access

No ROOT access to the PrestaShop server is allowed, as it provides access to restricted files and poses a significant security risk.

🚨 Do Not Modify Local Config Files

Configuration files for PHP, Apache, databases, and other system components should remain unchanged in the production environment.

If modifications are required, please submit a support ticket.

🚨 Do Not Modify Code via FTP/SSH

All code changes in a production environment must be made exclusively through Git. Direct modifications via FTP or SSH are strictly prohibited to ensure version control, traceability, and rollback capability.

Temporary FTP/SSH access may only be allowed in exceptional cases. If you plan on doing so, please submit a support ticket.

🚨 Do Not Call HTTP Files in Cron Jobs

Using wget in Cron jobs to call PHP scripts (PHP-FPM) via HTTP can introduce significant security risks.

What you should do instead:

  • It’s safer to run PHP scripts via the CLI.
  • Whenever possible, prefer Symfony commands. See the Open Source documentation on commands. Note that some legacy controllers may not fully support Symfony.

🚨 Avoid System Calls

Some modules use PHP functions like exec or shell_exec to execute server commands, bypassing PrestaShop’s security mechanisms. This can introduce significant vulnerabilities. Rely on PrestaShop’s built-in tools to ensure security and stability.


File and Directory Management

🚨 Use Git Folders Appropriately

  • The /modules, /themes, and /overrides directories should be tracked by Git (not included in the .gitignore file), as they represent critical parts of your PrestaShop store.
  • However, some contents, like product images, PDFs, or other media files found in directories like /uploads and /img, should be ignored by Git. These files don’t need to be versioned, and their inclusion could bloat the repository unnecessarily.

⚠️ Store Module Files Appropriately

Do not store module data at the root of the /modules folder or in unnecessary new folders.

Module data should be stored only in designated locations, such as /var/modules/<module_name>/, a non-versioned directory allowing you to keep your module organized.

⚠️ Implement Proper Logging

Identify the best location for log writing. PrestaShop offers two logging systems:

  • PHP Logger: This is primarily used for logging small events (action history). It is possible to hook into this system, but it’s recommended to avoid using PHP Logger for large logs as it stores logs in the database, which can cause performance issues.

  • File Logging: For more extensive logging, it’s recommended to write logs to the /var/modules/<module_name>/logs folder.

There is no built-in file handler that simplifies this process, so some development work will be required to implement proper file-based logging.

✅ Resolve vendor Folder Conflicts

If conflicts occur with the vendor folder, use PHP-Scoper to prefix it with the module’s name.

See the folder structure here.


Coding Standards

🚨 Declare All Hooks in Custom Themes

Some hooks may be omitted in custom themes. If a module uses a hook that is not declared in the theme, the module will not display or function correctly.

To ensure compatibility, all existing hooks should be declared in the theme. Hooks can be removed during installation if necessary. It is still possible to unhook a module later if it causes issues.

🚨 Do Not Add Controllers via Overrides

Controllers should not be added through overrides, as this introduces new entry points and routes, making future upgrades more difficult. Instead, create a specific module with its own controller.

⚠️ Declare Fixed Min and Max Versions

In the __construct function of your module, you must specify the minimum and maximum compatible versions of PrestaShop. This ensures your module’s compatibility remains clear and avoids potential issues with future updates. For more information, refer to the validation checklist.

✖ Don’t Do This

$this->ps_versions_compliancy = ['min' => '1.7.6.0', 'max' => _PS_VERSION_];

Avoid using _PS_VERSION_ for the maximum version, as it would mark all future PrestaShop versions as compatible, which may cause issues.

✔ Do This Instead

$this->ps_versions_compliancy = ['min' => '1.7.6.0', 'max' => '8.1.99'];

Use the X.Y.99 format for the maximum version, where:

  • X represents the major version.
  • Y represents the minor version.
  • 99 acts as a placeholder, allowing flexibility without needing to be updated for every minor release.

This approach ensures that your module is marked compatible up to a specific version, preventing accidental compatibility with major updates that could introduce breaking changes.

⚠️ Prefer Developing Modules in Symfony Format

Where possible, follow Symfony best practices for module development, as outlined in the official documentation. However, note that PrestaShop is not fully Symfony-compliant, and strictly following Symfony may not always be possible.

✅ Enforce Usage of CQRS Exploitation

Prioritize the use of CQRS (Command Query Responsibility Segregation) when possible.

Currently, some objects in PrestaShop are not yet subject to CQRS, so use it where applicable.

For more information, refer to the Open Source documentation on CQRS.


Performance and Optimization

🚨 Avoid Full Table Scans

Avoid using SELECT * without a WHERE clause, as it can severely impact performance, especially when dealing with large datasets. Using LIMIT and OFFSET alone is also insufficient for performance optimization.

🚨 Set Timeouts on API Calls

Implement web-based callbacks with proper exception handling. Remote API calls should have defined timeouts and robust error handling to prevent indefinite execution and resource wastage.

⚠️ Avoid Elementor/Creative Elements

These modules are resource-intensive and can significantly degrade performance, especially in the backend. While they offer customization options for small merchants, they are not suitable for enterprise-level use.

✅ Clean Up Database Tables

Regularly clean up tables such as ps_guests, ps_connections, and ps_cart_rule to prevent performance issues. Monitor fast-growing tables and ensure they are emptied when necessary.