mario.schillermann Posted August 9, 2017 Share Posted August 9, 2017 (edited) Prestashop Version: 1.6.16 PHP Version: PHP 7.0.18-0ubuntu0.16.04.1 When I call the product list or a product comes following error message: Undefined offset: 1 in classes/controller/AdminController.php on line 1528 Here is the prosses overview with comments. public function initToolbarTitle() { // $this->breadcrumbs == array(0 => 'Produkte', 1 => 'Produkte') $this->toolbar_title = is_array($this->breadcrumbs) ? array_unique($this->breadcrumbs) : array($this->breadcrumbs); // The array index now is on 2 // $this->toolbar_title == array(0 => 'Produkte') switch ($this->display) { case 'edit': $this->toolbar_title[] = $this->l('Edit', null, null, false); // Now there is a gap in the array elements // $this->breadcrumbs == array(0 => 'Produkte', 2 => 'Bearbeiten') $this->addMetaTitle($this->l('Edit', null, null, false)); break; } } public function initPageHeaderToolbar() { case 'edit': // Here we jump into the hole of the lost array element $this->addMetaTitle($this->toolbar_title[count($this->toolbar_title) - 1]); } The same effect do you have with this example code $toolbar_title = array_unique(array(0 => 'Produkte', 1 => 'Produkte')); $toolbar_title[] = 'Bearbeiten'; //array(0 => 'Produkte', 2 => 'Bearbeiten') var_dump($toolbar_title); That is not a feature, but a Bug. Edited August 9, 2017 by mario.schillermann (see edit history) 1 Link to comment Share on other sites More sharing options...
mario.schillermann Posted August 9, 2017 Author Share Posted August 9, 2017 The only way for me is to reorganize the array elements. https://stackoverflow.com/questions/13596128/array-unique-and-then-renumbering-keys public function initToolbarTitle() { ... $this->toolbar_title = array_values($this->toolbar_title); if ($filter = $this->addFiltersToBreadcrumbs()) { $this->toolbar_title[] = $filter; } } 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