1

I am just a newbie to the magento extensions. I want to create a new module named as storeinfo in magento version 1.7.0.2 . For that I have my folder structure for app/local is like this

magento directory
  app
    code
      community
      core
      local---
            |--- New(foldername)--
                  |---Storeinfo(foldername)--
                        |-Block
                          controllers
                          etc
                          Helper
                          sql

code for New_Storeinfo.xml which is inside magentodirectory/app/etc is something like this

 <?xml version="1.0"?>
<config>
  <modules>
    <New_Storeinfo>
      <active>true</active>
      <codePool>local</codePool>
    </New_Storeinfo>
  </modules>
</config>

Now inside the directory magentodirectory/app/code/local/New/Storeinfo/etc/config.xml is like this

<?xml version="1.0"?>
<config>
  <modules>
    <New_Storeinfo>
      <version>0.1.1</version>
    </New_Storeinfo>
  </modules>

  <frontend>
    <routers>
      <storeinfo>
        <use>standard</use>
        <args>
          <module>New_Storeinfo</module>
          <frontName>storeinfo</frontName>
        </args>
      </storeinfo>
    </routers>
    <layout>
      <updates>
        <storeinfo>
          <file>newstoreinfo.xml</file>
        </storeinfo>
      </updates>
    </layout>
  </frontend>

  <adminhtml>
    <acl>
      <resources>
        <all>
          <title>Allow Everything</title>
        </all>
        <admin>
          <children>
            <system>
              <children>
                <config>
                  <children>
                    <storeinfo>
                      <title>Store Map</title>
                    </storeinfo>
                  </children>
                </config>
              </children>
            </system>
          </children>
        </admin>
      </resources>
    </acl>
  </adminhtml>

  <global>
        <models>
            <storeinfo>
                <class>New_Storeinfo_Model</class>
        <resourceModel>storeinfo_mysql4</resourceModel>
            </storeinfo>
        </models>
    <resources>
            <storeinfo_setup>
                <setup>
                    <module>New_Storeinfo</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </storeinfo_setup>
            <storeinfo_write>
                <connection>
                  <use>core_write</use>
                </connection>
            </storeinfo_write>
            <storeinfo_read>
               <connection>
                <use>core_read</use>
              </connection>
            </storeinfo_read>
        </resources>
    <blocks>
            <storeinfo><class>New_Storeinfo_Block</class></storeinfo>
        </blocks>
    <helpers>
            <storeinfo>
                <class>New_Storeinfo_Helper</class>
            </storeinfo>
        </helpers>
    </global>
  <default>
        <storeinfo>
      <address>
        <enabled>1</enabled>
        <title>Our Store Address</title>
        <address>Replace this with Your Address with or without HTML code here....</address>
      </address>
      <storeinfo>
        <enabled>1</enabled>
        <title>Our Location Map</title>
        <map_location>Paste Map HTML code here...</map_location>
      </storeinfo>
    </storeinfo>
    </default>
</config>

Now for the directory magentodirectory/app/code/local/New/Storeinfo/etc/system.xml my code is like this

<?xml version="1.0"?>
<config>
    <tabs>
        <storeinfo translate="label" module="storeinfo">
            <label>Store Map &amp; Address</label>
            <sort_order>132</sort_order>
        </storeinfo>
    </tabs>
    <sections>
        <storeinfo translate="label" module="storeinfo">
            <label>Map &amp; Address Info.</label>
            <tab>storeinfo</tab>
            <frontend_type>text</frontend_type>
            <sort_order>100</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <storeinfo translate="label">
                    <label>Settings</label>
                    <comment><![CDATA[
                        <p>
                            <div>Add Store info:</div>
                        </p>
                    ]]></comment>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enabled>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </title>
                        <map_location translate="label">
                            <label>Location Map HTML code</label>
                            <frontend_type>textarea</frontend_type>
                            <sort_order>3</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment><![CDATA[Collect you store map html code from any of the maps code provides like <strong>Google, Yahoo..</strong>]]></comment>
                        </map_location>
                    </fields>
                </storeinfo>
                <address translate="label">
                    <label>Address</label>
                    <comment><![CDATA[
                        <p>
                            <div>Add Store Address to your Magento Store:</div>
                        </p>
                    ]]></comment>
                    <frontend_type>text</frontend_type>
                    <sort_order>2</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enabled>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </title>
                        <address translate="label">
                            <label>Address</label>
                            <frontend_type>textarea</frontend_type>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Put you store address with or without HTML code</comment>
                        </address>
                    </fields>
                </address>
            </groups>
        </storeinfo>
    </sections>
