PrestaShop 1.7.3 Product.php class 覆盖

PrestaShop 1.7.3 Product.php class override

我安装了 PrestaShop 1.7.3.3 php 7.1.18 当我覆盖模块并将它们放在覆盖目录中时,它运行良好。

例如我添加了 PrestaShop/override/modules/ps_languageselector/ps_languageselector.php 并且正在执行覆盖。

当我尝试通过将文件放置在 PrestaShop/override/classes/Product.php 来覆盖 Product.php 时,根本没有加载文件!添加 die()error_log 不会改变任何东西。

我错过了什么?

谢谢

PS1.7 的想法是扩展而不是覆盖。

但如果您确实需要,您仍然可以覆盖。 删除这 2 个文件:

var/cache/dev/class_index.php & var/cache/prod/class_index.php

我遇到了同样的问题,在我的例子中,问题是文件权限,在 module/Moddule.php 的 addOverride 函数中,我们有一行 file_put_contents($path_override, preg_replace('#(\r\n|\r)#ism', "\n", file_get_contents($path_override))) 将您的覆盖转移到 /override 目录,因为文件权限,这一行不执行,所以问题发生了,运行 chmod -R 777 .在你的项目目录下解决问题