Dave Bevington
Dave Bevington

Reputation: 125

Magento Layout Headaches

I have recently started magento development and am having real difficulty. I've been following tutorials but am finding so many of them contradict each other. I've created a module based on one such tutorial but I just get a blank admin page when I run it. I'm pretty sure its going to be something simple as the tutorial I followed stupidly uses the same package name and model name which makes things very confusing if you don't know the xml.

My module is called : Relentless_Tradecounter

adminhtml.xml

<?xml version="1.0"?>
<config>

    <menu>
        <relentless module="tradecounter">
            <title>Relentless Suite</title>
            <sort_order>11</sort_order>              
            <children>
                <tradecounter module="tradecounter">
                    <title>Trade Counter</title>
                    <sort_order>1</sort_order>
                    <children>
                    	<item1 module="tradecounter">
                    		<title>Payment Options</title>
                    		<sort_order>1</sort_order>
                    		<action>tradecounter/adminhtml_payment</action>
                		</item1>
                		<item2 module="tradecounter">
                    		<title>Shipping Options</title>
                    		<sort_order>2</sort_order>
                    		<action>tradecounter/adminhtml_shipping</action>
                		</item2>
                    </children>
                </tradecounter>
            </children>
        </relentless>
    </menu>

    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <Relentless_Tradecounter>
                        <title>Trade Counter Module</title>
                        <sort_order>10</sort_order>
                    </Relentless_Tradecounter>
                </children>
            </admin>
        </resources>
    </acl>

    <layout>
        <updates>
            <tradecounter>
                <file>payment.xml</file>
            </tradecounter>
        </updates>
    </layout>

</config>

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Relentless_Tradecounter>
            <version>0.1.0</version>
        </Relentless_Tradecounter>
    </modules>
    <frontend>
        <routers>
            <tradecounter>
                <use>standard</use>
                <args>
                    <module>Relentless_Tradecounter</module>
                    <frontName>tradecounter</frontName>
                </args>
            </tradecounter>
        </routers>
    </frontend>
    <global>
        <blocks>
            <tradecounter>
                <class>Relentless_Tradecounter_Block</class>
            </tradecounter>
        </blocks>
        <helpers>
            <tradecounter>
                <class>Relentless_Tradecounter_Helper</class> 
            </tradecounter>
        </helpers>
    </global>
</config>

payment.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <tradecounter_adminhtml_payment_index>
        <reference name="content">
            <block type="tradecounter/adminhtml_payment" name="payment" />
        </reference>
    </tradecounter_adminhtml_payment_index>
</layout>

Am pretty sure the error is in the xml as im not getting any php errors even with developer mode turned on. If anyone can help me with this or point me in the direction of some good tutorials on building admin modules I would be most grateful.

Thanks in advance Dave

Upvotes: 0

Views: 40

Answers (1)

Girish Hosamani
Girish Hosamani

Reputation: 1203

You have missed out to define the admin router.

Add the following code in between </frontend> and <global>

<admin>
    <routers>
        <tradecounter>
             <use>admin</use>
            <args>
               <module>Relentless_Tradecounter</module>
               <frontName>tradecounter</frontName>
            </args>
      </tradecounter>
    </routers>
</admin>

Follow this tutorial : http://www.pierrefay.com/create-backend-plugin-magento-75

You have to start from the first lesson to get the clear picture : http://www.pierrefay.com/magento-plugins-structure-22

Read the comments also in that tutorials.

I hope this will helps you.

Upvotes: 1

Related Questions