0

I tried to create a simple module and menu.The Menu is successfully created and show. My question is how to add the same menu as a sub menu of existing menus(Ex : System).

here is my Approach to achieve this.

My config.mxl file - Path(app\code\local\Muja\Hidh\etc)

<?xml version="1.0"?>
<config>
<modules>
<Muja_Hidh>
  <version>0.1.0</version>
</Muja_Hidh>
</modules>
<frontend>
<routers>
<hidh>
    <use>standard</use>
      <args>
        <module>Muja_Hidh</module>
        <frontName>hidh</frontName>
      </args>
  </hidh>
</routers>
</frontend>
<global>
<helpers>
  <hidh>
    <class>Muja_Hidh_Helper</class>
  </hidh>
</helpers>
<blocks>
  <hidh>
    <class>Muja_Hidh_Block</class>
  </hidh>
</blocks>
<models>
  <hidh>
    <class>Muja_Hidh_Model</class>
    <resourceModel>hidh_mysql4</resourceModel>
  </hidh>
</models>
<resources>
<hidh_setup>
    <setup>
      <module>Muja_Hidh</module>
    </setup>
    <connection>
      <use>core_setup</use>
    </connection>
  </hidh_setup>
  <hidh_write>
    <connection>
      <use>core_write</use>
    </connection>
  </hidh_write>
  <hidh_read>
    <connection>
      <use>core_read</use>
    </connection>
  </hidh_read>
</resources>
</global>
<admin>
<routers>
  <hidh>
    <use>admin</use>
    <args>
      <module>Muja_Hidh</module>
      <frontName>admin_pets</frontName>
    </args>
  </hidh>
</routers>
</admin>
<adminhtml>
<menu>
  <hidh module="hidh">
    <title>My Pets</title>
    <sort_order>100</sort_order>
    <children>
      <hidhbackend module="hidh">
        <title>Pet List</title>
        <sort_order>0</sort_order>
        <action>admin_hidh/adminhtml_hidhbackend </action>
      </hidhbackend>
    </children>
  </hidh>
</menu>
<acl>
  <resources>
    <all>
      <title>Allow Everything</title>
    </all>
    <admin>
      <children>
        <hidh translate="title" module="hidh">
          <title>Hidh</title>
          <sort_order>1000</sort_order>
          <children>
      <hidhbackend translate="title">
        <title>Muja Kuja</title>
      </hidhbackend>
          </children>
        </hidh>
      </children>
    </admin>
</resources>
</acl>
</adminhtml>
</config>

My Layout.xml was Muja_Hidh.xml : Path(app\etc\modules)

<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
    <Muja_Hidh>
        <active>true</active>
        <codePool>local</codePool>
    </Muja_Hidh>
</modules>

I can view the menu after system main menu.My question is how can i add it into under System menu. enter image description here

2

It's Very simple Buddy. Follow the below steps to add a new Menu under System.

Step 1. I assume that you have already developed the module.

Step 2. Open your config.xml file.

Step 3. Search the below code.

<menu>
  <hidh module="hidh">
    <title>My Pets</title>
    <sort_order>100</sort_order>
    <children>
      <hidhbackend module="hidh">
        <title>Pet List</title>
        <sort_order>0</sort_order>
        <action>admin_hidh/adminhtml_hidhbackend </action>
      </hidhbackend>
    </children>
  </hidh>
</menu>

Step 4: Replace with below code.

<menu>
  <system module="adminhtml">   
    <sort_order>100</sort_order>
    <children>
      <hidhbackend module="hidh">
        <title>Pet List</title>
        <sort_order>0</sort_order>
        <action>admin_hidh/adminhtml_hidhbackend </action>
      </hidhbackend>
    </children>
  </system>
</menu>

Step 5: save file and refresh your backend.

let me know if you have any query.

  • Thank you, The system tag should end with</system> instead of </hidh>..Its work for me and i want to add <acl> for shw in the user roles.What do you think about adding and adminhtml.xml to this task? – Mujahidh Nov 24 '14 at 12:47
  • yes you have to add that code in adminhtml.xml and mark answer is correct – Keyul Shah Nov 24 '14 at 12:53

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.