mauroagr Posted September 3, 2018 Share Posted September 3, 2018 Friends, I am working to override 'part' of adminOrdersController. I try to add onde extra field in orders list, but i dont will copy all _contrunct() from core to add ond extra fields. I try use this, but dont get success. Any can help. public function __construct() { $x = new AdminOrdersControllerCore(); $this->fields_list = array_merge( $x->fields_list, ['tracking_number' => [ 'title' => $this->l('Número Rastreio'), 'havingFilter' => true, 'width' => 100, ], ] ); return AdminOrdersControllerCore::__construct(); } Link to comment Share on other sites More sharing options...
mauroagr Posted September 3, 2018 Author Share Posted September 3, 2018 Solved! public function __construct() { parent::__construct(); $part1 = array_slice($x->fields_list, 0, 1); $part2 = array_slice($x->fields_list, 2,1); $part3 = array_slice($x->fields_list, 4, 4); $part4 = array_slice($x->fields_list, 8); $this->fields_list = array_merge($part1, $part2, $part3, $extraFields1, $part4); AdminController::__construct(); } Link to comment Share on other sites More sharing options...
Traumflug Posted September 3, 2018 Share Posted September 3, 2018 php AdminController::__construct(); Calling non-static methods statically is deprecated, see: http://php.net/manual/en/language.oop5.static.php Also not sure whether it actually does something. Probably a no-op. Link to comment Share on other sites More sharing options...
wakabayashi Posted September 3, 2018 Share Posted September 3, 2018 The proper way to change list, is using hooks: https://webkul.com/blog/how-to-modify-fields-list-in-prestashop/ Link to comment Share on other sites More sharing options...
mauroagr Posted September 10, 2018 Author Share Posted September 10, 2018 Thanks @wakabayashi, I solved using array_split and merge to add fields in middle. If is only at the end array, working the example, but i will add in the middle. Thanks @Traumflug Mauro Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now