PrestaShop template file are based on the Smarty 3 template engine.
All template files must be stored in the theme’s
templates/ subfolder. For instance, the default theme
has its template files in the following folder:
Templates are then split between various subfolders.
Template files should be written so that a single .tpl can generate a whole HTML page – unless they are
_partials folder or subfolder (see our coding standard, linked from the Prologue chapter
of this documentation).
We make a clear difference between templates and layout.
There are many templates in a PrestaShop theme, the main ones includes:
If you’re working on a big store in many languages you may need to change the layout of the page depending on the language.
For example you want a different product page for american customers and japanese ones.
In this case you simply have to create new template
product.tpl and place it in
the right folder.
When searching for a template, PrestaShop will check many location to determine which file should be used. It make it very easy to have different template for a given locale or a specific entity id.
With the product page, the core will check the following locations (in order) and return the first template found:
Example with a product with ID = 3 and locale = en-US
Another example with category template for the category with ID = 9 and locale = en-US.
This feature is mostly made for developer working on a custom template for a customer.
The layout is the organisation of the page, the way in which the parts of your design are arranged. The typical example is the sidebar: is there a sidebar on your category page or is your product listing is taking the whole space.
With PrestaShop 1.7, user are given the ability to change the layout of each page independantly. As a template developer, it’s your role to ensure your theme is compatible.
The layout is the very top level of the template inheritance
tree. Basically it hold the opening and closing
Typical layout files look like the following snippet. This one is a full one
From there, each part of the theme will do its job and replace content inside these bricks, keeping the same organization.