Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Can';t使用Prestashop覆盖将变量添加到类组合中(与类产品一起使用)_Php_Variables_Overriding_Prestashop 1.7 - Fatal编程技术网

Php Can';t使用Prestashop覆盖将变量添加到类组合中(与类产品一起使用)

Php Can';t使用Prestashop覆盖将变量添加到类组合中(与类产品一起使用),php,variables,overriding,prestashop-1.7,Php,Variables,Overriding,Prestashop 1.7,以下override/classes/Product.php为Product类创建了一个新变量$foobar: <?php if (!defined('_PS_VERSION_')) { exit; } class Product extends ProductCore { public $foobar; } 但是,当我创建一个新组合()时,这个新字段不存在 我错过了什么 FWIW,我用的是PS1.7.6.1 更新 实际上,似乎从来没有调用过override/classe

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

<?php
if (!defined('_PS_VERSION_')) {
    exit;
}
class Product extends ProductCore
{
    public $foobar;
}
但是,当我创建一个
新组合()
时,这个新字段不存在

我错过了什么

FWIW,我用的是PS1.7.6.1

更新
实际上,似乎从来没有调用过
override/classes/composition.php
:我添加了一个错误的行,它应该会触发一个异常(在
override/classes/Product.php
),但什么都没有发生。

我以为我删除了
/cache/class\u index.php
,正如建议的那样,但是仍然有一个
/var/cache/dev/class_index.php
阻止我的修改生效

删除它解决了这个问题

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

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