0

When I click a link to go to my admin module I receive an empty content area with a 404 page not found message. I am assuming this is due to the module being misconfigured. But I cannot find where the issue is. I am using 1.7.0.2 (in my config.xml I tried, what I believe is the old way of doing it, which is now commented out as it did not work, but left in for reference). How do I resolve this 404?

Training/Distributor/etc/adminhtml.xml

<config>  
<menu>
    <catalog>
        <children>
            <training_distributor translate="title" module="training_distributor">
                <title>Manage Distributors</title>
                <action>adminhtml/distributor</action>
                <sort_order>250</sort_order>
            </training_distributor>
        </children>
    </catalog>
</menu>

<acl>
    <resources>
        <admin>
            <children>
                <catalog>
                    <children>
                        <training_distributor translate="title" module="training_distributor">
                            <title>Manage Distributors Section</title>
                            <sort_order>250</sort_order>
                        </training_distributor>
                    </children>
                </catalog>
            </children>
        </admin>
    </resources>
</acl>
</config>

Training/Distributor/etc/config.xml

  <!--  <admin>
    <routers>
        <adminhtml>
            <use>admin</use>
            <args>
                <module>Training_Distributor_Adminhtml</module>
                <frontName>admin</frontName>
            </args>
        </adminhtml>
    </routers>
</admin> -->
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <training_distributor before="Mage_Adminhtml">Training_Distributor_Adminhtml</training_distributor>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

</config>

Training_Distributor_controllers_Adminhtml_DistributorController.php

class Training_Distributor_Adminhtml_DistributorController
    extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->getResponse()->setBody("Works");
    }
}

====

EDIT

====

The full config. The helper is just an empty helper extending helper_abstract

<config>
<modules>
    <Training_Distributor>
        <version>0.0.2</version>
    </Training_Distributor>
</modules>
<global>
    <resources>
        <training_distributor_setup>
            <setup>
                <module>Training_Distributor</module>
            </setup>
        </training_distributor_setup>
    </resources>

    <models>
        <training_distributor>
            <class>Training_Distributor_Model</class>
            <resourceModel>training_distributor_resource</resourceModel>
        </training_distributor>

        <training_distributor_resource>
            <class>Training_Distributor_Model_Resource</class>
            <entities>
                <distributor>
                    <table>training_distributor_entity</table>
                </distributor>
            </entities>
        </training_distributor_resource>
    </models>
    <blocks>
        <training_distributor>
            <class>Training_Distributor_Block</class>
        </training_distributor>
    </blocks>
    <helpers>
        <training_distributor>
            <class>Training_Distributor_Helper</class>
        </training_distributor>                
    </helpers>
</global>

<!--    <admin>
    <routers>
        <adminhtml>
            <use>admin</use>
            <args>
                <module>Training_Distributor_Adminhtml</module>
                <frontName>admin</frontName>
            </args>
        </adminhtml>
    </routers>
</admin>-->
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <training_distributor before="Mage_Adminhtml">Training_Distributor_Adminhtml</training_distributor>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

</config>

===

EDIT

===

class Training_Distributor_Adminhtml_DistributorController
    extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->getResponse()->setBody("Works");
    }
}

enter image description here

1

There are a few possible causes of a 404 for a controller:

  1. The file is not at the correct path - yours should be Training/Distributor/controllers/Adminhtml/DistributorController.php
  2. The handle is not unique - try changing the <training_distributor before="Mage_Adminhtml"> to something like <brand_new_wont_be_taken before="Mage_Adminhtml">

To further debug the routers one option is to add some debug into the init() in the class Mage_Core_Controller_Varien_Front. Here with the correct placement, just before return $this; you can var_dump or log the results of $this->getRouters(). Here you should be able to see all the routers that are set-up in your system.

For each router setup via the config.xml you will have an array containing all the possible controllers. For example.

["admin"]=>
  array(19) {
    [0]=>
    string(20) "Mage_Index_Adminhtml"
    [1]=>
    string(22) "Mage_Paygate_Adminhtml"
    [2]=>
    string(21) "Mage_Paypal_Adminhtml"
    [3]=>
    string(21) "Mage_Widget_Adminhtml"
    [4]=>
    string(20) "Mage_Oauth_Adminhtml"
    [5]=>
    string(27) "Mage_Authorizenet_Adminhtml"
    [6]=>
    string(21) "Mage_Bundle_Adminhtml"
    [7]=>
    string(23) "Mage_Centinel_Adminhtml"
    [8]=>
    string(23) "Mage_Compiler_Adminhtml"
    [9]=>
    string(22) "Mage_Connect_Adminhtml"
    [10]=>
    string(27) "Mage_Downloadable_Adminhtml"
    [11]=>
    string(27) "Mage_ImportExport_Adminhtml"
    [12]=>
    string(19) "Mage_Api2_Adminhtml"
    [13]=>
    string(24) "Mage_PageCache_Adminhtml"
    [14]=>
    string(25) "Mage_XmlConnect_Adminhtml"
    [15]=>
    string(31) "DndInxmail_Subscriber_Adminhtml"
    [16]=>
    string(30) "Training_Distributor_Adminhtml"
    [17]=>
    string(14) "Mage_Adminhtml"
  }
  • thanks for taking the time to try to resolve this issue, but the 404 persists. One positive is I've looked and re looked for the same potential issues you have highlighted. Thanks again – tony09uk Nov 14 '13 at 16:29
  • @tony09uk no problem, could you log the results of $this->getRouters(); at the end of the init() in Mage_Core_Controller_Varien_Front you should hopefully see Training_Distributor_Adminhtml – David Manners Nov 14 '13 at 16:33
  • 1
    thanks for your help. Although nothing was added in the system.log when I use mage::log() I used var_dump() and found another module was conflicting. I deactivated that module and it now works. Guess I need to dig deeper to find the exact conflict now. Thanks again – tony09uk Nov 15 '13 at 8:21

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.