Xml 完全禁用模块-Magento 1.9

Xml 完全禁用模块-Magento 1.9,xml,module,configuration,magento-1.9,Xml,Module,Configuration,Magento 1.9,我试图通过编程禁用Magento模块。为了便于尝试,我在myadminheader.phtml中添加了以下代码 // Disable the module itself $moduleName="Thycart_Customcheckout" $nodePath = "modules/$moduleName/active"; if (Mage::helper('core/data')->isModuleEnabled($moduleName)

我试图通过编程禁用Magento模块。为了便于尝试,我在myadminheader.phtml中添加了以下代码

    // Disable the module itself
    $moduleName="Thycart_Customcheckout"
        $nodePath = "modules/$moduleName/active";
        if (Mage::helper('core/data')->isModuleEnabled($moduleName)) {
            Mage::getConfig()->setNode($nodePath, 'false', true);
            echo Mage::getConfig()->getNode('modules/Thycart_Customcheckout')->active;            
        }

        // Disable its output as well (which was already loaded)
         $outputPath = "advanced/modules_disable_output/$moduleName";
         if (!Mage::getStoreConfig($outputPath)) {
             Mage::app()->getStore()->setConfig($outputPath, true);
         }
在回音中

Mage::getConfig()->getNode('modules/Thycart\u Customcheckout')->活动

返回值为false,但实际上模块没有从xml禁用

也尝试过

Mage::getConfig()->saveConfig()

返回了一个

前端控制器达到100路由器匹配迭代错误


请有人帮助将配置文件中的节点激活为false。谢谢。

这是一种糟糕的代码实践。您不应该像这样禁用模块。当您的phtml文件(header.php)执行时,大多数模块都已被调用,因为它们的对象都在内存中

如果您想禁用模块,则可以通过以下方式禁用它们: 系统->配置->高级->禁用模块输出,或者您可以通过


在\app\etc\modules\Mynamespace\u Mymodulename.xml中的modules.xml文件中设置false。

这是一种错误的代码实践。您不应该像这样禁用模块。当您的phtml文件(header.php)执行时,大多数模块都已被调用,因为它们的对象都在内存中

如果您想禁用模块,则可以通过以下方式禁用它们: 系统->配置->高级->禁用模块输出,或者您可以通过


在\app\etc\modules\Mynamespace\u Mymodulename.xml中的modules.xml文件中设置false。

尝试此@BachchaSingh非编程设置,尝试此@BachchaSingh非编程设置