How to identify contact page from code and admin panel since it is undefined

Contact-us page in magento is not defined. How do I define contact page with us from code and admin panel. Since there is no page in cms as a contact page.

+3


source to share


1 answer


Add contact.xml file to layout folder

<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/2columns-right.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>
    </contacts_index_index>
</layout>

      

Create contact page in cms and this code



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

      

create a template file in the following path app\design\frontend\theme\default\template\contacts\form.phtml


Add Contact Form Design. For example

<div id="messages_product_view"><?php echo $this->getMessagesBlock()->toHtml() ?></div>

<section id="pr-contact" class="pr-main">
    <div class="container"><h1 class="ct-header"><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1></div>
    <div class="contact-map">


    </div> 
    <div class="container">
        <div class="col-md-3 col-sm-3 col-xs-12">
            <div class="address">
                <i class="fa fa-home"></i>
                <p>
                <span>Address</span><br/>

                </p>
            </div>
            <div class="phone">
                <i class="fa fa-phone"></i>
                <p>
                <span>Phone no:</span>                      
                </p>
            </div>

            <div class="fax">
                <i class="fa fa-fax"></i>
                <p>
                <span>Fax</span>                        
                </p>
            </div>

            <div class="website">
                <i class="fa fa-globe"></i>
                <p>
                <span>Website:</span>                       
                </p>
            </div>
        </div>

        <!--<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" class="scaffold-form">-->
        <form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" enctype="multipart/form-data">
        <div class="col-md-6 col-sm-6 col-xs-12">
        <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 name" type="text" placeholder="Enter your name *"/>  
            <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 email" type="email" autocapitalize="off" autocorrect="off" spellcheck="false" placeholder="Enter E-mail *"/> 
            <input name="telephone" id="telephone" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Telephone')) ?>" value="" class="input-text" type="tel" placeholder="Enter Telephone *" /> 


            <textarea name="comment" id="comment" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Comment')) ?>" class="required-entry input-text" cols="50" rows="10">Message *</textarea> 
            <!--<p>Ask us a question and we'll write back to you promptly! Simply fill out the form below and click Send Email.</p>
            <p>Thanks. Items marked with an asterisk (<span class="star">*</span>) are required fields.</p>-->

            <li>
                <label for="attachment"><?php echo Mage::helper('contacts')->__('Attachment') ?></label>
                    <div class="input-box">
                        <input name="MAX_FILE_SIZE" type="hidden" value="2000000" />
                        <input name="attachment" id="attachment" class="input-text" type="file" />
                    </div>
            </li>

            <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Submit')) ?>" class="button sendmail"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
        </div>

        <div class="col-md-3 col-sm-3 col-xs-12"> 

        </div>
        </form>
    </div>
</section> 

<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('contactForm', true);
//]]>
</script>

      

+2


source







All Articles