Child pages
  • New Developers Features In PrestaShop 1.5

Versions Compared

Key

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

...

New Developers Features In PrestaShop 1.5

The new version of PrestaShop brings a lot of new and updated features to improve online shopping for both customers and shop owners, and the API have been dutifuly dutifully updated and expanded in order to help developers and designers leverage these new possibilities.

The technical documentation itself has been updated to reflect the new state of working with PrestaShop. This chapter describes all the changes between v1.4 and v1.5, in order to help you get up to date quickly.

PrestaShop Core

Info

Coming soon...

Module API

There are six main aspects of PrestaShop's Module API which received a significant overhaul for version 1.5: dynamic hooks, evolution of the override system, new filetree and operations, multishop feature, Addons webservice, and the update system. We will explore these one by one.

Hooks

Hooks are a fundamental part of PrestaShop's modules API. They enable modules to 'hook into' the rest of PrestaShop, and call functions at specific times, thereby setting your own code in motion.

...

  • "Action" hooks. For example, to send out a mail when a client creates a user account.
  • "View" hooks. For example, to display a module in a column.

New hooks

Info

Coming soon...

Dynamic hooks

PrestaShop brings the ability of defining dynamic hooks. In effect, there is now a hook before and after each action of each controller: PrestaShop's ObjectModel has been updated so that this new feature is automatically applied to existing code.

Info

Coming soon...

Evolution Of The Override System

PrestaShop's override system, which was introduced with PrestaShop 1.4, makes it easier for third party developers to include changes to the core methods without changing the core files.

...

  • easier to manage, install, and share along with the module itself.
  • multiple modules can make changes to the core classes, as long as they do not attempt to override the same functions.

New Filetree And Operations

In previous version of PrestaShop, there could be situations when you would have to call one of the module's file directly. For instance, when paying with the Cheque module, you would have to reach such a URL: http://myprestashop.com/modules/cheque/payment.php

...

  • /config.xml: Automatically created by PrestaShop when the module is loaded.
  • /mymodule.php
  • /mymodule.jpg: Logo file, 16*16 pixels. For versions of PrestaShop up to v1.4.
  • /mymodule.png: Logo file, 32*32 pixels. For PrestaShop 1.5 and later.
  • /controllers/
  • /controllers/front/myfile.php: As explained above.
  • /translations/
  • /translations/fr.php: French language file, created automatically when you start translating the module in your back-office.
  • /translations/de.php: Deutsh language file, created automatically when you start translating the module in your back-office.
  • /translations/...: ...and so on...
  • /views/
  • /views/css/: For CSS files.
  • /views/js/: For JavaScript files.
  • /views/templates/front/: For template files used by the module's controllers.
  • /views/templates/hooks/: For template files directly used by the module. For backward compatibility purposes, this type of files can also be placed in the root folder of the module.

Multishop Feature

One of the major features of version 1.5 is the multishop feature, which enable shop owners to manage more than one shop with a single installation of PrestaShop. However, this has deep implications in the code of PrestaShop, and while all modules written for v1.4 should work as-is with v1.5, most will not work as expected in the multishop context.

...

Failing that, your 1.4 module will work perfectly fine, but will have the very same configuration for every shops, which might not be what the module's users want.

Addons Webservice

With PrestaShop 1.5, many native modules are not physically part of the original package, such as the PayPal module. They are in the module list, but their files are nowhere to be found in the /modules folder.

...

In effect, when clicking on a module's "Install" button, PrestaShop automatically downloads the most recent version of the module, further enabling you to benefit from the latest features for this module without having to update it right away.

Update System

PrestaShop has new module update system. If an installed module has a new version available on the Addons website (http://addons.prestashop.com/en/), PrestaShop will display an "Update" button, and the user will be able to perform the update with a single click.
The "Update" button also appears when the module has been installed manually (by uploading the module's zip file), and PrestaShop detects that a new version is available.

...

If you are updating from v1.8.1 to v1.8.3 of the module, PrestaShop will only load the two last files, install-1.8.2.php and install-1.8.3.php.

Theme API

Info

Coming soon...