Skip to main content
Tweeted twitter.com/StackMagento/status/863556145658699777
added 586 characters in body
Source Link

Previously (in Magento 1, that is) we created a module called Setup which contained setting for the site. The upgrade scripts looks something like this:

$installer = $this;
$installer->startSetup();
$installer->setConfigData("fastsimpleimport/general/partial_indexing", 1);
$installer->setConfigData("fastsimpleimport/product/disable_preprocess_images", 1);
$installer->setConfigData('general/country/default', 'GB');
$installer->setConfigData('general/locale/firstday', 1); 
$installer->setConfigData('general/locale/timezone', 'Europe/London');
$installer->setConfigData('general/store_information/merchant_country', 'GB');
$installer->setConfigData('design/header/welcome', 'Enter your value');
$installer->setConfigData('design/head/title_suffix', 'Enter your value');
$installer->setConfigData('currency/options/base', 'GBP');
$installer->setConfigData('currency/options/default', 'GBP');
// ...

I can't figure out how to do the above in M2.

In other words: How do I go about setting config data in M2?

Previously (in Magento 1, that is) we created a module called Setup which contained setting for the site. The upgrade scripts looks something like this:

$installer = $this;
$installer->startSetup();
$installer->setConfigData("fastsimpleimport/general/partial_indexing", 1);
$installer->setConfigData("fastsimpleimport/product/disable_preprocess_images", 1);

I can't figure out how to do the above in M2.

In other words: How do I go about setting config data in M2?

Previously (in Magento 1, that is) we created a module called Setup which contained setting for the site. The upgrade scripts looks something like this:

$installer = $this;
$installer->startSetup();
$installer->setConfigData("fastsimpleimport/general/partial_indexing", 1);
$installer->setConfigData("fastsimpleimport/product/disable_preprocess_images", 1);
$installer->setConfigData('general/country/default', 'GB');
$installer->setConfigData('general/locale/firstday', 1); 
$installer->setConfigData('general/locale/timezone', 'Europe/London');
$installer->setConfigData('general/store_information/merchant_country', 'GB');
$installer->setConfigData('design/header/welcome', 'Enter your value');
$installer->setConfigData('design/head/title_suffix', 'Enter your value');
$installer->setConfigData('currency/options/base', 'GBP');
$installer->setConfigData('currency/options/default', 'GBP');
// ...

I can't figure out how to do the above in M2.

In other words: How do I go about setting config data in M2?

Source Link

How can I set configuration values in Magento 2?

Previously (in Magento 1, that is) we created a module called Setup which contained setting for the site. The upgrade scripts looks something like this:

$installer = $this;
$installer->startSetup();
$installer->setConfigData("fastsimpleimport/general/partial_indexing", 1);
$installer->setConfigData("fastsimpleimport/product/disable_preprocess_images", 1);

I can't figure out how to do the above in M2.

In other words: How do I go about setting config data in M2?