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';
- make a subdirectory in your module folder called
upgrade
- create a new file in this directory called
install-1.0.1.php
- put this code in the file:
<?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
}
?>
- In your main file, change it to
$this->version = '1.0.1';
- Create a zip file of your module folder
- Navigate to the Modules page on your stores back end, and say "upload new module"
- Upload the zip file
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