Theme Migration from Prestashop 1.6 to 1.7: Requirements and Coding Standards

May 17, 2018460Sergey Samets
Theme Migration from Prestashop 1.6 to 1.7: Requirements and Coding Standards

A distinctive feature of CMS Prestashop is that we get a ready-made working online store out of the box, which is made in a minimalist design and is adaptable for any devices.

After we installed Prestashop on our server (here is an article on our blog on Prestashop installation), we now have several options. You can leave a standard theme, slightly modifying it according to your style (change fonts, text and background colors, logos and banners), or you can install your own choosing from a variety of themes in our Prestashop Theme Marketplace. But if you want a truly unique site, then it’s better to turn to professionals and order the development of your unique theme.

Migrating from Prestashop 1.6

Prestashop developers set a goal to simplify and speed up the process of creating new topics. For this purpose, the theme system in Prestashop 1.7 was completely redesigned comparing to its 1.6 version. Some of the functions were removed in 1.7, as they were either obsolete in 1.6, or too problematic to support in 1.7.

The developers achieved their goal: it became much easier and faster to create a new topic in Prestashop 1.7. However, due to the fact that the theme system has undergone such fundamental changes, there is no easy way to migrate from Prestashop 1.6 theme to Prestashop 1.7.

If you use the automatic update from 1.6 to 1.7, your theme will switch to a new one by default (it’s called “Classic”). In other words, your theme from Prestashop 1.6 will not work in Prestashop 1.7 and you will have to develop a new theme for Prestashop 1.7 before migrating to this version of Prestashop.

Prestashop server requirements

CMS Prestashop 1.7 makes the following requirements to the server (a selection from the official Prestashop system requirements):

  • Recommended webserver: Apache 2.x или Nginx (works also with Apache 1.3 or Microsoft IIS);
  • PHP 5.4+;
  • MySQL 5.0+ with installed database;
  • In the PHP configuration (php.ini file) set the memory_limit to “128M” and upload_max_filesize to “16M” (or more, if available);
  • SSL-certificate if you plan to process payments within the country (for example, without using PayPal);
  • Compulsory PHP extensions: Mcrypt, OpenSSL, Zip, Curl, GD, PDO;
  • MemCached, mcrypt PHP extensions for better performance.

When creating your theme, remember that your site (HTML/CSS/JS code) should work correctly on the two latest versions of all most popular browsers (Chrome, Firefox, Opera, Edge, Safari for macOS, IE9 +), as well as on iOS and Android-based mobile browsers.

Coding standards and guidelines

When developing your theme or module in CMS Prestashop, it is better to stick to the generally accepted standards for writing code, that are relevant for this particular CMS. This will allow you to better navigate in third-party developers’ code and vice versa.

The official Prestashop website provides the following coding recommendations and standards.

General coding rules

  • Indentation with spaces for PHP-files must be 4 spaces, for other types of files – 2 spaces;
  • It is recommended to use the .editorconfig file created by the Prestashop developers for your code editor. You can find out more about this file here.

PHP files

HTML file

  • Use HTML5 tags (for example: nav, section, header, footer, etc.), do not close single tags (such as <br>, <img>, etc.). In short, your HTML file must meet all the HTML5 standards;
  • All the opened tags must be closed within one template file (for example: do not open the <div> tag in header.tpl with closing it in footer.tpl);
  • Subpatterns (templates to be included in another template) must be located in the / _partials / folder.

CSS

  • Use all the CSS3 features (new properties like flex, animation, etc.). Experiment with the new features of CSS3, but always remember to check if the properties work correctly in all the supported browsers. You can do it with the help of caniuse.com service;
  • Prestashop developers recommend to follow the RSCSS structure while working with CSS.

JavaScript

  • While working with JS, it is recommended to split our script into several files for greater usability, and then compile them into one;
  • If you want to code in ECMAScript 2015 (ES6), I recommend using the Babel compiler. Click here to read more about ECMAScript 2015 standards.

You can find out more about the differences between the two versions of Prestashop in our Prestashop 1.6 vs 1.7 Comparison article.



Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *