About Prestashop, Tips & Tricks

5/5 - (1 vote)

About prestashop

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:

  1. Object/data. Database access is controlled through files in the “classes” folder
  2. Data control. User-provided content is controlled by files in the root folder.
  3. 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.

How to make phone field as required field?

When creating a user account the phone field is optional. To make it mandatory in Prestashop 1.7.5 go to

Customers/ Addresses, at the bottom, set required fields.

About MVC architecture

Model

The model represents the application’s behavior: data processing, database interaction, etc.

View

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.

Controller

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?

Download PrestaShop

The source code of PrestaShop is hosted on the official PrestaShop GitHub Repository.
You can find here all the released versions of PrestaShop.

Choose the right version for you

Release package. A zip package, tuned for production environments

Development version.

The raw source code as it is on the GitHub repository, including build scripts and source codes for assets that are otherwise compiled (like javascript and css files).

Installing PrestaShop

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:

PrestaShop 1.7

Debug Mode can be enabled/disabled from the back office -> Advanced Parameters > Performance

PrestaShop 1.6

open file: config/defines.inc.php
change false to true:
define(‘_PS_MODE_DEV_’, false);
define(‘_PS_MODE_DEV_’, 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).

Hello there!

I hope you find this post useful!

I'm Mihai, a programmer and online marketing specialist, very passionate about everything that means online marketing, focused on eCommerce.

If you have a collaboration proposal or need helps with your projects feel free to contact me. I will always be glad to help you!

subscribe youtube

Leave a Comment

WebPedia.net