我已经覆盖了magento的默认联系我们表单,但现在表单在浏览器中加载时会显示两次。
这是我的代码:
应用程序/代码/本地/ MyCompany的/ ContactsExtension的/ etc / config.xml中
<config>
<modules>
<MyCompany_ContactsExtension>
<version>0.1.0</version>
</MyCompany_ContactsExtension>
</modules>
<frontend>
<routers>
<contacts>
<args>
<modules>
<MyCompany_ContactsExtension before="Mage_Contacts">MyCompany_ContactsExtension</MyCompany_ContactsExtension>
</modules>
</args>
</contacts>
</routers>
<layout>
<updates>
<contactsextension>
<file>contactsextension.xml</file>
</contactsextension>
</updates>
</layout>
</frontend>
<global>
<blocks>
<contactsextension>
<class>MyCompany_ContactsExtension_Block</class>
</contactsextension>
</blocks>
<helpers>
<contactsextension>
<class>MyCompany_ContactsExtension_Helper</class>
</contactsextension>
</helpers>
</global>
</config>
基本上,我复制了默认的contacts.xml并添加了我的更改。
应用程序/设计/前端/企业/ mytheme的/布局/ contactsextension.xml
<layout version="0.1.0">
<default>
<reference name="footer_links">
<action method="addLink" translate="label title" module="contacts" ifconfig="contacts/contacts/enabled"><label>Contact Us</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare></action>
</reference>
</default>
<contacts_index_index translate="label">
<label>Contact Us Form</label>
<reference name="head">
<action method="setTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="content">
<block type="core/template" name="contactForm" template="contactsextension/form.phtml">
<block type="contactsextension/additionalfield" name="contacts.addfields" as="addfields" template="contactsextension/additionalfield.phtml" />
</block>
</reference>
</contacts_index_index>
</layout>