Magento: How can I migrate configuration changes from development to production environment?

拥有回忆 提交于 2019-11-30 13:53:55

Not sure if it is still actual, but if you mean changes to system -> config, then it is much more better to use such config.xml nodes instead of writing database upgrade.

Magneto processes core_config_data table into global XML structure, so you may just change XML structure without using db table for making changes to system configuration.

Here is small example:

<config>
   <stores>
       <french>
          <design>
             <theme>
                 <default>french</default>
             <theme>
          </design>
       </french>
   </stores>
   <websites>
       <base>
          <design>
             <theme>
                 <default>english</default>
             <theme>
          </design>
       </base>
   </websites>
</config>

In this example one configuration field is changed for two scopes in Magento. It is definition of current theme depending on current website and store.

So <stores /> node contains configuration values for a particular store. Where each child element is named with store code and contains configuration data in nested view. And <website /> node contains configuration values for a particular website. Where each child element is named with website code and contains configuration data in nested view as well.

Also there is available <default /> node for configuration values in global scope. But it will be overridden by <stores /> and <websites /> if a particular value is for a scope.

I am making changes to configuration only via config.xml because deploying the project is much easier when you just need to install it via Magento installer without doing changes in "System -> Config".

Make the changes as part of a an install or upgrade script in your module's "sql" directory. In your module's "config.xml" file increment the version number of every matching change and also remember to fill in the <config><global><resources><MODULE_setup><setup> node.

Because the script is run within the context of Magento you have access to all the normal functionality too, updates don't have to be in the form of SQL commands.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!