管理员配置错误:未定义索引:第59行的Iterator.php中的ID


17

有人可以向我解释这个错误吗?

Exception #0 (Exception): Notice: Undefined index: id in /home/staging/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php on line 59
    #0 /home/staging/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php(59): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/home/asconveyo...', 59, Array)
    #1 /home/staging/vendor/magento/module-config/Model/Config/Structure.php(92): Magento\Config\Model\Config\Structure\Element\Iterator->setElements(Array, 'default')
    #2 /home/staging/var/generation/Magento/Config/Model/Config/Structure/Interceptor.php(24): Magento\Config\Model\Config\Structure->getTabs()
    #3 /home/staging/vendor/magento/module-config/Model/Config/Structure.php(135): Magento\Config\Model\Config\Structure\Interceptor->getTabs()
    #4 /home/staging/var/generation/Magento/Config/Model/Config/Structure/Interceptor.php(63): Magento\Config\Model\Config\Structure->getFirstSection()
    #5 /home/staging/vendor/magento/module-config/Controller/Adminhtml/System/AbstractConfig.php(57): Magento\Config\Model\Config\Structure\Interceptor->getFirstSection()
    #6 /home/staging/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Config\Controller\Adminhtml\System\AbstractConfig->dispatch(Object(Magento\Framework\App\Request\Http))
    #7 /home/staging/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->___callParent('dispatch', Array)
    #8 /home/staging/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Config\\...', 'dispatch', Object(Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor), Array, 'adminAuthentica...')
    #9 /home/staging/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
    #10 /home/staging/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
    #11 /home/staging/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Config\\...', 'dispatch', Object(Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor), Array, 'adminMassaction...')
    #12 /home/staging/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
    #13 /home/staging/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
    #14 /home/staging/var/generation/Magento/Config/Controller/Adminhtml/System/Config/Index/Interceptor.php(39): Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->___callPlugins('dispatch', Array, Array)
    #15 /home/staging/vendor/magento/framework/App/FrontController.php(55): Magento\Config\Controller\Adminhtml\System\Config\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
    #16 /home/staging/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
    #17 /home/staging/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
    #18 /home/staging/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
    #19 /home/staging/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
    #20 /home/staging/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
    #21 /home/staging/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
    #22 /home/staging/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
    #23 /home/staging/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
    #24 /home/staging/index.php(42): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
    #25 {main}

嗨,您安装了新的扩展程序吗?
Meetanshi

如果可以,则可能是模块xml(system.xml,acl.xml等)中的错误。
Chander Shekhar

在 通过下载安装github.com/mageplaza/magento-2-better-popup扩展名后出现同样的问题 。但是,通过composer安装时,效果很好。我需要更改其功能,这就是为什么不能由作曲家安装的原因。有人解决了吗?
Ajwad Syed

Answers:


31

我遇到了类似的问题,就我而言,该问题是因为我在 system.xml

<tab id="custom_tab" translate="label" sortOrder="2000">
            <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>customtab</tab>

要解决这个问题,我换
<tab>customtab</tab>

<tab>custom_tab</tab>


嗨@Anshu Mishra,以上回答为我提供了帮助,但是当我从管理端撤消该模块时,它不会令人失望。
shivashankar m

7

一种简单的调试方法是:浏览并打开vendor / magento / module-config / Model / Config / Structure / Element / Iterator.php

更改

public function setElements(array $elements, $scope)
    {
        $this->_elements = $elements;
        $this->_scope = $scope;
        if (count($elements)) {
            $lastElement = end($elements);
            $this->_lastId = $lastElement['id'];
        }
    }

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;

        $logger->info($elements);

        if (count($elements)) {
            $lastElement = end($elements);
            $this->_lastId = $lastElement['id'];
        }
    }

重新加载浏览器配置窗口,然后再次看到错误。

检查var / log / config_debug.log文件。

转到文件的最底部,查看哪个模块发生故障,在哪里停止。

那是导致您的问题的原因。

修复后,请不要忘记回滚更改。


5

在我的情况下,由于选项卡在已禁用的模块中定义,但在已启用的另一个模块中使用,因此引发了错误。因此,我建议您检查id指定的类中哪个选项卡没有:

调试示例

然后,按整个项目(在system.xml文件中)搜索该名称,并检查该模块是否已启用。

PS:屏幕快照上没有错误,但是实际上它是由DeliveryTime模块触发的,因为Core当我尝试访问商店配置页面时模块被禁用。


3

就我而言,我已经安装了https://www.mageplaza.com/magento-2store-credit/扩展,但没有安装Mageplaza的核心模块。

我发现该文件中未<tab>mageplaza</tab>提及,system.xml但未定义制表符。因此,可以从https://github.com/mageplaza/module-core为Mageplaza安装核心模块, 并且可以正常工作。


感谢@nalin savaliya
Pradip Garchar

除了通过Composer安装模块外,此处相同,但未启用。bin/magento module:enable Mageplaza_Core解决这个问题。
Thomas Luzat

1

我在magento2中也遇到了这个问题。这是我的system.xml文件


<tab id="cnet" translate="label" sortOrder="10">
            <label>CNET</label>
        </tab>
        <section id="cnet" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>General Information</label>
            <tab>cnet</tab>
Please change tab id = "cnet" and <tab>cnet</tab>.
If its not matching error will be occur. After change this one run the "sudo php bin/magento setup:di:compile"

0

由于system.xml,即将出现此问题。请按照以下说明进行更正,您的系统标签id =“ custom_tab ” translation =“ label” sortOrder =“ 10”>并且该部分下的标签名称应相同。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.