Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[BUG] Creating new module and getting: Fatal Error: Call to undefined method Mage_Core_Model_Config_Base::appendChild()
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Hi All,

I’ve just bought the php|architect’s guide to magento (great book) and i’m trying to implement one of the examples, which creates a REST method to export the orders, update it’s status, and some other useful stuff.

The problem is: when i add the new module xml in app/code/etc/modules, it is giving me this error:

Fatal errorCall to undefined method Mage_Core_Model_Config_Base::appendChild() in C:\wamp\www\magento\app\code\core\Mage\Core\Model\Config.php on line 267

This is the xml which creates the new module (Mage_AdminRest.xml):

<?xml version="1.0"?>
<config>
    <
modules>
        <
Mage_AdminRest>
            <
version>0.6.0</version>
        </
Mage_AdminRest>
    </
modules>
    <
admin>
        <
routers>
            <
adminrest>
                <use>
admin</use>
                <
args>
                    <
module>Mage_AdminRest</module>
                    <
frontName>adminrest</frontName>
                </
args>
            </
adminrest>
        </
routers>
    </
admin>
</
config>

I’ve checked the file \app\code\core\Mage\Core\Model\Config.php, and there’s this chunk of code where the method call is made:

// add sorted modules to configuration xml
        $sortedConfig = new Mage_Core_Model_Config_Base();
        
$sortedConfig->loadString('<config><modules/></config>');
        foreach (
$unsortedConfig->getNode()->children() as $nodeName=>$node{
            
if ($nodeName!=='modules'{
                $sortedConfig
->appendChild($node);
            
}
        }
        $modulesConfig 
$sortedConfig->getNode('modules');
        foreach (
$sortedModules as $moduleName=>$moduleConfig{
            $modulesConfig
->appendChild($moduleConfig);
        
}
        $this
->extend($sortedConfig);

It really calls the appendChild() method, which doesn’t exist on Mage_Core_Model_Config_Base neither on Varien_Simplexml_Config (Mage_Core_Model_Config_Base extends Varien_Simplexml_Config).

Any hints?

Thanks in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Anyone? Magento devs?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Just an update… If I comment the <admin> tags (and it’s contents, of course), then the page loads smoothly… but, then i can’t access the module i’m creating through the url http://localhost/magento/index.php/adminrest/.

Is this a magento bug?? Is there a different way to implement the routing?

Cheers,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Solved it by deleting this snippet:

<config>
    <
frontend>
        <
routers>
            <
adminrest>
                <use>
standard</use>
                <
args>
                    <
module>Mage_AdminRest</module>
                    <
frontName>adminrest</frontName>
                </
args>
            </
adminrest>
        </
routers>
    </
frontend>
</
config>

from the /app/etc/modules/Mage_RestAdmin.xml and adding it to the config.xml inside the module’s folder. Note that it is only possible to add it as <frontend> instead of <admin>, and <use>standard</use> instead of <use>admin</use>.

But, isn’t it a bug? shouldn’t we be able to add it to the routers to the module’s xml?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top