When creating a theme, you have to think up front of all the various pages and pieces of information that your theme has to handle correctly, in order to offer a complete experience to your customer. Here again, the default theme is a good way to get inspiration, both in the variety of files it features and behaviors it caters for, but also in its code, which you can dive into in order to better understand how a theme works.
First, here is the list of necessary template files (spoiler alert: there are 60 of them. Yes, all are necessary to various PrestaShop features):
Why it is necessary
Other template files used by this template in the default theme
|404.tpl||Displays when a file cannot be found.|
|address.tpl||Enables the customer to create a new address.||
|addresses.tpl||Enables the customer to view her current addresses.|
|authentication.tpl||Enables the customer to log into her account.||
Displays the best-selling products.
|breadcrumb.tpl||Displays the category path to the current product/category.||
|category-cms-tree-branch.tpl||Runs through the CMS categories in order to display them.||
|category-count.tpl||Displays the number of products in a category.|
|category-tree-branch.tpl||Runs through the product categories in order to display them.||
|category.tpl||Displays the content of a category: scene, image, text, product comparator, etc.||
|cms.tpl||Displays the content of a CMS page.|
|contact-form.tpl||Displays the customer contact form.||
|discount.tpl||Displays the list of the customer's vouchers.|
|errors.tpl||Displays the current error(s).|
|footer.tpl||Displays the footer.||
|guest-tracking.tpl||Displays the tracking page for guest customers (visitors with no account).||
|header.tpl||Displays the header: HTML doctype, links to CSS files, etc.||
|history.tpl||Displays all her previous orders to the customer.||
|identity.tpl||Displays and updates the customer's personal information.||
|layout.tpl||Calls upon the main bricks of the theme: header, footer, columns, current template and Live Edit.||
|maintenance.tpl||Displays a special page for when the store is in maintenance.|
|manufacturer-list.tpl||Displays a list of all manufacturers.||
|manufacturer.tpl||Display the products from a single manufacturer.||
|my-account.tpl||Displays the customer's account page.|
|nbr-product-page.tpl||Displays the number of products in the current page.|
|new-products.tpl||Displays a block with the new products.||
|order-address-multishipping-products.tpl||Displays the addresses to deliver a product to in a multishipping situation.||
|supplier.tpl||Makes it possible to display the list of products per supplier.||
Let's diving into the way a theme is organized: folders, files, where they belong and how to handle them correctly
Organization of a Theme
- Organization of a Theme
- Thumbnail file
- CSS and Sass
- Sass / Compass
- The mobile theme
- Templates files
- Style sheets
- Image files
The main folders of any PrestaShop theme are those:
/cachefolder contains all the temporary files that are generated and reused in order to lighten the server load. The folder is empty by default.
/cssfolder contains all CSS files.
/sassfolder contains all the Sass
.scsssource files, before they are compiled into the CSS files.
/fontfolder contains the needed font files.
/imgfolder contains all images.
/langfolder contains the theme's translations. Its access rights should be set at CHMOD 666 (for instance), so that the back office translation tool can read and write into it.
The following folders are not directly theme-related, but help you make sure the whole of PrestaShop's feature have a design that is consistent with your theme:
/mailsfolder contains the templates for the emails that PrestaShop sends (order confirmation, password request, shipping notifications, etc.).
/mobilefolder contains the mobile version of the theme.
/modulesfolder contains the template files for many modules.
The root of the folder contains TPL files only, as well as the
preview.jpg thumbnail file.
preview.jpg file at the root of the theme's folder is the thumbnail that is used by PrestaShop in its back office theme selector.
It serves as a visual reminder of what the theme is, and you should therefore make it a screenshot rather than your company's logo.
It can have any size – the default theme's is 180*445 pixels.
It must be a JPEG file.
CSS and Sass
The theme's CSS files are located in the
It is recommended to have a common style sheet for global CSS rules:
Then, each of the controller should have its own CSS file: for instance,
product.css for the Product page.
Sass / Compass
Sass and Compass files are optional: you do not need to use these tools to build the CSS files for your back office theme.
If you do use Sass and Compass, we strongly advise to put the source
.scss files in the
/sass theme, so that other developers can have access to theme and rework them more easily.
From there, you can generate the CSS files in the
/css folders from the Sass files in the
/font folder is optional: it contains the fonts that you chose to use for your theme.
For instance, the default PrestaShop theme uses the Font Awesome font set (http://fortawesome.github.io/Font-Awesome/) for its responsive icons, and therefore has the following files in its
If you do not build your theme with a specific font or icon set in mind, you can skip this folder.
Theme-related images are to be stored in the
You can create sub-folder for a better organization. For instance, the default theme has the following subfolders:
/iconfor simple icons (for instance, those not available in your chosen font set).
/jqueryfor jQuery-specific images.
You can create more if needed.
All the translation files are to be stored in the
Files should be named after their ISO 3166-1 alpha-2 code in lowercase: for instance,
These files should be generated by PrestaShop integrated translation tool (located in the Localization / Translations menu).