1

I have some problems with a second contact form for revocation. The normal contact forms works fine, but I need a second form with special fields like OrderID, OrderDate, Address, ....

I made a new form-template near the form.phtml called revocation.phtml. Works fine

I made an url rewrite from contact/index to revocation. Works fine

Put a second declaration for revocation in the contacts.xml Works fine. Is that maybe wrong?

I made an email template for the special values of the revocation. Here is the problem.

When I send the revocation form magento use the normal contact mail template and the values for OrderId, OrderDate ... are lost. The shop owner only gets the normal contact email with name, text...

How can I use the revocation email template instead of the contact email template?

In the admin configuration I can choose the standard template for the contact form, but i can´t find a solution for the revocation email.

Here the contacts.xml

<layout version="0.1.0">

    <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/2columns-left.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="contacts/form.phtml"/>
        </reference>
        <remove name="topslider"/>
        <remove name="topseller"/>
    </contacts_index_index>

    <contacts_index_index translate="label">
        <label>Revocation</label>
        <reference name="head">
            <action method="setTitle" translate="title" module="contacts"><title>Revocation</title></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
            <action method="setHeaderTitle" translate="title" module="contacts"><title>Revocation</title></action>
        </reference>
        <reference name="content">
            <block type="core/template" name="contactForm" template="contacts/revocation.phtml"/>
        </reference>
        <remove name="topslider"/>
        <remove name="topseller"/>
    </contacts_index_index>
</layout>

I use magento 1.8.1

1

You're on the right track I think, but you need to change the handle of your Revocation XML, now you have declared contacts_index_index twice.

You should change the second handle, the one you've added, to, for example contacts_index_revocation, and extend the ContactsController and add a revocationAction() method. Or, you can create your own controller and use that handle in your XML.

Then, add a revocationPostAction() method, copy the contents of the postAction() method, and change want you want to change. You'll see here that there are certain fields defined in this method.

To add another template to the configuration, add something like this to any system.xml, in the right section (contacts):

<config>
  <sections>
    <contacts>
      <groups>
        <email>
          <fields>
            <email_template_revocation translate="label">
              <label>Email Template Revocation</label>
              <frontend_type>select</frontend_type>
              <source_model>adminhtml/system_config_source_email_template</source_model>
              <sort_order>30</sort_order>
              <show_in_default>1</show_in_default>
              <show_in_website>1</show_in_website>
              <show_in_store>1</show_in_store>
            </email_template_revocation>
          </fields>
        </email>
      </groups>
    </contacts>
  </sections>
</config>

Then use this XML path in your revocatePostAction() method.

Is this what you wanted to achieve?

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.