Magento admin routing does not work

I am working on a module for the Magento administration area. I am trying to follow Alan Storm's tutorial on Magento admin controllers, but cannot force my controller to do anything. I think this may be due to routing, but I'm not sure. It shows me an external template with a 404 error.

(Note: here I have included all the relevant code. The actual question is at the very bottom.)

The module is called Mynamespace_Donor and lives in app / code / local / Mynamespace / Donor /.

My etc / config.xml looks like this:

<?xml version="1.0"?>
<config>
    <modules>
        <Mynamespace_Donor>
            <version>0.1.0</version>
        </Mynamespace_Donor>
    </modules>
    <global>
        <helpers>
            <donor>
                <class>Mynamespace_Donor_Helper</class>
            </donor>
        </helpers>
        <resources>
            <donor_setup>
                <setup>
                    <module>Mynamespace_Donor</module>
                </setup>
            </donor_setup>
        </resources>
    </global>

    <admin>
        <routers>
            <donor>
                <use>admin</use>
                <args>
                    <module>Mynamespace_Donor</module>
                    <frontname>donor</frontname>
                </args>
            </donor>
        </routers>
    </admin>

    <adminhtml>
        <menu>
            <donor translate="title" module="donor">
                <title>Donor</title>
                <sort_order>42</sort_order>
                <children>
                    <manage_donors module="donor">
                        <title>Manage Donors</title>
                        <action>donor/index/index</action>
                    </manage_donors>
                </children>
            </donor>
        </menu>
    </adminhtml>
</config>

And my /IndexController.php controllers look like this:

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

        //create a text block with the name of "example-block"
        $block = $this->getLayout()
        ->createBlock('core/text', 'example-block')
        ->setText('<h1>This is a text block</h1>');

        $this->_addContent($block);

        $this->renderLayout();
    }
}

/index.php/donor/index/index/key/e98a..., 404. /donor, /index.php/donor, /index.php/donor/index .., 404 .

<helpers> , Magento , . <adminhtml>, , <admin><routers> ( , ).

<adminhtml>, : Fatal error: Class 'Mage_Mynamespace_Donor_Helper_Data' not found in /home/mysite/public_html/magento_dev_1_10/app/Mage.php on line 520

<acl>
    <resources>
        <admin>
            <children>
                <donor translate="title" module="Mynamespace_Donor">
                    <title>Donors</title>
                    <sort_order>60</sort_order>
                    <children>
                        <manage_donors>
                            <title>Manage Donors</title>
                        </manage_donors>
                    </children>
                </donor>
            </children>
        </admin>
    </resources>
</acl>

: ? ?

, , URL , , /admin/donor /donor. ?


1 . - , - . adminhtml, :

- Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action. Mage_Adminhtml_Controller_Action , , Admin .

, , , -, .

The menu

+3
3

:

<frontname>donor</frontname>

:

<frontname>donor</frontname>

404.

+7
<config>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <mynamespace_donor before="Mage_Adminhtml">Mynamespace_Donor</mynamespace_donor>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

config.xml

:

http://prattski.com/2010/06/24/magento-overriding-core-files-blocks-models-resources-controllers/

+5

; module="Mynamespace_Donor" . , :

<tutorial_menu translate="title" module="adminhelloworld">

It uses a module alias instead of a module name - adminhelloworldinstead Alanstormdotcom_Adminhelloworld. Magento is trying to find the assistant needed to translate the name. In your case, you need:

<donor translate="title" module="donor">

donor comes from your own configuration file:

<helpers>
    <donor> <!-- <<< This is the alias "donor" -->
        <class>Mynamespace_Donor_Helper</class>
    </donor>
</helpers>
+2
source

All Articles