5

I have been receiving a 404 on my admin module, after a lot of trouble shooting I realised it was something to do with this block of code in the config.xml file

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <some_module>Some_Module_Adminhtml</some_module>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>  

To fix the 404 I changed it to this

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <some_module after="Mage_Adminhtml">Some_Module_Adminhtml</some_module>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin> 

This worked but I wanted to understand it.

I tried adding before="Mage_Adminhtml" and expected to receive a 404, instead it worked again.

  • Why do I need to add a before or after for my page to load? (I'm assuming it loads before or after a core module and it would be used for when one of my module is dependant on one of the core module)

I have always assumed that the admin modules followed the same loading as any other module i.e. local, community, mage (this track of thought had me assuming that before="Mage_Adminhtml" would be the default behaviour).

I have looked through Mage_Core_Controller_Varien_Router_Admin to try and get my answers but couldn't find it and can't think where else to look

6

This before and after defines whether the controller should be looked up in Mage_Adminhtml first or in your module.

If your Controller is unique, then it doesn't matter what you define.

If you change an existing route, like checkout_cart_add -> Mage_Checkout_CartController::addAction, then your action is called, when you use before and the magento original if you use after

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.