Laying the Theme's Foundations

The first two chapters of this guide were theoretical; this one gets practical.

We are going to create the fundamental files and folders for your theme, and there are two ways of achieving that:

Needless to say, we strongly advise you to choose the first option: a minimal PrestaShop requires many files and lines of code, some of which you are bound to forget when starting from scratch.

Building a PrestaShop is a complex endeavor. For instance, in comparison with a WordPress theme, which could work with a single index.php file, a minimal PrestaShop requires many more pages: home page, product page, user account pages, cart page, order process pages, etc. Building a theme for an e-commerce site implies a much more complex and intertwined set of pages and templates.

This is why we advise to start your own theme by using the foundations laid by the default theme. Complete and proven, PrestaShop's default theme ensures that all necessary pages are already in places, leaving you the freedom to rework the page display, to use your own images, to enhance it with your own scripts.

Standing on the shoulders of giants: copying the default theme

Duplicating the files of the default theme is easy, and even that can be done using two different ways.

From the back-office

PrestaShop's back-office can help you create a new theme folder based on any other installed theme, all in a couple of clicks:

  1. Go the "Themes" preference page.
  2. Click on the "Add new theme" button, at the top right of the screen.
  3. In the "Import theme" screen that opens, scroll down to the "Create new theme" section and click on the "Create new theme" button.
  4. In the creation form that appears, fill-in the various fields:
  5. Click on the "Save" button.

PrestaShop will create the theme's folder and copy all the needed files from the source theme, leaving you free to experiment with those files.

From your operating system / FTP server

You can of course create that copy yourself:

  1. Go to the /themes folder for your installation of PrestaShop (either online or on your desktop).
  2. Create a new folder for your theme. It should be the final name of your theme, in a single lowercase word. Make sure to check on the Addons website that no other theme is already using that name, even more so if you plan to eventually sell that theme online.
  3. Copy the content of source theme's folder (for the 1.6 default theme, /default-bootstrap) and paste it in the newly created folder.

That's it!

Cleaning up

Both the default theme and your installation of PrestaShop contain a payload of content and styles that are not necessarily useful to your own theme. For instance, many modules are installed and activated by default by PrestaShop's installer. While some are necessary for the proper functioning of a complete store, others can simply be put aside while you build the theme.
It is your duty as a theme developer to build templates and styles for at least all the default PrestaShop modules (or at least adapt the default ones), along with the ones for any additional modules that you plan your theme to support.

The point here is that a theme must come packed with custom templates and CSS files for the default PrestaShop modules. These template files are stored in the /modules subfolder of the theme's folder, while the styles are in the /css/modules subfolder.
For instance, in the default theme, the files for the Layered Navigation module can be found in the following paths:

As you can see, if all you want to change in a module's front-office appearance while keeping its organzation, you only have to edit its CSS file and leave its template file alone. For instance, to change the styling of the Layered Navigation module, you should put your customized version in this folder: /themes/YOUR_THEME/css/modules/blocklayered/blocklayered.css. Just make sure to use the same file path as the original module files.

Necessary modules

The necessary module templates are:

Module name

Why it is necessary

blockcart

Displays the whole order & payment process.

blockmyaccount

Displays the user creation process.

You simply cannot sell a product if your theme does not support these modules.

Must-have modules

There also are modules which, while not necessary for a functioning store, should still be included when designing a theme. You should try your best to build your theme with these modules in mind.

The "Must have" module templates are:

Module name

Why it is necessary

blockcategories

Displays the product categories.

blockcms

Lists and displays the CMS pages (i.e. Terms & Conditions, Legal notice, etc.).

blockcontact

Displays the Customer Service information.

blockcontactinfos

Displays the stores contact info.

blockmyaccountfooter

Displays links to the user's account pages in the footer.

blocksearch

Displays the searchh engine and its results.

blocktags

Displays the product tags.

homefeatured

Displays featured products.

Good-to-have modules

Finally, these modules are not as important as the others ones, but bring a lot of value to your store, and helps your customers discover products and learn more about your store. Again, you should design your store with these modules activated.

The "Good to have" module templates are:

Module name

Why it is necessary

blockbestsellers

Displays the best-selling product.

blocklayered

Displays layered navigation filters.

blocklinks

Displays additional custom links.

blockmanufacturer

Lists and displays the manufacturers/brands of the store's products.

blocknewprodutcs

Displays the newest produts.

blocknewsletter

Displays a form where customers can subscribe to your store's newsletter.

blockrss

Displays the content of an RSS feed from another site.

blocksocial

Displays information about your store's social networking pages.

blockspecials

Displays the current discounts.

blocstore

Displays a link to the store located.

blocksupplier

Lists and displays the suppliers of the store's products.

blockviewed

Lists the products that the customer viewed last.

blockwishlist

Displays the customer's wishlists.

productcomments

Displays a comment section in each product page.

All these module templates are included by default in the default theme's /modules folder, because they are front-end features that are needed by that theme. You can safely disable/uninstall any other module in the back-office "Modules" page. This enables you to start on a somewhat clean slate.

A fully clean slate would be to disable all modules and re-install them one by one, enabling you to integrate them into your design while building you theme. This is a good way to work, as you it helps you know which content broke your page layout, but it takes longer to reach your goal. Keep a known set of essential modules helps you build your theme faster while making sure it will work in most configuration.

