Child pages
  • Theme development fundamentals

Versions Compared

Key

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

...

PrestaShop's templating system enables web-designers and developers to easily build their own theme, provided they have a solid technical grounding.

This The templating system is based on a 3-tier architecture:

...

See Wikipedia for more information on the 3-thier tier architecture: http://en.wikipedia.org/wiki/Multitier_architecture#Three-tier_architecture

...

  • All themes have their files located in the /themes root folder.
  • Each theme has its own sub-folder, in the main themes folder.
  • Each theme is made of template files (.tpl), image files (.gif, .jpg, .png), one or more CSS files (.css), and sometimes even JavaScript files (.js).
  • Each theme has a 180*200 preview.jpg image file in its folder, enabling the shop-owner to see what the theme looks like directly from the back-officeback office, and select the theme appropriately.

...

  • All themes have their files located in the /themes root folder.
  • Each theme has its own sub-folder, in the main themes folder.
  • Each theme is made of template files (.tpl), image files (.gif, .jpg, .png), one or more CSS files (.css), and sometimes even JavaScript files (.js).
  • Each theme has a 180*200 preview.jpg image file in its folder, enabling the shop-owner to see what the theme looks like directly from the back-officeback office, and select the theme appropriately.

...

  • The /css folder contains all CSS files.
    • The /sass folder contains all the Sass .scss source files, before they are compiled into the CSS files.
  • The /font folder contains the needed font files.
  • The /img folder contains all images.
  • The /js folder contains all the JavaScript files.
  • The /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.
  • The /mobile folder contains the mobile version of the theme.
  • The /modules folder contains the needed template files for many modules.
  • The root of the folder contains TPL files only (Smarty files), as well as the preview.jpg thumbnail file.

...

Smarty 2 has long been deprecated, and should not be used for PrestaShop 1.6 themes.

Bootstrap v3

Since version 1.6, PrestaShop includes the Bootstrap front-end framework (http://getbootstrap.com/). It is a collection of HTML and CSS tools built to help web designer create consistently beautiful and responsive designs (meaning that they can easily adapt to any screen size). Initially an internal effort to document and share common design patterns and assets within the Twitter company, it has quickly grown to become the most used front-end framework.

PrestaShop uses Bootstrap for both its front - office and back - office default templates.

Info

Designers creating a new back - office theme MUST use Bootstrap.

Designers creating a new front - office theme CAN SHOULD use Bootstrap, but . While this is currently not an obligation, Bootstrap is deeply built into PrestaShop.

Bootstrap initially uses the LESS dynamic stylesheet language (http://lesscss.org/), but PrestaShop uses the Bootstrap For Sass port (https://github.com/twbs/bootstrap-sass), Sass being the language that inspired LESS. This makes it possible to use the Compass framework.

...

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

...

  1. Do not mix HTML and PHP code; use Smarty tags in order to get 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 XHTML, 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); use the existing methods from the PrestaShop classes, or create new methods for these classes.
  5. Always check if a method you need already exists in the available classes.
  6. Do not ever edit PrestaShop's own files; always build your code into modules in order to facilitate updates.
  7. Make sure to always produce a clear and readable code, making it easy to maintain that code for anyone in the foreseeable future.
  8. Do comment your code, and write both method names and comments in plain English.
  9. When editing the theme on a production site, always put the shop in Maintenance Mode first, via the back-officeback office' "Maintenance" preference page.
  10. Use modern browsers, such as Firefox (latest non-beta version), Google Chrome (latest non-beta version), IE10+ or Opera (latest non-beta version) – and make sure your friends and family members do too!
  11. Whenever possible, use CSS sprites (read http://www.alistapart.com/articles/sprites and http://www.alistapart.com/articles/sprites2/).
  12. Disable your browser's cache when developing.