Magento custom admin module 404 not found

2020-04-23 05:02发布

I have tried to create a new module for the magento admin section. I have seen many topics on this problem but none of them solved my issue.

I have created a file in app/etc/modules/ named Company_CustomList.xml

<?xml version="1.0"?>
<config>
         <modules>
                <Company_CustomList>
                        <active>true</active>
                        <codePool>local</codePool>
                </Company_CustomList>
         </modules>
</config>

Then in app/code/local/Company/CustomList I have created the following files:

app/code/local/Company/CustomList/Block/List.php

<?php
class Company_CustomList_Block_List extends Mage_Core_Block_Template
{
  // necessary methods
}
?>

app/code/local/Company/controllers/Adminhtml/IndexController.php

<?php
class Company_CustomList_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }


}
?>

app/code/local/Company/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_CustomList>
            <version>0.1.0</version>
        </Company_CustomList>
    </modules>
    <adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <customlist>
                            <title>Custom list</title>
                            <children>
                                <example translate="title" module="customlist">
                                    <title>Index</title>
                                </example>
                            </children>
                        </customlist>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
    <global>
        <helpers>
            <customlist>
                <class>Company_CustomList_Helper</class>
            </customlist>
        </helpers>
    </global>
</config>

app/code/local/Company/etc/adminhtml.xml

<?xml version="1.0"?>
<config>
    <menu>
        <customlist translate="title" module="customlist">
            <title>Custom list</title>
            <sort_order>15</sort_order>
            <children>
                <example translate="title" module="customlist">
                    <title>Index</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/customlist/index</action>
                </example>
            </children>
        </customlist>
    </menu>
    <acl>
        <resources>
            <admin>
                <children>
                    <customlist translate="title" module="customlist">
                        <title>Custom list</title>
                        <sort_order>15</sort_order>
                        <children>
                            <example translate="title" module="customlist">
                                <title>Index</title>
                                <sort_order>1</sort_order>
                                <action>adminhtml/customlist/index</action>
                            </example>
                        </children>
                    </customlist>
                </children>
            </admin>
        </resources>
    </acl>
</config>

app/code/local/Company/Helper/Data.php

<?php
class Company_CustomList_Helper_Data extends Mage_Core_Helper_Abstract {

}

?>

The problem might come from my ACL... but I really can't find how to fix it.

Thanks,

3条回答
做个烂人
2楼-- · 2020-04-23 05:32

Here is suggesting you to make new module you can use module creator and you can avoid error like this if you want to utilize your time.

Please use below link for online generation of module creator

or you can also download module creator from various sites just search it out.

And one more thing if same error will generate again please clear your cache with magento as well as your browser caching also

Have nice day.

Let me know if i can help you more.

查看更多
劳资没心,怎么记你
3楼-- · 2020-04-23 05:41

Maybe the answer is really simple. Try renaming everywhere CustomList to Customlist in all files. If that is not an answer you can try comparing your settings and files with this link

查看更多
女痞
4楼-- · 2020-04-23 05:50

When create a magento admin module you can create it in one of two ways (The above menu url will not work)

<adminhtml>
    <menu>
        <menu1 translate="title" module="customlist">
            <title>ActiveCodeline SampleModule1</title>
            <sort_order>60</sort_order>
            <children>
                <menuitem1 module="SampleModule1">
                    <title>Menu item 1</title>
                    <action>{{adminhtml/customlist}}/index</action>
                </menuitem1>

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Company_CustomList before="Mage_Adminhtml">Foo_Bar_Adminhtml</Company_CustomList>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

Or

<adminhtml>
    <menu>
        <menu1 translate="title" module="customlist">
            <title>ActiveCodeline SampleModule1</title>
            <sort_order>60</sort_order>
            <children>
                <menuitem1 module="SampleModule1">
                    <title>Menu item 1</title>
                    <action>{{customlist}}/index</action>
                </menuitem1>


<admin>
    <routers>
        <samplemodule1>
            <use>admin</use>
            <args>
                <module>ActiveCodeline_SampleModule1</module>
                <frontname>customlist</frontname>
            </args>
        </samplemodule1>
    </routers>
</admin>
查看更多
登录 后发表回答