Creating content

Your theme will display content taken from the PrestaShop database. Whether you plan on keeping the theme to yourself or share/sell it for others to use, you simply cannot start designing it without content, along with the activation of some key features that any store might use, along with yourself.

The demo data installed with PrestaShop is enough to help with it, as it features products, categories, stores, etc. Starting with a fresh installation of PrestaShop gives you a head-start with demo content, while empty stores will require you to start adding content (either fake or real) to the store in order to actually see your theme react to it.

Design!

Now that the default theme has been turned into a folder of its own, it is time for you to explore its files: Smarty templates, CSS rules, JavaScript codes, location of the hooks and content blocks... Everything can be changed, and it is up to you to rework it the way you want!

Scratching that itch: creating all files from zero

Oh wow. Really? You want to do it all by hand? That's courageous, but we'll try to help.

First, here is the list of necessary template files (spoiler alert: there are 60 of them. Yes, all are necessary to various PrestaShop features):

File nameWhy it is necessaryOther template files used by this template in the default theme
404.tplDisplays when a file cannot be found. 
address.tplEnables the customer to create a new address.
  • errors.tpl
addresses.tplEnables the customer to view her current addresses. 
authentication.tplEnables the customer to log into her account.
  • order-steps.tpl
  • errors.tpl
best-sales.tpl

Displays the best-selling products.

  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-list.tpl
breadcrumb.tpl Displays the category path to the current product/category.
  • breadcrumb.tpl
category-cms-tree-branch.tplRuns through the CMS categories in order to display them.
  • category-cms-tree-branch.tpl
category-count.tplDisplays the number of products in a category. 
category-tree-branch.tplRuns through the product categories in order to display them.
  • category-tree-branch.tpl
category.tplDisplays the content of a category: scene, image, text, product comparator, etc.
  • errors.tpl
  • scenes.tpl
  • category-count.tpl
  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-list.tpl
  • product-compare.tpl
cms.tplDisplays the content of a CMS page. 
contact-form.tplDisplays the customer contact form.
  • errors.tpl
discount.tplDisplays the list of the customer's vouchers. 
errors.tplDisplays the current error(s). 
footer.tplDisplays the footer.
  • global.tpl
global.tplDefines several Smarty variables, most notable JavaScript ones. 
guest-tracking.tplDisplays the tracking page for guest customers (visitors with no account).
  • order-detail.tpl
header.tplDisplays the header: HTML doctype, links to CSS files, etc.
  • breadcrumb.tpl
history.tplDisplays all her previous orders to the customer.
  • errors.tpl
identity.tplDisplays and updates the customer's personal information.
  • errors.tpl
layout.tplCalls upon the main bricks of the theme: header, footer, columns, current template and Live Edit.
  • header.tpl
  • footer.tpl
maintenance.tplDisplays a special page for when the store is in maintenance. 
manufacturer-list.tplDisplays a list of all manufacturers.
  • errors.tpl
  • nbr-product-page.tpl
  • pagination.tpl
manufacturer.tplDisplay the products from a single manufacturer.
  • errors.tpl
  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-list.tpl
my-account.tplDisplays the customer's account page. 
nbr-product-page.tplDisplays the number of products in the current page. 
new-products.tplDisplays a block with the new products.
  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-compare.tpl
  • pagination.tpl
order-address-multishipping-products.tplDisplays the addresses to deliver a product to in a multishipping situation.
  • order-address-product-line.tpl
order-address-multishipping.tpl 
  • order-steps.tpl
  • errors.tpl
  • order-address-multishipping-products.tpl
order-address-product-line.tpl  
order-address.tpl 
  • order-steps.tpl
  • errors.tpl
order-carrier.tpl 
  • order-steps.tpl
  • errors.tpl
order-confirmation.tpl 
  • errors.tpl
  • order-steps.tpl
order-detail.tpl  
order-follow.tpl  
order-opc-new-account.tpl  
order-opc.tpl 
  • shopping-cart.tpl
  • order-address.tpl
  • order-opc-new-account.tpl
  • order-carrier.tpl
  • order-payment.tpl
  • errors.tpl
order-payment.tpl 
  • errors.tpl
  • order-steps.tpl
  • shopping-cart-product-line.tpl
order-return.tpl 
  • errors.tpl
order-slip.tpl  
order-steps.tpl  
pagination.tpl  
password.tpl 
  • errors.tpl
prices-drop.tpl 
  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-list.tpl
  • product-compare.tpl
  • pagination.tpl
product-compare.tpl  
product-list-colors.tpl  
product-list.tpl  
product-sort.tpl  
product.tpl 
  • errors.tpl
  • product-list.tpl
products-comparison.tpl  
restricted-country.tpl  
scenes.tpl  
search.tpl 
  • errors.tpl
  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-list.tpl
shopping-cart-product-line.tpl  
shopping-cart.tpl 
  • order-steps.tpl
  • errors.tpl
  • shopping-cart-product-line.tpl
sitemap.tpl 
  • category-tree-branch.tpl
  • category-cms-tree-branch.tpl
stores.tpl  
store_infos.tpl  
supplier-list.tpl  
supplier.tplMakes it possible to display the list of products per supplier.
  • errors.tpl
  • product-sort.tpl
  • nbr-product-page.tpl
  • product-compare.tpl
  • pagination.tpl
  • product-list.tpl