</config>

But after all the codes the menu for Storeinfo is not showing in magento's admin configuration tab but when I went to admin->configuration->advanced->advanced->disable modules output the module can be ssen there with enable option by default. I have tried enable and disable many times but it is not working at all. So can someone kindly tell me what is the issue here?Any help and suggestions will be really appreciable. Thanks...

3

I just replicated your configuration like following:
/app/code/local/SomePackage/SomeModule/etc/adminhtml.xml:

<config>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <storeinfo>
                                        <title>Store Map</title>
                                    </storeinfo>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

And cleared magento cache(!important) and re-authorized on backend(!important). It works and shows me your configuration.
Some important note: When you add some module or change some xml configuration files, you should clean the cache (magento updates all xml configuration) and re-authorize on backend (magento updates current admin user role resources).

  • hi thanks for the reply....if I will use the admin.xml then the same xml which is inside config.xml shall that be removed from config file? – NewUser Aug 7 '13 at 11:03
  • still I am not getting my menu in configuration tab..but it is showing in admin->configuration->advanced->advanced->disable modules output the module – NewUser Aug 7 '13 at 11:34
  • Yes, you should remove exact node if you use adminhtml.xml – mageUz Aug 7 '13 at 11:35
  • I am still not getting you can you just describe that in the answer..that will be more helpful..The module can be seen in admin->configuration->advanced->advanced->disable modules output the module but not showing in configuration tab.. – NewUser Aug 7 '13 at 11:37
  • Can you upload your module and give me the link? I will check it – mageUz Aug 8 '13 at 6:14
2

This has happened to me before and I've spent a few hours debugging and banging my head on the table (by the way don't do the last part. it doesn't help).
The problem in your declaration file app/etc/modules/New_Storeinfo.xml on this line:

<codepool>local</codepool>

It should be:

<codePool>local</codePool><!-- (uppercase P in codePool) -->

.
The Advanced section is generated by reading the declaration files but there is no validation for them. That's why your module appears there.
But the configuration form is build by reading all the system.xml files in your active modules. For your module, because the codePool tag was wrong it looked for the system.xml file in: app/code//New/Storeinfo/etc/system.xml. Notice the double slash (//). Between them it should be the value of <codePool> that's null in your case.
After making this 'heavy' modification make sure you clear the cache and log out and login again in your admin panel.

[EDIT]
One more thing. The declaration file New_Storeinfo.xml should be placed in app/etc/modules not in app/etc like you stated in the question.

  • I have changed <codepool> to <codePool> with uppercase p but still it is showing the same problem...check my updated question... – NewUser Aug 12 '13 at 12:15
  • I've copied you code on my local instance and it works after changing <codepool> to <codePool>, cleared the cache and re-logged in. – Marius Aug 12 '13 at 12:21
  • yes...but I can't see any changes even after clearing the cache.... – NewUser Aug 12 '13 at 12:22
  • @NewUser I've just spotted an other thing in your question. See my update. – Marius Aug 12 '13 at 12:25
  • I have also checked that...but still I am not getting any result.. Can you give me your mail id so that I can send you all the files – NewUser Aug 12 '13 at 12:33
1

maybe this will help you.. I have created simple module for you here maybe that can help you..

you will add the menu like this:

enter image description here

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.