Skip to main content
added 14 characters in body
Source Link
Magento Nav
  • 377
  • 9
  • 23
 <Easylife_Contacts>
           <?xml <active>true</active>version="1.0"?>
<config>
    <modules>
        <codePool>local</codePool><Easylife_Contacts>
            <depends><active>true</active>
                <Mage_Contacts<codePool>local</>codePool>
            </depends>Easylife_Contacts>
        </Easylife_Contacts>modules>
</config>
 <Easylife_Contacts>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Contacts/>
            </depends>
        </Easylife_Contacts>
     <?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Contacts>
            <active>true</active>
            <codePool>local</codePool>
        </Easylife_Contacts>
    </modules>
</config>
Tweeted twitter.com/#!/StackMagento/status/436133114797367297
Source Link
Magento Nav
  • 377
  • 9
  • 23

Contact Us form is not displaying

I am new to magento. I have override the Contact form, but in home page not displaying the Contacts link.

my code is:

etc\module\Easylife_Contacts.xml

 <Easylife_Contacts>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Contacts/>
            </depends>
        </Easylife_Contacts>

magento\app\code\local\Easylife\Contacts\controllers\IndexController.php

<?php
include_once('Mage/Contacts/controllers/IndexController.php');

class Easylife_Contacts_IndexController extends Mage_Contacts_IndexController
{

    const XML_PATH_EMAIL_RECIPIENT  = 'contacts/email/recipient_email';
    const XML_PATH_EMAIL_SENDER     = 'contacts/email/sender_email_identity';
    const XML_PATH_EMAIL_TEMPLATE   = 'contacts/email/email_template';
    const XML_PATH_ENABLED          = 'contacts/contacts/enabled';

    public function preDispatch()
    {
        parent::preDispatch();

        if( !Mage::getStoreConfigFlag(self::XML_PATH_ENABLED) ) {
            $this->norouteAction();
        }
    }

    public function indexAction()
    {
        $this->loadLayout();
        $this->getLayout()->getBlock('contactForm')
            ->setFormAction( Mage::getUrl('*/*/post') );

        $this->_initLayoutMessages('customer/session');
        $this->_initLayoutMessages('catalog/session');
        $this->renderLayout();
    }

    public function postAction()
    {
        ....
    }

}

magento\app\code\local\Easylife\Contacts\etc\config.xml

<?xml version="1.0" encoding="utf-8"?>

<config>
    <modules>
        <Easylife_Contacts>
            <version>0.1.0</version>
        </Easylife_Contacts>
    </modules>
    <frontend>
        <routers>
            <contacts>
                <args>
                    <modules>
                        <Easylife_Contacts before="Mage_Contacts">Easylife_Contacts</Easylife_Contacts>
                    </modules>
                </args>
            </contacts>
        </routers>
    </frontend>
     <layout>
        <updates>
            <contacts>
                <file>contacts.xml</file>
            </contacts>
        </updates>
    </layout>
</config>

magento\app\design\frontend\easylife\default\layout\contacts.xml

<?xml version="1.0"?>

<layout version="0.1.0">

    <contacts_index_index translate="label">

        <reference name="content">
            <block type="core/template" name="contactForms" template="contacts/form.phtml"/>
        </reference>

        <update handle="contactForm"></update>
    </contacts_index_index>
</layout>

magento\app\design\frontend\easylife\default\template\contacts\form.phtml

<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></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">
  ....
</form>
<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('contactForm', true);
//]]>
</script>

Can anyone tell me where I went wrong?

thanks.