how i can set sample data for configuration in our custom module in magento

266 views Asked by At

how i can set sample data for configuration in our custom module in . our code is:

$installer = $this;

$installer->startSetup();

$installer->setConfigData('groupname/sectionname/fieldname'
  ,'Thank you for contacting us. I\'m more than happy to assist you.'
  . 'You can install the Premium Website Builder through your AMP'
  . '(Account Management Panel). If you need help please feel free to contact us.'
  . 'Our support department is available to assist you 24 hours a day, 7 days a week.');

$installer->endSetup(); 
1

There are 1 answers

2
liyakat On BEST ANSWER

if you want to insert data in core_onfig_data

just use like below using installer script

<?php

$installer = $this;

$installer->startSetup();

$installer->run("

INSERT INTO {$this->getTable('core_config_data')} (scope_id,scope,path,value) values (0,'default','groupname/sectionname/fieldname','your value');


");

$installer->endSetup();

?>

Add more variable as you want.

OR Alternate way

If you are developing an extension, you can configure your field for administration using system.xml. The xpath will be catalog/groups/seo/fields/your_field (ref. Mage/Catalog/etc/system.xml).

To set a default for this value, you can either add the value to your module's config.xml using the xpath groupname/sectionname/fieldname, or you can create an install script which will write the value to core_config_data.