简体   繁体   中英

Opencart Indirect modification of overloaded property

i'm getting below error on payment success page on 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,

$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. 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

To Code:

$data

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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