How to update class override when upgrading module to new version in Prestashop?

时间:2015-07-28 15:48:18

标签: php prestashop prestashop-1.6 prestashop-1.5

Let's say there is a module with version 0.1.

This module already have overrides applied for example to classes/Cart.php.

New requirement comes in and we make a change to an already overridden classes/Cart.php.

To apply new change we update module version to 0.2, but after update Prestashop doesn't reapply new overrides. I also tried placing upgrade script in upgrade folder which I confirmed was executing but old override is still there.

How do you apply new overrides without reinstalling the module?

2 个答案:

答案 0 :(得分:1)

在升级方法中,您可以按顺序运行uninstallOverrides和installOverrides,这将导致在当前版本中安装覆盖的状态。

文件升级/升级-1.1.0.php:

function upgrade_module_1_1_0($module)
{
    $module->uninstallOverrides();
    $module->installOverrides();
    return true;
}

答案 1 :(得分:-1)

我认为唯一的方法是手动删除新的覆盖文件并将其复制到/ override文件夹,检查当前覆盖的文件实际上是你的(md5 checksum p.ex。)。