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
1 Answer 1
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.
-
I have done as per ur answer, but no luck!prasad maganti– prasad maganti2013年10月11日 08:06:10 +00:00Commented 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.Marius– Marius2013年10月11日 08:10:59 +00:00Commented 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?prasad maganti– prasad maganti2013年10月11日 08:59:50 +00:00Commented 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.prasad maganti– prasad maganti2013年10月11日 09:02:20 +00:00Commented 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_datathe records with pathtesttabsection/grouptestgroup/fieldtestfieldMarius– Marius2013年10月11日 10:11:43 +00:00Commented Oct 11, 2013 at 10:11