I've create my first plugin for prestashop. I want to add autoupdate functionality for autoupdate as do for example eBay module.
I did not found anything about that on documentation.
I've create my first plugin for prestashop. I want to add autoupdate functionality for autoupdate as do for example eBay module.
I did not found anything about that on documentation.
I've been struggeling to figure out the correct process for this for a while. I thought the "upgrade it" button was only available for developers, who release their modules through the prestashop addons website (which is true) but if you chose not to publish there, here's how you update your own modules:
In the main file of your model, within the contructor method, you must have this line of code:
$this->version = '1.0.0';
upgrade
install-1.0.1.php
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_0_1($object, $install = false)
{
//your code here, for example changes to the DB...
return true; //if there were no errors
}
?>
$this->version = '1.0.1';
Now you should see 2 messages:
The module was successfully downloaded.
and
The following module(s) were upgraded successfully:
MyModule :
Current version: 1.0.1
1 file upgrade applied
You can also add an update file to your module: create an /upgrade folder in your module's folder, and put your update files in it, using the install-1.8.0.php name norm.
<?php
// Sample file for module update
if (!defined('_PS_VERSION_'))
exit;
// object module ($this) available
function upgrade_module_1_8_0($object)
{
// Your code to upgrade from version 1.8.0 of the module
}
?>