2

I have just installed Magento 2 and am starting to go through the configuration. In Stores > Configuration, I notice that the fields are all greyed out (under General for example) and a checkbox is ticked next to them saying "Use System Value".

After searching for a while, I found this link: https://magento.stackexchange.com/a/146480/1884

So I think I have found the System values for this element, however, I assume I need to know how to override these defaults, instead of editing this file? Am I correct in thinking this?

If so, How do I override this file. Where do I copy it to?

In Magento 1, it would be app/code/local... but in Magento 2?

2 Answers 2

4

"Use system values" works as a "Restore to factory settings" feature.
Let me explain how the config section works.
The config values can come from the config.xml files of every module or from the database, core_config_data table.
If the path field from the database for a config setting matches the tag path from a config file, the database value will overwrite the value from config.xml.

For example if you have a row in the db with the path a/b/c and the value 5 and in a config.xml you have

<a>
    <b>
        <c>2</c>
    </b>
</a>

the application will use the db value 5.

What the Use system value does is to delete the row from the database for the path a/b/c making Magento use the value from config.xml if needed.

So don't be afraid to uncheck the "Use system value" checkbox and change in the UI to what you need.

But if you really want to change this value you will have to add some xml markup in one of your config.xml files of one of your modules.
For example, if you want to change the value of max_depth from the catalog module
you need to create your own module that is loaded after the catalog module (just add <sequence><Magento_Catalog /></sequence> in the module.xml file) and make your config.xml file look like this

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <catalog>
            <navigation>
                <max_depth>0</max_depth>
            </navigation>
        </catalog>
    </default>
</config>
3
  • Thanks Marius! I take it then that we don't "override" XML files, but instead create our own XML files to load in last with any changes like this?
    – robgt
    Commented Mar 22, 2017 at 11:30
  • yes. But it worked the same on M1. You could not override xml files. The fact that it worked how you did it and it looked like an override it was just a side-effect. It was actually a new xml file that was merged with all the other ones.
    – Marius
    Commented Mar 22, 2017 at 12:30
  • well explained @Marius :) Commented Nov 10, 2018 at 15:50
1

I had this problem on a Magento Cloud project. The issue was that I ran a app:config:dump. This then pulled and locked all of the values into config.php. It also meant that much of the admin was locked with 'Use system value' greyed out. Once I reverted my config.php back I could edit the admin values again.

1
  • I agree: config.php will be consulted first and provide the settings, not just for Magento Cloud projects. This is good for a production site so that settings cannot be changed accidentally (or maliciously). However, this means that running app:config:dump will prevent manually changing those settings via the dashboard in the future. Commented Jul 10, 2019 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.