Child pages
  • Theme development fundamentals

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PrestaShop's theme system is based on a template engine, called Smarty (http://www.smarty.net/), which allows web-designers and developers to easily build their own theme, with little technical knowledge.

Tip

All web-designers and developers should use the following developer tools:

They provide a lot of useful tools, among which DOM explorer, CSS editors, network inspector, etc., and are a huge help when debugging HTML, CSS, JavaScript, and even Ajax requests.

 

PrestaShop's technical architecture

...

Concepts and technical information

Best practices

Here is a non-exhaustive list of best practices that you should follow when creating a theme:

  1. Do not mix HTML and PHP code, use Smarty tags in order to a dynamic page.
  2. Do not mix HTML and CSS code, put the CSS code in a separate .css file.
  3. Always validate your HTML and CSS code using the W3C validators: http://validator.w3.org/ for HTML and XHML, http://jigsaw.w3.org/css-validator/ for CSS.
  4. Do not make SQL queries from a PHP controller (.php file at the root of PrestaShop); prefer the use of existing methods from the PrestaShop classes, or create new methods for these classes.
  5. Always check if a method you need does not already exist in the available classes.
  6. Always make sure to produce a clear and readable code, making it easy to maintain for anyone.
  7. Do comment your code, and write in English.
  8. When editing the theme on a production site, always put the shop in maintenance mode first, via the back-office' "Maintenance" preference page.
  9. Use modern browsers, such as Firefox, Google Chrome, IE9 or Opera (and make sure your friends and family members do too.
  10. Whenever possible, use CSS sprites (read http://www.alistapart.com/articles/sprites and http://www.alistapart.com/articles/sprites2/).

How a theme works

A PrestaShop theme is a set of files which you can edit in order to change the look of your online shop.

...