Jimmery
Jimmery

Reputation: 10139

Magento Extension causes 404 Error from the Admin Panel

We have a Magento Extension on our website, written by an ex-employee. This extension was written just for this one website, and I am struggling to find out what is going wrong with this extension. Contacting the ex-employee has proven to be (how should I put this), an ineffective method for solving this problem, so I was hoping someone here could help me out.

The extension works fine on the site, but when we click on the extension in the backend, on the Admin Panel, we get a "404 Not Found 1" error.


QUICK UPDATE

After rolling back a load of patches we have noticed that this problem only occurs after patch 5994. Is there anything in patch 5994 that could be causing these problems?


The extension itself has the following files:

\app\code\local\muz\Worldman\controllers\
    WorldmanController.php

\app\code\local\muz\Worldman\controllers\Adminhtml\
    WorldmanController.php

\app\code\local\muz\Worldman\controllers\etc
    config.xml

\app\code\local\muz\Worldman\controllers\Helper
    Data.php

I can make changes to the class names in the \app\code\local\muz\Worldman\controllers\Adminhtml\WorldmanController.php and instead of getting a 404 error, I get an actual crash report, stating that Controller file was loaded but class does not exist.

Again, this extension works fine on the site itself. Its just clicking on the extension itself from the Admin Panel menu that causes the 404.

The extension is enabled. I have logged out and back in a hundred times. Indexes have been re-indexed. Caches have been cleared and turned off. Servers have been rebooted. But to no avail.

At this point any suggestions for debugging any Magento extensions would be very much appreciated.

If this helps, here is the config.xml file:

<?xml version="1.0"?>
<config>
    <modules>
        <muz_Worldman>
            <version>1.0.0</version>
        </muz_Worldman>
    </modules>

    <global>
        <helpers>
            <worldman>
                <class>muz_Worldman_Helper</class>
            </worldman>
        </helpers>
    </global>

    <frontend>
        <routers>
            <worldman>
                <use>standard</use>
                <args>
                    <module>muz_Worldman</module>
                    <frontName>worldman</frontName>
                </args>
            </worldman>
        </routers>
        <layout>
            <updates>
                <worldman>
                    <file>worldman.xml</file>
                </worldman>
            </updates>
        </layout>
    </frontend> 

    <adminhtml>
        <menu>
            <cms>
                <children>       
                    <worldman_adminform translate="title" module="worldman">
                        <title>Worldman Manager</title>
                        <action>worldman/adminhtml_worldman</action>
                    </worldman_adminform>                       
                </children>
            </cms>         
        </menu>

        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>          
                <admin>
                    <children>
                        <cms>
                            <children>
                                <worldman_adminform> 
                                    <title>worldman Manager</title>
                                </worldman_adminform>
                            </children>
                        </cms>
                    </children>
                </admin>
            </resources>
        </acl>

        <layout>
            <updates>
                <worldman>
                    <file>worldman.xml</file>
                </worldman>
            </updates>
        </layout>
    </adminhtml>    

</config>

Upvotes: 0

Views: 981

Answers (1)

Christoffer Bubach
Christoffer Bubach

Reputation: 1686

The ACL settings are not set right for the user, that's why you get a 404. Even with the ACL set correctly you might get this error if you do not flush the Magento config cache and log out and then back in again.

From a quick look at your config, it seems like the XML part of the ACL settings is alright, but you might need to check if the file \app\code\local\muz\Worldman\controllers\Adminhtml\WorldmanController.php has a method like this in it:

protected function _isAllowed()
{
    return Mage::getSingleton('admin/session')->isAllowed('cms/worldman_adminform');
}

I had a bunch of modules that stopped working because of this missing method after one of Magento's latest patches.

Also, did you try with an admin account where you should automatically have full access?

--------EDIT-------

The patch you mentioned (5994) gave me similar problems with one of my modules. It used frontend routing for the adminhtml-controller, so what I had to do was to remove the XML between <frontend>...</frontend> and replace it with something like this:

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <muz_Worldman after="Mage_Adminhtml">muz_Worldman_Adminhtml</muz_Worldman>
                </modules>
            </args>
        </adminhtml>
        <worldman>
            <use>admin</use>
            <args>
                <module>muz_Worldman</module>
                <frontName>worldman</frontName>
            </args>
        </worldman>
    </routers>
</admin>

and also make sure that the the XML for ACL action - <action>worldman/adminhtml_worldman</action> is right, I had to make some changes to the URL so mine became more like (for you) adminhtml/worldman_adminform.

Upvotes: 2

Related Questions