1

I have created tabs, sections, groups and fields successfully in magento admin panel. Now I want to create default values for my fields of type text or text area. I have given proper values in my module config.xml file but I could not succeed. please help me on this.

config.xml file details system.xml file details

asked Oct 11, 2013 at 7:37

1 Answer 1

5

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.

answered Oct 11, 2013 at 7:58
6
  • I have done as per ur answer, but no luck! Commented Oct 11, 2013 at 8:06
  • @prasadmaganti. Did you clear the cache? Also add the contents of config.xml here. I'm 100% sure that this is the way to go. I think you missed something. Commented Oct 11, 2013 at 8:10
  • yes you are correct. the approach we followed is correct. but I'm unable to find where the error is. Please confirm that, is the default values appears only for the first time after fields created? Commented Oct 11, 2013 at 8:59
  • initially I have set fields and saved with other text and removed. after all this I tried to set default values, so now will the default values will work now. Commented Oct 11, 2013 at 9:02
  • 1
    @prasadmaganti. Once you save the section in config the default values are ignored. To test the default values remove from core_config_data the records with path testtabsection/grouptestgroup/fieldtestfield Commented Oct 11, 2013 at 10:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.