Magento 1.9 Contact – How to Create a Contact Form?

contact-formmagento-1.9

I want to create a contact form where customers can contact me on different email to the one specified in the Magento back-end configuration.

I have a form.phtml file in /http/app/design/frontend/theme/theme/template/contacts/form.phtml and I want to have exactly the same form but on different cms page which will send the information to a different email address.

Do I copy the form.phtml and name form2.phtml but how do I adjust it so it sends the email to a different email address?

My goal is to create a "contact us" where customer can fill in some information and then "submit" it and it will send the information to a specified email.

Here is my form.phtml:

            <div id="messages_product_view"><?php echo $this->getMessagesBlock()->toHtml() ?></div>
            <div class="page-title">
                <h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
            </div>
            <form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
                <div class="fieldset">
                    <h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
                    <ul class="form-list">
                        <li class="fields">
                            <div class="field">
                                <label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
                                <div class="input-box">
                                    <input name="name" id="name" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Name')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
                                </div>
                            </div>
                            <div class="field">
                                <label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
                                <div class="input-box">
                                    <input name="email" id="email" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Email')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
                                </div>
                            </div>
                        </li>
                        <li class="wide">
                            <label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Company Name') ?></label>
                            <div class="input-box">
                                <textarea name="comment" id="comment" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Comment')) ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="buttons-set">
                    <p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
                    <input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
                    <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Submit')) ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
                </div>
            </form>
            <script type="text/javascript">
            //<![CDATA[
                var contactForm = new VarienForm('contactForm', true);
            //]]>
            </script>

I have created a new CMS page in magento back end and included this:

{{block type="core/template" template="contacts/form.phtml"}}

It displayes the form correctly but where does it send the email to? How do I adjust it or change it without changing different forms? Bare in mind that I do have a standard "contact us" page with email specified and I do not want to change it but instead send this form to another email.

Best Answer

You have to create another custom form, like this Inchoo tuto, then you can include the form in your cms page according this tuto like this:

{{block type="core/template" name="form.custom" form_action="/simpleContact/index/sendemail" template="inchoo/simple_contact.phtml"}}
Related Topic