PrestaShop's theme system is based on a template engine, called Smarty, which allows web-designers and developers to easily build their own theme, with little technical knowledge.
All web-designers and developers should use the following tools:
Internet Explorer users can also make use of Firebug lite. |
Thanks to PrestaShop's theming system, shop owners can easily customize their online shop.
The whole system is built upon the Smarty template engine, which enables HTML integrators to easily work their theme, witout any (or few) technical constraints.
The default PrestaShop theme is neutral, in gray tones, so as to enable shop owners to get started quickly whatever their business area.
More than 500 other themes have been created, and are available for free or for sale on PrestaShop Addons. They were either made by the PrestaShop team, or by members of the PrestaShop community.
As a developer/HTML integrator, you too can sell your themes on PrestaShop Addons, and earn 70% of your sales.
A PrestaShop theme is a set of files which you can edit in order to change the look of your online shop.
Here are a few important tidbits:
/themes
root folder./tpl
), image files (.gif
, .jpg
, .png
), one or more CSS files (/css
), and sometimes even JavaScript files (.js
).preview.jpg
image file in its folder, enabling the shop-owner to see what the theme looks like directly from the back-office, and select the theme appropriately.Here is an overview of the file structure of a PrestaShop theme (here, the default one):
/css
folder contains all CSS files./img
folder contains all images./js
folder contains all the JavaScript files./lang
folder 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.preview.jpg
file.The |
All of your theme's text string should be enclosed in a Smarty function, like so:
{l s='My Text'} |
This will enable anyone to translate the theme into his own language, using the internal translation tool, which you can find in the PrestaShop back-office, under the "Tools" tab and its "Translation" sub-tab. In the "Modify translations" section, use the drop-down menu, choose "Back Office translation", then click on the flag of the language you wish to translate strings into. All the back-office strings will then be displayed, and the strings for your theme are those whose sections are not prefixed with "Admin*".
h3 Transmitting data to a PrestaShop theme
The following graphic explains how data is transmitted from PrestaShop's core to its theme. Using the l()
method enables the theme to display its text in the chosen language, if it has been translated beforehand.
Here is a non-exhaustive list of best practices that you should follow when creating a theme:
.css
file.You can download the PrestaShop 1.4 SQL schema in PNG form (1 Mb), or in the original MySQL Workbench file format (you will need MySQL Workbench to view it).
Follow the following steps below to create your own theme out of the PrestaShop default theme.
/themes
directory in your PrestaShop install, and create a copy of the default ../themes/prestashop/
directory./themes/MyStoreTheme/
), locate the /css
folder.global.css
file and change it according to your needs. This is where you are only limited by your creativity – and your knowledge of CSS.maintenance.css
file, located in the same folder, controls the layout of the Maintenance Mode page./img
folder (e.g., /themes/MyStoreTheme/img
).
|
Once your customized theme is ready, you must place a file representing the theme, called preview.jpg
, in the theme's root folder (e.g., /themes/MyStoreTheme
). This file must be a 100 × 100 pixels .jpg
file.
Show off your hard work, get feedback, and build your reputation by sharing your theme in the Themes section of our Forum!
You can also sell your theme to PrestaShop users through our Addons website!
The default theme was conceived in a neutral style, and as such can be use for just about any type of shop, independent of the industry. Moreover, this theme does its best to conform to web standards, as established by the W3C, and has been optimized to display efficiently in all major browsers.
That being said, you might want to have a theme that is really tailored to your website or online activity, rather than having the same theme as thousands of online shops. This is were you need to build your own theme – and the easiest way to do it is to use the default theme as a solid groundwork, or at least as inspiration.
All currently-installed themes are found in the /themes
folder, where your own will soon be too. the default theme is located in the /themes/prestashop
sub-folder. This is the folder from which you will build your own theme.
That being said, it is highly discouraged to directly change the files for the default theme, the reason being that this could introduce news bugs and no way to go back. You need to keep the default theme intact, so that you can switch between your theme and the default one in order to find out if the issue you are seeing is tied to your theme, or to a bug in another part of PrestaShop.
The first step will therefore be to make a copy of the /prestashop
sub-folder, and give that copy a unique name, for instance the name of your own theme or website. This way, the default theme remains intact.
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.
File or folder |
Description |
---|---|
preview.jpg |
This image is used as a preview in the "Theme" selector in the "Preferences" > "Appearance" sub-tab. This image is mandatory, as without it the them cannot be selected. It should obviously reflect the theme's design, and not its logo or designer's name... |
404.tpl |
Used when the requested page is not found (HTTP error 404). |
address.tpl |
Used when adding or editing a client street address. |
addresses.tpl |
Used when listing a client's street addresses. |
authentication.tpl |
Used when identifying a user, or creating a new user account. |
best-sales.tpl |
Used to list all best sale. |
breadcrumb.tpl |
Used to find the navigation path, or breadcrumb trail. |
category.tpl |
Used to list all products in a given category. |
category-tree-branch.tpl |
Used only by the Category block. |
category-cms-tree-branch.tpl |
... |
cms.tpl |
Used for informational pages ("Tools" > "CMS" sub-tab). |
contact-form.tpl |
Used by the contact form. |
discount.tpl |
Used when listing all discount tickets for a single client. |
errors.tpl |
Used when displaying errors. Potentially called by all of the pages. |
footer.tpl |
Page footer. |
guest-tracking.tpl |
Used when a visitor has no know account on the site, but wants his order to be tracked – and therefore needs to create an account or log in. |
header.tpl |
Page header |
history.tpl |
Used when lsiting the order history of a client. |
identity.tpl |
Used when a client edits his/her personal information. |
index.php |
Blank file, prevents visitors to view the content of the folder. |
index.tpl |
Welcome page. |
maintenance.tpl |
Used when the site is in maintenance mode. |
manufacturer.tpl |
Used when listing all products from a single manufacturer. |
manufacturer-list.tpl |
Used when listing all manufacturers. |
my-account.tpl |
Weclome page for a client's account. |
new-products.tpl |
Used when listing the products that were last added to the cart. |
order-address.tpl |
Used during the order process: Step 1, choosing the addresses (delivery, billing). |
order-carrier.tpl |
Used during the order process: Step 2, choosing the carrier mode. |
order-confirmation.tpl |
Used during the order process: Last step, confirming the order (after payment). |
order-detail.tpl |
Used to display the content of a client's order. |
order-follow.tpl |
Used when a client needs to ask for a product return. |
order-opc.tpl |
... |
order-opc-new-account.tpl |
... |
order-payment.tpl |
Used during the order process: Step 3, choosing the payment mode. |
order-return.tpl |
Used to display a client product return details. |
order-slip.tpl |
Used to display a client's credit slips. |
order-steps.tpl |
Order process progress bar. |
pagination.tpl |
Used by all pages that list products. Displays the pagination button, enable to skip to the next/previous page of products. |
password.tpl |
Used when a client needs to change his password. |
prices-drop.tpl |
Used to list all current promotions. |
product.tpl |
Used to display details for a single product. |
product-list.tpl |
Used by all pages that list products. Displays the actual products list. |
product-sort.tpl |
Used by all pages that list products. Displays a menu enabling to sort and filter products. |
products-comparison.tpl |
... |
scenes.tpl |
Used to display a scene's details within a product category. |
search.tpl |
Used to list results from a search query. |
shopping-cart.tpl |
Used to list products in a client's cart. |
shopping-cart-product-line.tpl |
Used to display from a single cart row. |
sitemap.tpl |
Used to display the site map. |
store_infos.tpl |
... |
stores.tpl |
... |
supplier.tpl |
Used to list all the products from a single supplier. |
supplier-list.tpl |
Used to list all suppliers. |
thickbox.tpl |
Used to zoom a product's picture. |
/cache |
... |
/css |
Contains all style sheet files for the theme. The |
/img |
Contains all of the theme's images. You should replace these images with your own adequate creations. If you do not know what to make of it, you should leave the original files. |
/js |
Contains all of the theme's JavaScript files. Unless you know exactly what you are doing, you should leave these files alone. |
/lang |
Contains all translation files. These are generated by the back-office translation tool, and should not be edit directly. If a translation needs editing, go to the back-office, "Tools" tab, "Translation" sub-tab, "Modify translation" section, and choose "Front office translations". |
Firebug, Dragonyfly et al.: your work as a front-end developer can greatly helped with the right tools at hand, provided you test your design in a modern browser that provides such tools, either through a module (Firefox's FireBug) or directly embedded (Opera's Dragonfly, Chrome & Webkit's Web Inspector). Learn to master them, and you will quickly be amazed by their usefulness.
JavaScript: all JavaScript files should be stored in the theme's /js
folder.
preview.jpg file: Once your design is complete, you can create the preview image file. Take a screen shot, then resize it to 180px width in order to use it instead of the default preview.jpg
file. You can either used the screenshot tool provided by your OS (Windows' Snipping Tool, OS X's Cmd+Shift+4 key combo), or install a browser extension, such as Firefox's FireShot or Screengrab.
One of the key point of integrating content within a PrestaShop theme is to know where said content is displayed, and therefore where the various hooks and modules are located.
Here is a graphical representation of where they are, for each page. You will find: