Hello there,
I installed an extension using the composer, and then it didn't work, so what I did I just removed the extension, and then later on I wanted to do some configuration in the Magento 2 dashboard, then I figured out that the Store Configuration is not working, and it's showing the following error.
1 exception(s): Exception #0 (Exception): Notice: Undefined index: id in /var/www/bmgpharmacy.com/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php on line 63 Exception #0 (Exception): Notice: Undefined index: id in /var/www/bmgpharmacy.com/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php on line 63 <pre>#1 Magento\Config\Model\Config\Structure\Element\Iterator->setElements() called at [vendor/magento/module-config/Model/Config/Structure.php:146] #2 Magento\Config\Model\Config\Structure->getTabs() called at [generated/code/Magento/Config/Model/Config/Structure/Interceptor.php:23] #3 Magento\Config\Model\Config\Structure\Interceptor->getTabs() called at [vendor/magento/module-config/Model/Config/Structure.php:209] #4 Magento\Config\Model\Config\Structure->getFirstSection() called at [generated/code/Magento/Config/Model/Config/Structure/Interceptor.php:59] #5 Magento\Config\Model\Config\Structure\Interceptor->getFirstSection() called at [vendor/magento/module-config/Controller/Adminhtml/System/AbstractConfig.php:63] #6 Magento\Config\Controller\Adminhtml\System\AbstractConfig->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58] #7 Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #8 Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/weltpixel/m2-weltpixel-backend/Plugin/Utility.php:76] #9 WeltPixel\Backend\Plugin\Utility->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135] #10 Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143] #11 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135] #12 Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #13 Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->___callPlugins() called at [generated/code/Magento/Config/Controller/Adminhtml/System/Config/Index/Interceptor.php:32] #14 Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245] #15 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212] #16 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147] #17 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58] #18 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #19 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #20 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23] #21 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116] #22 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23] #23 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264] #24 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:29] </pre>
This should help you - https://magento.stackexchange.com/questions/202669/admin-config-error-undefined-index-id-in-iterator...
There is two possibility for this error
- May be your system.xml is corrupted and then check id attribute in that system.xml
- Check the setup_module table in magento to test that module entry is not exits that you download from composer and also verify your vendor that module entry should not exist in the magento vendor
In the database there's no entry for it, it's empty there's no any columns in that setup module.
go to to your hosting and check module in public_html/app/code/ and looking name module folder delete module folder and make clear cache and flush
Hi @yazeedkaraee27,
This issue appears due to 2 major reasons.
To resolve this error, you can do the following in system.xml:
<tab id="tab_section" translate="label" sortOrder="20"> <label>Custom Tab</label> </tab> <section id="custom_section" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1"> <class>separator-top</class> <label>Custom Section</label> <tab>tabsection</tab>
To fix the issue, you have to change
<tab>tabsection</tab> to <tab>tab_section</tab>
If issue still remains then you can debug the issue by do the following:
One easy way to debug is: browse and open vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php
Change:
public function setElements(array $elements, $scope) { $this->_elements = $elements; $this->_scope = $scope; if (count($elements)) { $lastElement = end($elements); $this->_lastId = $lastElement['id']; } } To: public function setElements(array $elements, $scope) { $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/config_debug.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $this->_elements = $elements; $this->_scope = $scope; if (count($elements)) { $lastElement = end($elements); // Log last Element $logger->info($lastElement); $this->_lastId = $lastElement['id']; } }
Reload browser configuration window and see once again the error.
Check var/log/config_debug.log file.
Go to very bottom of the file and see which module failed, where it stopped.
That's the one causing your issues.
Don't forget to rollback your changes once fixed.