0
votes

I have an issue with a custom controllers ACL for the admin backend. Ive read, re-read, checked....and still cant find my issue. Dammit.

First, the code...the module itself is working...i have blocks, helpers, front end controllers...system->config tab/group data...all working fine. My issue is just relating to admincontroller acl...so ill just add the relevant code for that area for now.

My backend tab is showing, but the urls (admin/mynewmodule/index, admin/mynewmodule/list) go to a 404 page.

config.xml, admin routers:

 <admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <mynewmodule before="Mage_Adminhtml">
                        Mworkz_MyNewModule_Adminhtml
                    </mynewmodule >
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

Adminhtml.xml, backend tab, and acl

 <?xml version="1.0"?>
 <config>
 <menu>
    <mynewmodule module="mynewmodule " translate="title">
        <title>MyNewModule</title>
        <sort_order>71</sort_order>               
            <children>
                    <items module="mynewmodule " translate="title">
                        <title>Index Action</title>
                        <sort_order>1</sort_order>
                        <action>adminhtml/mynewmodule/</action>
                    </items>
                    <list module="mynewmodule " translate="title">
                        <title>List Action</title>
                        <sort_order>2</sort_order>
                        <action>adminhtml/mynewmodule/list/</action>
                    </list>
             </children>
    </mynewmodule >
</menu>

    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <mynewmodule translate="title">
                                            <title>MyNewModule</title>
                                    </mynewmodule>
                                </children>
                            </config>
                        </children>
                    </system>
                    <mynewmodule translate="title" module="mynewmodule">
                    <title>MyNewModule</title>
                        <sort_order>-100</sort_order>
                        <children>
                            <items translate="title">
                                <title>Index Action</title>
                                <sort_order>1</sort_order>
                            </items>
                            <list translate="title">
                                <title>List Action</title>
                                <sort_order>2</sort_order>
                            </list>
                        </children>
                    </mynewmodule>
                </children>
            </admin>
        </resources>
    </acl>
    <layout>
        <updates>
            <mynewmodule>
                <file>mworkz/mynewmodule.xml</file>
            </mynewmodule>
        </updates>
    </layout>

 </config>

Admin controller

 class Mworkz_MyNewModule_Adminhtml_MyNewModuleController extends Mage_Adminhtml_Controller_action
 {

protected function _initAction() {

    $this->loadLayout()
        ->_setActiveMenu('extbuilderpro/items')
        ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));

    return $this;
}   

public function indexAction() {

    $this->_initAction()
        ->renderLayout();
}

 public function listAction() {

    $this->_initAction()
        ->renderLayout();
}

 }
1
Ive also been clearing my 'session', and 'cache' dirs after testing changes.ShaunTheSheep
adminhtml/mynewmodule / - from where spacesdoktorgradus
Also...my front end controller route is: /mynewmodule/index My backend route is: /admin/mynewmodule/index These cant/wont clash will they, given the admin prefix on the backend?ShaunTheSheep
If you write your own extension, path must be module_name/admin_html/list. Download free magento extension, for example: magentocommerce.com/magento-connect/… and look at etc/config.xmldoktorgradus

1 Answers

1
votes

If you write your own extension, path must be module_name/admin_html/list. Download free magento extension, for example: http://www.magentocommerce.com/magento-connect/news-by-commercelab-3436.html and look at etc/config.xml.

So right code:

<menu>
    <modulename module="modulename" translate="title">
        <title>Module Name</title>
        <sort_order>1</sort_order>
        <children>
            <add translate="title" module="modulename">
                <title>Add New Item</title>
                <sort_order>0</sort_order>
                <action>modulename/adminhtml_news/new</action>
            </add>
            <items translate="title" module="modulename">
                <title>Items Manager</title>
                <sort_order>10</sort_order>
                <action>modulename/adminhtml_news/index</action>
            </items>
            <settings translate="title" module="modulename">
                <title>Settings</title>
                <sort_order>40</sort_order>
                <action>adminhtml/system_config/edit/section/modulename</action>
            </settings>
        </children>
    </clnews>
</menu>