无法将变量添加到 class 与 Prestashop 覆盖的组合(适用于 class 产品)

Can't add variable to class Combination with Prestashop overrides (works with class Product)

以下 override/classes/Product.php 为产品 class 创建了一个新变量 $foobar

<?php
if (!defined('_PS_VERSION_')) {
    exit;
}
class Product extends ProductCore
{
    public $foobar;
}

当我创建一个 new Product() 时,我可以看到这个新变量。

现在我想对组合 class 做同样的事情,所以我创建了一个类似的 override/classes/Combination.php

<?php
if (!defined('_PS_VERSION_')) {
    exit;
}
class Combination extends CombinationCore
{
    public $foobar;
}

但是当我创建 new Combination() 时,这个新字段不存在。

我错过了什么?

FWIW,我正在使用 PS 1.7.6.1.

更新

实际上似乎从未调用过 override/classes/Combination.php:我添加了一个应该触发异常的错误行(在 override/classes/Product.php 中确实如此),但没有任何反应。

我以为我按照建议删除了 /cache/class_index.php in the documentation,但仍然有一个 /var/cache/dev/class_index.php 阻止我的修改生效。

删除它解决了问题。

请注意/var/cache/prod/下有一个类似的文件,如果在生产环境中出现类似情况,可能需要将其删除。