0

I want to add order items grid in the sales section of the admin panel

I am following the below link for the same How to Add a Custom Table to Magento Admin Backend

I am getting the menu as order items in sales => order items but when I click on the order items Link to goes to 404 error page

following is the code in my config.xml file

<config>
<adminhtml>
    <menu>
        <sales>
            <children>
                <order_items translate="title">
                    <title>Order Items</title>
                    <sort_order>20</sort_order>
                    <action>adminhtml/order_items/index</action>
                </order_items>
            </children>
        </sales>
    </menu>
</adminhtml>

I have added Ikantam_KnowledgeBase.xml file in app/etc/modules folder which contains the following code :

<config>
<modules>
    <Ikantam_KnowledgeBase>
        <active>true</active>
        <codePool>local</codePool>
    </Ikantam_KnowledgeBase>
</modules>

i was not able to see the menu until I added this file in the above mentioned location . which was not given in the tutorial .

Now I am able to create the menu but the menu takes me to 404 error page.

The tutorial also mentions adding the following code in the configuration file

<config>   
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <knowledgebase before="Mage_Adminhtml">Ikantam_KnowledgeBase_Adminhtml</knowledgebase>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

when I added the above code to the config.xml files code the order items menu disappeared .

I am very new to Magento ,I have no idea where this code should be added.
Any Help will be Highly Appreciated.

  • Have you set ACL permissions for this? It's usually the cause of 404 errors – Yiorgos Moschovitis Jun 3 '16 at 6:21
  • @YiorgosMoschovitis I am new to magento , I have no idea what ACL permissions are ,i have just followed the tutorial . – user3230879 Jun 3 '16 at 6:23
1

You should set the ACL permissions for your new admin page In you config.xml add the following. That is, put the whole tag after your tag

<config>
    <adminhtml>
     ...
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <sales module="sales">
                            <children>
                                <order_items>
                                    <title>Order Items</title>
                                    <sort_order>20</sort_order>
                                </order_items>
                            </children>
                        </sales>
                    </children>
                </admin>
            </resources>
        </acl>
        ...
    </adminhtml>
</config>

At this point I have to tell you that it is better to create a different adminhtml.xml file and put and tags in there.

If you want to add a router for your module then you must replace the module name in the given code. So it will be something like the following.

<admin>
<routers>
    <adminhtml>
        <args>
            <modules>
                <module_name before="Mage_Adminhtml">Namespace_Modulename_Adminhtml</module_name>
            </modules>
        </args>
    </adminhtml>
</routers>

  • 'module_name' should be the router you have given to your module i.e. 'order_items' and should match 'adminhtml/order_items/index'
  • 'Namespace_Modulename' should be replaced with your module's full name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.