Showing posts with label Add menu in admin configuration left side menu. Show all posts
Showing posts with label Add menu in admin configuration left side menu. Show all posts

Friday, 17 May 2013

Magento - Backend Add Menu in configuration - side menu and fields in center part



Create a file name system.xml and apply code

<?xml version="1.0"?>
<config>
    <tabs>
        <dckap>
            <label>DCKAP</label>
            <sort_order>200</sort_order>
        </dckap>
    </tabs>
    <sections>
        <onestepcheckout translate="label" module="onestepcheckout">
            <label>One Step Checkout</label>
            <tab>dckap</tab>
            <frontend_type>text</frontend_type>
            <sort_order>10</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <general translate="label" module="core">
                    <label>General</label>
                    <frontend_type>text</frontend_type>
           
                    <sort_order>10</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" module="core">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <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>
                        </enabled>
                        <title translate="label" module="cms">
                            <label>Page Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </title>
                        
                        <guest_checkout translate="label" module="checkout">
                            <label>Allow Guest Checkout</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>60</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </guest_checkout>
                                                        
                    </fields>
                </general>
        <terms>
             <label>Terms and Conditions</label>
              <frontend_type>text</frontend_type>
              <sort_order>500</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>Enable Terms and Conditions</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                                    </enabled>
                   
                    <condition translate="label comment">
                                  <label>Text for Terms and Conditions</label>
                                  <comment>
                                    Please provide terms and condition wordings
                                  </comment>
                                  <frontend_type>textarea</frontend_type>
                                   <sort_order>20</sort_order>
                                  <show_in_default>1</show_in_default>
                                  <show_in_website>1</show_in_website>
                                  <show_in_store>1</show_in_store>
                    </condition>
             </fields>
        </terms>
        <layout translate="label">
              <label>One Step Checkout Page Columns</label>
              <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>
                  <fields>
                      <design translate="label">
                          <label>Column Assign for Checkout Page</label>
                          <comment>
                        Please select Layout design for one step checkout
                          </comment>
                          <frontend_type>select</frontend_type>
                          <source_model>onestepcheckout_adminhtml/system_config_source_layout</source_model>
                          <sort_order>10</sort_order>
                          <show_in_default>1</show_in_default>
                          <show_in_website>1</show_in_website>
                          <show_in_store>1</show_in_store>
                    </design>
                         
                  </fields>
                </layout>    
                                  
            </groups>
        </onestepcheckout>
    </sections>
</config>



----------------------------------------------------------------------------------------------------------------------------------------

<source_model>adminhtml/system_config_source_enabledisable</source_model> //This code values are taken from core ,so dont worrry about code

<source_model>onestepcheckout_adminhtml/system_config_source_layout</source_model>
//If you want inbuild new array value means please create the layout.php file in above path
//Then give the below code in config.xml files.

 <global>
        <models>
                   <onestepcheckout_adminhtml>
                <class>DCKAP_Onestepcheckout_Adminhtml_Model</class>
            </onestepcheckout_adminhtml>
            </models>
</global>


---------------------------------------------------------------------------------------------------------------------------------------

Layout.php

class DCKAP_Onestepcheckout_Adminhtml_Model_System_Config_Source_Layout
{
    public function toOptionArray()
    {
   
        return array(
        array('value' => '2_column_layout', 'label' => '2 Column Layout'),
        array('value' => '3_column_layout', 'label' => '3 Column Layout')
       
    );
      
    }
}


Automatically values are stored in core_config_data table


Thats it :)