2

Is there a way to inject custom core_config_data into magento?

I would like to set web/secure/base_url, web/unsecure/base_url and some others config dynamic and depending on the host.

I tried to remove the core_config_data values from the database and inject a new XML node: default/web/secure/base_url to the config in the index.php.
But I think before the Mage::run() it's to early and after the Mage::run() it's to late to change the config.

Does someone tried something familiar or is there already a cool solution?

1 Answer 1

3

in app/etc/local.xml for each host put the following:

   <stores>
        <default>
            <web>
                <unsecure>
                    <base_url>http://host_name.com/</base_url>
                </unsecure>
                <secure>
                    <base_url>http://host_name.com/</base_url>
                </secure>
            </web>
        </default>
    </stores>
3
  • Dann, you're right. I forgot that this is possible. Thank you very much. This would be a perfect solution without php
    – Pawel
    Commented Dec 6, 2016 at 21:17
  • no problem please accept Commented Dec 6, 2016 at 21:32
  • I thought about this solution. I fact with your solution it's only possible to set the config based on the website or store and NOT by the actual host.
    – Pawel
    Commented Dec 6, 2016 at 22:01

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.