0

We are running Magento 1.7.0 and trying to make an extension for that. That extension need a few configurations and we are configure them inside etc/config.xml. The issue is we won't be able to set the default value for these configurations Our fields definitions:

<config>
  <sections>
    <mymodule_options translate="label" module="mymodule_core">
      <label>Mymodule Core Options</label>
      <tab>mymodule_config</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>1</show_in_store>
      <groups>
        <api translate="label">
          <label>Advanced Options</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>
          <expanded>1</expanded>
          <fields>
            <api_key>
              <label>API Key</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>
            </api_key>
            <server_host>
              <label>Server Host</label>
              <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>
            </server_host>
            <server_port>
              <label>Server Port</label>
              <frontend_type>text</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>
          </server_port>
        </fields>
        </api>
      </groups>
    </mymodule_options>
  </sections>
  <default>
    <mymodule_options>
      <api>
        <server_host>mymodule.herokuapp.com</server_host>
        <server_port>80</server_port>
      </api>
    </mymodule_options>
  </default>              
</config>

Then we drop related rows from core_config_data, then error_log these values: Mage::getStoreConfig('mymodule_options/api/server_host') But what we got is a NULL value. If we set that value inside admin configuration interface to a random value then we get that value anyway. What we did wrong that the default value declaration does not work?

1
  • 1
    Is the above code in system.xml or config.xml? All the example I have see thus far always have <default> in config.xml .. eg blog.chapagain.com.np/… Commented Nov 23, 2012 at 14:02

1 Answer 1

2

As R.S says in the comment, your <sections> should go in system.xml and the <default> in config.xml.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.