Module 如何将自动更新功能添加到prestashop插件
我已经为prestashop创建了第一个插件。我想为自动更新添加自动更新功能,例如易趣模块 我在文档中没有找到任何与此相关的内容。。 您还可以向模块添加更新文件:在模块文件夹中创建/upgrade文件夹,并使用install-1.8.0.php名称将更新文件放入其中Module 如何将自动更新功能添加到prestashop插件,module,prestashop,auto-update,Module,Prestashop,Auto Update,我已经为prestashop创建了第一个插件。我想为自动更新添加自动更新功能,例如易趣模块 我在文档中没有找到任何与此相关的内容。。 您还可以向模块添加更新文件:在模块文件夹中创建/upgrade文件夹,并使用install-1.8.0.php名称将更新文件放入其中 <?php // Sample file for module update if (!defined('_PS_VERSION_')) exit; // object module ($this) availabl
<?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
}
?>
一段时间以来,我一直在绞尽脑汁找出正确的流程。 我认为“upgrade it”按钮只适用于开发人员,他们通过prestashop插件网站发布模块(这是真的),但如果您选择不在那里发布,以下是您更新自己模块的方式: 在模型的主文件中,在constructor方法中,必须有以下代码行:
$this->version = '1.0.0';
- 在模块文件夹中创建一个子目录,名为
upgrade
- 在此目录中创建一个名为
install-1.0.1.php的新文件
- 将此代码放入文件:
- 在主文件中,将其更改为
$this->version='1.0.1'代码>
- 创建模块文件夹的zip文件
- 导航到商店后端的模块页面,然后说“上载新模块”
- 上传zip文件
<?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
}
?>