13

With custom modules I prefer to put system config settings in config.xml (the default settings part). This makes it easier when I push code from my local machine to a dev/staging/live environment as I don't need to go into admin and re-enter settings. There are other benefits too - it can be quicker to do things in a text editor and you can always have a sensible default if there is something in the config.xml for that.

I would like to do this for a multi-website Magento store that has different shipping prices for different websites (and store views). At the moment my stores are called 'euro', 'usd' and 'gbp'. The 'euro' view takes the admin defaults with no over-ride at the website level whereas 'gbp' and 'usd' views are with the over-ride at website level.

    ...
    <default>
    <carriers>
        <my_courier>
            <stuff_goes_here_such_as_price/>
            <price>15.00</price>
            ...
        </my_courier>
    </carriers>
</default>

19

You can add this using the <stores> node in your config.xml as follows.

<stores>
    <store_code>

You can also do this on website level with the <websites> node in your config.xml as follows.

<websites>
    <website_code>

The only examples of this in the core code is in the admin side because these are the only websites or stores that are guaranteed to be in the system. Check out app/code/core/Mage/Adminhtml/etc/config.xml for an example.

<websites>
    <admin>
        <web>
            <routers>
                <frontend>
                    <disabled>true</disabled>
                </frontend>
            </routers>
            <default>
                <no_route>admin/index/noRoute</no_route>
            </default>
        </web>
    </admin>
</websites>
  • Did not know this! Can you expand to show this with example default values so it's clear where it goes? – Jonathan Hussey Nov 27 '14 at 19:21
  • Thank-you very much! I suspect I will have to do some experimentation to get this to be actually working with my particular module, but it is great to learn something new! Thanks again! – Henry's Cat Nov 28 '14 at 11:27
  • @David Manners - that is actually working nicely. Next question - the tick boxes of 'use default', how can I unset them on a store/website level? – Henry's Cat Nov 28 '14 at 12:29
  • Worth noting this also works in Magento 2! – Josh Davenport Feb 15 '17 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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