Child pages
  • Auto-updating modules

Versions Compared

Key

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

...

It is therefore highly advised to number your module's versions sequentially, and using only number.to only use numbers – because the upgrade code uses PHP's version_compare() method.

Note

If the new version of your module adds or update its hooks, you should make sure to update them too

Indeed, since the hooks are (usually) defined when the module is installed, PrestaShop will not install the module again in order to include the new hooks' code, so you have to use the upgrade methods:

For instance, here's the install-1.2.php file from the blockbestseller module:

Code Block
<?php
if (!defined('_PS_VERSION_'))
    exit;

function upgrade_module_1_2($object)
{
    return ($object->registerHook('addproduct') 
      && $object->registerHook('updateproduct') 
      && $object->registerHook('deleteproduct') 
      && $object->registerHook('actionOrderStatusPostUpdate'));
}