To get store config data, I would use this code:
$data = Mage::getStoreConfig('my/path/whatever');
Now, how could I save to that node? I tried Alans suggestions from Override Magento Config, but it did not work for me.
Thanks!
Magento has provided us with a variety of configuration options for our store. Not only it is easy to access but also user-friendly, you just need to go to the admin menu, select Stores > Settings > Configuration.
Magento saves all admin settings in core_config_data table in your Magento database. There you can get values by its path, a string which indicates the path to and a variable name. In order to set data for this table, we can use save () function which is located in \Magento\Framework\App\Config\Storage\WriteInterface.
$scopeId can be 0 if you set as default or you can find your scope_id in Magento store, store_group, store_website table in database. We have learned how to set configuration data, but what if we want to retrieve config data to use?
Set the base URL for the default scope: Set the base URL for the base website: Set the base URL for the test store view: If you use the --lock-env option as follows, the command saves the configuration value in <Magento base dir>/app/etc/env.php and disables the field for editing this value in Admin.
Try following:
$value = "100";
Mage::getModel('core/config')->saveConfig('my/path/whatever', $value);
OR
$resource = $this->getResourceModel();
$resource->saveConfig(rtrim('my/path/whatever', '/'), 1, 'default', 0);
Empire Solution is right but do remember to clean cache after it. So use something like
$value = "100";
Mage::getModel('core/config')->saveConfig('my/path/whatever', $value);
Mage::getModel('core/config')->cleanCache();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With