cancel
Showing results for 
Search instead for 
Did you mean: 

custom model admin

custom model admin

Hi,

 

trying to develop my own contacts module, I can see it in the admin menu, but when clicking nothing shows. If I put a die('test') in the index of my controller I can see it, so the controller is called. I guess block it's not working. Here is my adminhtml.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <menu>
        <hoop_contact translate="title" module="hoop_contact">
            <title>Contacts</title>
            <sort_order>10</sort_order>
            <children>
                <contact module="hoop_contact">
                    <title>Contacts</title>
                    <action>adminhtml/contact</action>
                </contact>
            </children>
        </hoop_contact>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <hoop_contact>
                        <children>
                            <contact>
                                <title>Contacts</title>
                                <sort_order>10</sort_order>
                            </contact>
                        </children>
                    </hoop_contact>
                </children>
            </admin>
        </resources>
    </acl>
</config>

there is config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Hoop_Contact>
            <version>1.0.0.0</version>
        </Hoop_Contact>
    </modules>
    <global>
        <models>
            <hoop_contact>
                <class>Hoop_Contact_Model</class>
                <resourceModel>hoop_contact_resource</resourceModel>
            </hoop_contact>
            <hoop_contact_resource>
                <class>Hoop_Contact_Model_Resource</class>
            </hoop_contact_resource>
        </models>
        <blocks>
            <hoop_contact>
                <class>Hoop_Contact_Block</class>
            </hoop_contact>
        </blocks>
        <helpers>
            <hoop_contact>
                <class>Hoop_Contact_Helper</class>
            </hoop_contact>
        </helpers>
        <resources>
            <contact_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </contact_write>
            <contact_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </contact_read>
            <hoop_contact_setup>
                <setup>
                    <module>Hoop_Contact</module>
                    <class>Hoop_Contact_Model_Resource_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </hoop_contact_setup>
        </resources>
        <helpers>
            <hoop_contact>
                <class>Hoop_Contact_Helper</class>
            </hoop_contact>
        </helpers>
        <blocks>
            <hoop_contact>
                <class>Hoop_Contact_Block</class>
            </hoop_contact>
        </blocks>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <hoop_contact before="Mage_Adminhtml">Hoop_Contact_Adminhtml</hoop_contact>
                    </modules>
                </args>
                <layout>
                    <updates>
                        <hoop_contact>
                            <file>contact.xml</file>
                        </hoop_contact>
                    </updates>
                </layout>
            </adminhtml>
        </routers>
    </admin>
</config>

this is Contact.php inside Block/Adminhtml:

 

<?php

class Hoop_Contact_Block_Adminhtml_Contact extends Mage_Adminhtml_Block_Widget_Grid_Container
{
    public function __construct()
    {die('test block');
        $this->_blockGroup = 'contact';
        $this->_controller = 'adminhtml_contact';
        $this->_headerText = Mage::helper('hoop_contact')->__('Contact');
        parent::__construct();
    }
}

and finally ContactController.php:

<?php

class Hoop_Contact_Adminhtml_ContactController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        die('test');
        $this->_title($this->__('Contact'))->_title($this->__('Contacts'));
        $this->loadLayout();
        $this->_setActiveMenu('hoop_contact/contact');
        $this->renderLayout();
    }

What am I doing wrong? Thanks a lot.