Throughout the whole front office, the customer can receive notification messages from PrestaShop, to inform her about successes or errors for instance. Your theme can too send notifications when certain events occur.
The notification messages are not hardcoded in the template files, but are sent from the controller, so that you have consistency in case you update/change your theme. Also, this way there is a better chance that all notification messages are already translated into your language!
Types of notifications
An array of notification is passed to the templates, containing at least one of these:
|success||An action was performed and everything went well.|
|error||Something went wrong.|
|warning||Important notice the merchant should know about.|
|info||“just so you know”.|
How to display notifications
In the Starter Theme, notifications are implemented as a partial template file:
…and are then included in the template file:
Add your own message in your front controller
Your front controller holds the 4 following variables:
They are PHP arrays, and they hold messages as a string.
Since PrestaShop 1.7, you can redirect the customer AND display a message after an action.