PrestaShop Developer Documentation
website·Indexed 42 days ago
https://devdocs.prestashop-project.org/Developer guides for PrestaShop 9, covering system requirements, installation via Docker, CLI, and AMP stacks, and server configuration for Apache and Nginx. Includes technical documentation on database structure, Grid component customization, and update/migration processes from PrestaShop 1.7.x to 8.
What's inside PrestaShop
- Introduced in PrestaShop 1.7.6, the new translation system harmonizes translations across the Core and Native modules. It works in two steps: first, translation functions are used in PHP, Smarty, or Twig files to mark wordings for translation; second, the Back Office Translation page (International > Translations > Modify Translations) extracts these wordings to generate dictionaries and store translations in the database. Wordings not yet translated are displayed in their original language (English is recommended).
Overview of PrestaShop CRUD Form architecture
PrestaShop uses a standardized pattern for CRUD (Create, Read, Update, Delete) forms to manage identifiable objects in the Back Office. This architecture splits responsibilities into four main elements:
- Form Builder: Initializes the Symfony form using a specific Form Type.
- Form Handler: Manages the form submission process.
- Form Data Provider: Retrieves data to prefill the form (for both new and existing objects).
- Form Data Handler: Persists the submitted form data to the database.
Overview of PrestaShop 9 Architecture
PrestaShop 9 is divided into two main logical sections: the Front Office (FO), which is the public-facing shop, and the Back Office (BO), where merchants manage the shop. Both sections consist of a front-end (browser-side) and a back-end (server-side). The back-end is database-driven, treating the database as the Single Source of Truth (SSOT). The 'Core Business' layer contains the business logic, including models, controllers, and helper classes. Themes are used to transform controller data into HTML for both FO and BO, though only the FO supports third-party themes.Overview of TaxRulesGroup domain operations
The TaxRulesGroup domain in PrestaShop 9 provides a set of commands and queries to manage tax rules groups. Available operations include:
Commands:
AddTaxRulesGroupCommand: Create a new tax rules group.BulkDeleteTaxRulesGroupCommand: Delete multiple tax rules groups simultaneously.BulkSetTaxRulesGroupStatusCommand: Update the status of multiple tax rules groups.DeleteTaxRulesGroupCommand: Remove a specific tax rules group.EditTaxRulesGroupCommand: Modify an existing tax rules group.SetTaxRulesGroupStatusCommand: Update the status of a single tax rules group.
Queries:
GetTaxRulesGroupForEditing: Retrieve a specific tax rules group for modification purposes.
Overview of PrestaShop Back-Office page categories
Back-Office pages in PrestaShop are classified into four main categories to determine their migration path:
- Configuration / Settings Form pages: Used for modifying system settings.
- Listing pages: Used for browsing content (grids) with actions like enable/disable or delete.
- Add/Edit Form pages: Used for creating or editing records in the data model (e.g., customers).
- Other pages: Unique pages such as the Dashboard, Customer Service page, or Carriers Edit page.
Overview of PrestaShop Flashlight
PrestaShop Flashlight is a Docker-based setup designed to start a PrestaShop instance quickly for development and testing. It includes demo content, Back Office access, and pre-installed tools such as PhpMyAdmin, Composer, php-cs-fixer, phpstan, and phpunit.
Warning: This installation method is for local use only and is not intended for production environments or public internet exposure.
Overview of the ps_onepagecheckout module
Introduced in PrestaShop 9.2,ps_onepagecheckoutis a native module that replaces the standard multi-step checkout with a single-page experience. It combines customer information, delivery options, and payment methods into a unified flow. While installed by default, it must be enabled and configured by the merchant to be active on the front office.Overview of SqlManagement domain commands
The SqlManagement domain provides several commands to manage SQL requests and their settings within the system. Available commands include:
AddSqlRequestCommand: Used to add a new SQL request.BulkDeleteSqlRequestCommand: Used to delete multiple SQL requests at once.DeleteSqlRequestCommand: Used to delete a specific SQL request.EditSqlRequestCommand: Used to modify an existing SQL request.SaveSqlRequestSettingsCommand: Used to persist configuration settings for SQL requests.
Introduction to the Update Assistant CLI
The Update Assistant CLI is a Symfony-based tool used to automate PrestaShop updates, backups, and restores. It is particularly useful for CI/CD integration and for bypassing web server constraints (like
memory_limitormax_execution_timein Apache/Nginx) that affectphp-cgiorphp-fpm.Prerequisites:
- The Update Assistant module must be present in the
/modulesfolder of the PrestaShop store server. - The module does not need to be installed to use the CLI.
Execution Path: All commands must be executed from the module directory:
modules/autoupgrade. This is a separate entry point from the standard PrestaShopbin/console.- The Update Assistant module must be present in the
Overview of Cart domain Commands and Queries
The Cart domain in PrestaShop 9 provides a set of specialized Commands for modifying cart state and Queries for retrieving cart data.
Available Commands:
AddCartRuleToCartCommand: Adds a cart rule (discount/voucher) to a cart.AddCustomizationCommand: Adds product customization to a cart.AddProductToCartCommand: Adds a product to the cart.CreateEmptyCustomerCartCommand: Creates a new empty cart for a customer.RemoveCartRuleFromCartCommand: Removes a cart rule from a cart.RemoveProductFromCartCommand: Removes a product from the cart.SendCartToCustomerCommand: Associates/sends a cart to a specific customer.UpdateCartAddressesCommand: Updates the shipping and billing addresses of a cart.UpdateCartCarrierCommand: Updates the selected carrier for the cart.UpdateCartCurrencyCommand: Updates the currency used in the cart.UpdateCartDeliverySettingsCommand: Updates delivery-related settings.UpdateCartLanguageCommand: Updates the language associated with the cart.UpdateProductPriceInCartCommand: Updates the price of a specific product within the cart.UpdateProductQuantityInCartCommand: Updates the quantity of a product in the cart.
Available Queries:
GetCartForOrderCreation: Retrieves cart data specifically required for the order creation process.GetCartForViewing: Retrieves cart data for display to the user.GetLastEmptyCustomerCart: Retrieves the most recent empty cart associated with a customer.
Overview of the Classic translation system
The classic translation system is a legacy feature providing retrocompatibility with PrestaShop 1.6. It works by extracting wordings from source code via the Back Office (International > Translations > Modify Translations) and storing them in dictionary files within the module'stranslationsdirectory. If a wording is not translated, it defaults to the original language (English is recommended).Overview of PrestaShop 9 Theme Domain Commands
The PrestaShop 9 Theme domain provides several commands to manage theme configurations, installations, and layouts. Key available commands include:
AdaptThemeToRTLLanguagesCommand: Adjusts themes for Right-to-Left (RTL) languages.DeleteThemeCommand: Removes a theme from the system.EnableThemeCommand: Sets a specific theme as the active theme.ImportThemeCommand: Imports a theme into the store.ResetThemeLayoutsCommand: Resets the layouts associated with a theme.