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

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.

  • I have done as per ur answer, but no luck! – prasad maganti Oct 11 '13 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 Oct 11 '13 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 Oct 11 '13 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 Oct 11 '13 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 – Marius Oct 11 '13 at 10:11

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.