Expertwebadvisor

  • Magento 2
  • PHP
  • WordPress
  • MySQL
  • SEO
  • Java Script
  • Others
  • Top 10’s

Display Login form on Home Page In Magento

By Expertwebadvisor | Last Updated: February 14, 2014 | In: Magento


Suppose you want to display the Magento Login form on the Home page of your website. Confused! how to do it because bydefault Magento picks static page as the home page. Do not worry here in this post I am trying to describe how we can do it. It is very simple and you can do it by using the steps given below:
Display Login form on Home Page In Magento

Step 1. Just open customer.xml file in the editor of your choice, for this navigate to the /app/design/frontend/base/default/layout/customer.xml or if you are using the custom template then you will get it /app/design/frontend/default/your_custom_template/layout/customer.xml

Step 2. Search for the content below around (line 93):

<reference name="content">
    <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" />
</reference>

Step 3. Now just copy the below content

Step 4. Now open cms.xml file in the editor of your choice, for this navigate to the /app/design/frontend/base/default/layout/cms.xml or if you are using the custom template then you will get it /app/design/frontend/default/your_custom_template/layout/cms.xml

Step 5. Search for the content below:

<cms_page translate="label">
<label>CMS Pages (All)</label>
<reference name="content">
    <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
    <block type="page/html_wrapper" name="cms.wrapper" translate="label">
        <label>CMS Content Wrapper</label>
        <action method="setElementClass"><value>std</value></action>
        <block type="cms/page" name="cms_page"/>
    </block>
</reference>
</cms_page>

Step 6. Now just placed the into the in the cms.xml file just like as the code below:

<cms_page translate="label">
<label>CMS Pages (All)</label>
<reference name="content">
	<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" />
    <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
    <block type="page/html_wrapper" name="cms.wrapper" translate="label">
        <label>CMS Content Wrapper</label>
        <action method="setElementClass"><value>std</value></action>
        <block type="cms/page" name="cms_page"/>
    </block>
</reference>
</cms_page>

Step 7. You have done just refresh your Magento Cache and you browser cache and now there will be a login form on the home page, but there may be some problem with it, the login form will remains same on the home page although you have been login on the Magento frontend. To overcome on this problem just add the below code into the login.phtml file.

Now open login.phtml file in the editor of your choice, for this navigate to the /app/design/frontend/base/default/template/customer/form/ or if you are using the custom template then you will get it /app/design/frontend/default/your_custom_template/template/customer/form/ and add the code to check if you are not logged in then the login form will come on the home below:

Step 8. Add the code on the top of the login.phtml file

<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
	....
	....
<?php endif; ?>

Now you are all set and your login form on the home page is ready to use. Hope it helps and Thanks for reading, enjoy the Magentoing.

Tags:Login form on Home Page In Magento,Login Page In Magento,Magento


Related Posts

  • Create and Assign Product Attributes Through Admin Panel In Magento Create and Assign Product Attributes Through Admin Panel In Magento
  • Add Custom “Sort By” Drop Down menu options In Magento Add Custom “Sort By” Drop Down menu options In Magento
  • Add Custom Fields In Contact Us Form In Magento Add Custom Fields In Contact Us Form In Magento
  • Display related products anywhere in Magento Display related products anywhere in Magento
  • Be Social, Share Us Here !!

  • Looking For Something !!

  • Popular Categories !!

    • Magento 2 Guide and Tutorials
    • Home Loan EMI Calculator
    • Car Loan EMI Calculator
    • Personal Loan EMI Calculator
    • Magento Guide & Tutorials
    • PHP Tutorials
    • WordPress Tutorials
    • SEO Tutorials
    • MySQL Guide
    • Opencart Tutorials
    • Linux/Ubuntu Guide
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Facebook
  • Twitter
  • DMCA.com Protection Status

Recent Posts

  • PHP array_​diff_​key Function
  • PHP array_​diff_​assoc Function
  • PHP array_​diff Function
  • PHP array_​count_​values Function
  • PHP array_​combine Function

Welcome to my Blog

Thanks for visiting my Blog, I have started this blog before 8 years ago and sharing my own experience, problem and solutions while working on the different type of projects. Enjoy the reading and don't forget to Facebook likes, Tweets or G+. You can also write me expertwebadvisor@gmail.com
© 2013 - 2025 Powered By
Top