简体   繁体   中英

Magento: Override phtml inside /base/default/template

I'm trying to override
app/design/frontend/base/default/template/contacts/ form.phtml .

I followed several guides without success:
I can only post one link since I don't have enough reputation to post more :( http://www.magento.scommerce-mage.co.uk/override-phtml-or-layout-core-files-in-magento.html

In fact I'm even more confused now since they are all using different approaches. At the moment I'm trying to do it like in the last guide since this is the most up to date one(2014) without success so far.

So here is what I got:
app/code/local/Namespace/MyModule/etc/ config.xml

<config>
    <frontend>
        <layout>
            <updates>
                <contactredirect>
                    <file>contactredirect.xml</file>
                </contactredirect>
            </updates>
        </layout>
    </frontend>
</config>



app/design/frontend/base/default/layout/ contactredirect.xml

<layout version="0.1.0">
    <contacts_index_index translate="label">
        <reference name="contacts.form">
            <action method="setTemplate">
                <template>contactredirect/form.phtml</template>
            </action>
        </reference>
    </contacts_index_index>
</layout>



And finally the location of my form.phtml (the content probably doesn't matter):
app/design/frontend/base/default/template/contactredirect/ form.phtml .

Any help is appreciated!

use "contactForm" in reference name ie code should be--

<reference name="contactForm">
            <action method="setTemplate">
                <template>contactredirect/form.phtml</template>
            </action>
        </reference>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM