Magento – How to override config.xml

configurationcontact-usmagento-1.9overrides

I need to change contact us page email template type from "text" to "HTML". I found it is in the config.xml

 <email>
    <contacts_email_email_template translate="label" module="contacts">
       <label>Contact Form</label>
       <file>contact_form.html</file>
       <type>text</type>
    </contacts_email_email_template>
 </email>

How properly to override config.xml

[EDIT] this is for the file app/code/core/mage/contact/etc/config.xml and the below answer will work for any …/mage/ANYTHING/etc/config.xml

Best Answer

Create your own module ([Namespace]_[Module]).
For this you need:
app/etc/modules/[Namespace]_[Module].xml - the declaration file

<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace]_[Module]>
            <codePool>local</codePool>
            <active>true</active>
            <depends>
                <Mage_Contacts /><!-- so the config is loaded after the one from Mage_Contacts -->
            </depends>
        </[Namespace]_[Module]>
    </modules>
</config>

app/code/local/[Namespace]/[Module]/etc/config.xml - the configuration file

<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace]_[Module]>
            <version>1.0.0</version>
        </[Namespace]_[Module]>
    </modules>
    <global>
        <template>
            <email>
                <contacts_email_email_template>
                    <type>html</type><!-- same xpath as in the original config file -->
                </contacts_email_email_template>
            </email>
        </template>
    </global>
</config>

Clear the cache and you are set to go.
Basically this is how you can overwrite any node from config.xml. Just create a module and in it's config.xml file replicate the original node path and add your value.

Related Topic