PrestaShop’s technical architecture
PrestaShop is based on a 3-tier architecture, using same principle as the Model > View > Controller (MVC) architecture, only in a simpler and more accessible way:
- Object/data. Database access is controlled through files in the “classes” folder
- Data control. User-provided content is controlled by files in the root folder.
- Design. All of the theme’s files are in the “themes” folder
While all versions of PrestaShop up to 1.6 used only a custom architecture, starting version 1.7 Prestashop is moving to Symfony PHP framework.
The idea of migrating was to have a more robust code, more modular and fully testable.
About MVC architecture
The model represents the application’s behavior: data processing, database interaction, etc.
The view is the interface with which the user interacts.
Its first role is to display the data that is been provided by the model. Its second role is to handle all the actions from the user (mouse click, buttons, etc.), and send these events to the controller.
The view does not do any processing; it only displays the result of the processing performed by the model, and interacts with the user.
The Controller manages synchronization events between the Model and the View, and updates both as needed. It receives all the user events and triggers the actions to perform.
How mvc work in Prestashop?
If an action needs data to be changed, the Controller will request the Model to change the data and in turn the Model will notify the View that the data has been changed, so that the View can update itself.
PrestaShop 1.7 features
Create a Product Page X2 faster and easier
A brand new way to add products in catalogue! Refreshed interface, quick actions, shortcuts, automatic management for combinations and much more
How to install PrestaShop?
Choose the right version for you
Release package. A zip package, tuned for production environments
Follows installation instructions here
How to enable / disable prestashop debug?
After I enabled debugging, in admin I had the following error:
Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/cpanel/php/sessions/ea-php56) failed: Permission denied (13)
The site is down and I can’t access the performance page in back office to turn it off.
To solve this issue I had to deactivate debugging from config/defines.inc.php.
Leaving debug mode turned on can lead to unpredictable results for visitors.
Whenever possible login to your hosting and view php error log there rather than using this method.
Here is a quick guide on how to get the information you need to either debug yourself or post on the forums for community help.
Note: you will need to use an FTP program to turn on PrestaShop error reporting or access via hosting file manager.
HOW TO ENABLE PRETASHOP DEBUG:
Debug Mode can be enabled/disabled from the back office -> Advanced Parameters > Performance
open file: config/defines.inc.php
change false to true:
Prestashop installation issues and errors
Compile Error: Cannot declare class AppKernel, because the name is already in use
You may find this error message the first time you open up the Back Office.
This problem may arise in case-insensitive file systems like MacOS due to a misconfiguration. Check your Apache configuration and make sure that the root directory path to your PrestaShop matches the capitalization of the actual system path exactly. A typical error is for example having a folder named /path/to/PrestaShop (capital P, capital S) and then configuring it in Apache as /path/to/Prestashop (missing the capital S).