A couple of problems here, firstly you haven't defined the module and version at the top of config.xml
, also you should be defining system -> configuration menu items in system.xml
rather than config.xml
(in the same directory as config.xml
). Finally in later versions of Magento you need to define the access control for you module in order for admin to correctly function (this is good practice regardless of Magento version). This can be done inside config.xml, but putting it instead inside adminhtml.xml
(again in the same directory as config.xml
) keeps things more manageable as config.xml can get pretty long for more complex modules.
The module definition inside app/etc/modules looks fine.
So you would have something like this for your config.xml
:
<?xml version="1.0"?>
<config>
<modules>
<First_Module>
<version>0.1.0</version>
</First_Module>
</modules>
...
</config>
And this for your system.xml
(defining your system configuration menu items):
<?xml version="1.0"?>
<config>
<tabs>
<customtab translate="label">
<label>Tab Header</label>
<sort_order>500</sort_order>
</customtab>
</tabs>
<sections>
<section1 translate="label">
<label>Section Label</label>
<tab>customtab</tab>
<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>
<groups>
<optiongroup translate="label">
<label>Option Group Header</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>
<fields>
<field1>
<label>Field 1 Name</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>
</field1>
<field2>
<label>Field 2 Name</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<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>
</field2>
<field3>
<label>Field 3 Name</label>
<frontend_type>hidden</frontend_type>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</field3>
</fields>
</optiongroup>
</groups>
</section1>
</sections>
</config>
Note the above creates a custom tab and has a few example options added.
Finally, your adminhtml.xml
defining ACL for your module would be something like this:
<?xml version="1.0"?>
<config>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<system>
<children>
<config>
<children>
<section1 module="module">
<title>First Module</title>
</section1>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
With this in place you can then pull these config options using:
Mage::getStoreConfig('section1/optiongroup/field1');
public function indexAction($coreRoute = null) { echo Mage::getStoreConfig('some/random/xpath'); // Returns nothing var_dump( Mage::getConfig()->getNode('default/some/random/xpath') ); // Returns False die; $pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE); if (!Mage::helper('cms/page')->renderPage($this, $pageId)) { $this->_forward('defaultIndex'); } }