简体   繁体   English

Opencart重载属性的间接修改

[英]Opencart Indirect modification of overloaded property

i'm getting below error on payment success page on opencart. 我在opencart的付款成功页面上遇到错误。

Notice: Indirect modification of overloaded property ModelCheckoutOrder::$data has no effect in /srv/www/example.com/public_html/catalog/model/checkout/order.php on line 500
Notice: Indirect modification of overloaded property ModelCheckoutOrder::$data has no effect in /srv/www/example.com/public_html/catalog/model/checkout/order.php on line 501

Those 500 & 501 lines are, 那500和501行是

$this->data['payment_firstname'] = $order_info['payment_firstname'];
$this->data['payment_lastname'] = $order_info['payment_lastname'];

If i refresh the page it's disappearing. 如果我刷新页面,它将消失。 Any idea why this error appearing ? 知道为什么会出现此错误吗?

Model files don't have a $data property. 模型文件没有$data属性。 That's controllers. 那就是控制器。 This is the reason you are getting this error as the code is trying to set a value to a property that doesn't exist 这是您在代码中尝试将值设置为不存在的属性时收到此错误的原因

First you hv to create that property . 首先,您要创建该属性。 eg. 例如。 during validations , at the top of your class declare: 在验证期间,在类的顶部声明:

private $error = array();

Change Code: 更改代码:

$this->data $ this->数据

To Code: 编码:

$data $数据

$data['payment_firstname'] = $order_info['payment_firstname'];
$data['payment_lastname'] = $order_info['payment_lastname'];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM