The default values must be added in the config.xml
file.
Add this inside the <config>
tag:
<default>
<testtabsection><!-- tag of the system.xml section -->
<grouptestgroup><!-- tag of the system.xml group -->
<fieldtestfield>Your value here</fieldtestfield><!-- tag of the system.xml field -->
</grouptestgroup>
</testtabsection>
</default>
Clear the cache and check your system configuration section.
Magento core has all the example you need.
Look at how the salesrules adminhtml is built. It is a good example of how tabs can be built using layout.xml
You just need to systematically duplicate the structure into your own module, and you will have tabs, handled by layout.xml. It is then easy to add tabs as needed.
Here is a rundown:
Have a look at promo.xml in app/design/adminhtml/default/default/layout/promo.xml, specifically at the handle <adminhtml_promo_quote_edit>
Here you will find the layout that defines the tabs used in the promo rule section:
<reference name="left">
<block type="adminhtml/promo_quote_edit_tabs" name="promo_quote_edit_tabs">
<block type="adminhtml/promo_quote_edit_tab_main" name="promo_quote_edit_tab_main" />
<block type="adminhtml/promo_quote_edit_tab_conditions" name="promo_quote_edit_tab_conditions"/>
<block type="adminhtml/promo_quote_edit_tab_actions" name="promo_quote_edit_tab_actions"/>
<block type="adminhtml/promo_quote_edit_tab_labels" name="promo_quote_edit_tab_labels"/>
<block type="adminhtml/promo_quote_edit_tab_coupons" name="promo_quote_edit_tab_coupons">
<block type="adminhtml/promo_quote_edit_tab_coupons_form" name="promo_quote_edit_tab_coupons_form"/>
<block type="adminhtml/promo_quote_edit_tab_coupons_grid" name="promo_quote_edit_tab_coupons_grid"/>
</block>
<action method="addTab"><name>main_section</name><block>promo_quote_edit_tab_main</block></action>
<action method="addTab"><name>conditions_section</name><block>promo_quote_edit_tab_conditions</block></action>
<action method="addTab"><name>actions_section</name><block>promo_quote_edit_tab_actions</block></action>
<action method="addTab"><name>labels_section</name><block>promo_quote_edit_tab_labels</block></action>
<action method="addTab"><name>coupons_section</name><block>promo_quote_edit_tab_coupons</block></action>
</block>
<block type="adminhtml/template" template="promo/salesrulejs.phtml" name="promo_quote_edit_jsinit"/>
</reference>
So, from the above you will find that you first define the main tabs container block:
<block type="adminhtml/promo_quote_edit_tabs" name="promo_quote_edit_tabs">
The block class definition is as such:
class Mage_Adminhtml_Block_Promo_Quote_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
which gives you the 'addTabs' functionality, as used in the layouts.
This is thus your starting point.
Next you define a block that will become a tab within this container.
In the example, the first block is <block type="adminhtml/promo_quote_edit_tab_main" name="promo_quote_edit_tab_main" />
and the class is defined as:
class Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main
extends Mage_Adminhtml_Block_Widget_Form
implements Mage_Adminhtml_Block_Widget_Tab_Interface
You then attach this block to the container using the addTab action
<action method="addTab"><name>main_section</name><block>promo_quote_edit_tab_main</block></action>
and repeat the process for each tab you add.
The coupons tab gives you a good example of how to place a grid within a tab.
I hope this pointer gets you in the right direction.
Ask for any further clarification.
Best Answer
If you want all the details please check the links provided by Alan Storm and others. As this has been documented extensively before I will only provide a simple example for the sake of answering the question.
Create your own extension with your namespace (called
Vendor
in the following) and extension name (Extensionname
).Add the file
app/code/[codePool]/[Vendor]/[Extensionname]/etc/system.xml
. From your text I assume that you already did that.First important bit: when adding a new section, specify the correct tab name as specified in the system.xml under
E.g.
Add your groups and fields as usual.
Second important bit add the section to the ACL in
app/code/[codePool]/[Vendor]/[Extensionname]/etc/adminhtml.xml
so that you can enter the section (after you have added the permission to the backend users and logged out/in again).Even without groups and fields you should be able to see the section.