0
votes

So I am fairly new to using Magento, and I have follow numerous tutorials over the internet, but somehow cannot manage to figure out why my new admin panel page will not load. At this point, I am just trying to have the page redirect to anything but the 404 Error page. Any help would be extremely appreciated! Here is what I have:

.../app/code/local/Name/Moudule/etc/config.xml

    <?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Name_Module>
            <version>0.1.0.0</version>
        </Name_Module>
    </modules>
    <global>
        <models>
            <module>
                <class>Name_Module_Model</class>
            </module>
        </models>
        <helpers>
            <name_module>
                <class>Mage_Core_Helper</class>
            </name_module>
        </helpers>
       ...
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <module>Name_Module_index</module>
                    </modules>
                </args>
            </adminhtml>
        </routers>
        <layout>
            <updates>
                <module>
                    <file>module.xml</file>
                </module>
            </updates>
        </layout>
    </admin>
</config>

.../app/code/local/Name/Moudule/etc/adminhtml.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <menu>
        <module module="name_module" translate="title">
            <title>Test Tab</title>
            <sort_order>100</sort_order>
            <children>
                <index module="name_module" translate="title">
                    <title>First Subtab</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/module</action>
                </index>
            </children>
        </module>
    </menu>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                <module translate="title" module="name_module">
                                    <title>Test Tab</title>
                                    <sort_order>-100</sort_order>
                                    <children>
                                        <index translate="title">
                                            <title>First Subtab</title>
                                            <sort_order>1</sort_order>
                                        </index>
                                    </children>
                                </module>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

.../app/code/local/Name/Moudule/controllers/Adminhtml/CustomController.php

<?php
class Name_Module_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
{

    public function indexAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('module')
            ->_title($this->__('First Sub Tab'));

        // my stuff

        $this->renderLayout();
        error_log("The function is being called somewhere",0); //not working
    }
}

...\app\code\local\Name\Module\Helper\Data.php

<?php
class Name_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
}

...\app\design\adminhtml\default\default\module\test.phtml

    <?php echo "TEST";
error_log("The page is being called somewhere",0);

After all of this, I am able to see the tab and subtab in the admin panel, but if the "First Subtab" is clicked, it directs me to a "404 Page Not Found" page. Any help would be GREATLY appreciated.

1
Oh, and I'd advice you to not name your custom module Name_Module. I hope it's only a placeholder :) Surely your module has a purpose, so why not name it after its functionality?Sam

1 Answers

1
votes

In your config.xml change the node to display your actual Helper class:

<helpers>
    <name_module>
       <class>Name_Module_Helper_Data</class>
    </name_module>
</helpers>

In the admin node, your router should look like this:

<routers>
    <adminhtml>
        <args>
            <modules>
                <Name_Module>Name_Module_Adminhtml</Name_Module>
            </modules>
        </args>
    </adminhtml>
</routers>

In your adminhtml.xml, check the children/index/action:

<children>
    <index module="name_module" translate="title">
        <title>First Subtab</title>
        <sort_order>1</sort_order>
        <action>adminhtml/custom/index</action>
    </index>
</children>

The action represents the controller path and the corresponding method.

This is what I could spot, I hope I didn't miss anything. And clear the cache after you made the changes and log out and back into admin.