1

Im trying to add a default value to admin dropdown. I have used tag to do it, but it takes no effect...

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <tabs>
        <connector translate="label" module="ddg">
            <label>Test</label>
            <sort_order>1000</sort_order>
        </connector>
    </tabs>
    <sections>
        <connector_api_credentials translate="label" module="ddg">
            <label><![CDATA[API Credentials]]></label>
            <tab>connector</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
            <groups>
                <trial translate="label" module="ddg">
                    <frontend_type>text</frontend_type>
                    <frontend_model>ddg_automation/adminhtml_system_config_trial</frontend_model>
                    <sort_order>5</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>0</show_in_store>
                    <expanded>1</expanded>
                </trial>
                <api translate="label" module="ddg">
                    <label>Test label</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>0</show_in_store>
                    <expanded>1</expanded>
                    <fields>
                        <enabled translate="label" module="ddg">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </enabled>
                        <username translate="label" module="ddg">
                            <label>API Username</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <depends><enabled>1</enabled></depends>
                        </username>
                        <password translate="label" module="ddg">
                            <label>API Password</label>
                            <frontend_type>obscure</frontend_type>
                            <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
                            <sort_order>30</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <depends><enabled>1</enabled></depends>
                        </password>
                    </fields>
                </api>
            </groups>
        </connector_api_credentials>
    </sections>
    <default>
        <connector_api_credentials>
            <api>
                 <enabled>No</enabled>
            </api>
        </connector_api_credentials>
    </default>
</config>

What I'm doing wrong?

2

You need to set default value in config.xml.

You can follow here LINK

  • Please note the default tags at the bottom: <default> <connector_api_credentials> <api> <enabled>No</enabled> </api> </connector_api_credentials> </default> – user3713377 Aug 6 '16 at 11:57
  • Yes i see in your code. its in system.xml , but you need to put that code in config.xml and have a look at [Reference] (stackoverflow.com/questions/38528551/…) – Chirag Rajput Aug 6 '16 at 12:00

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.