branko ajzele, senior developer / project manager

Posts / Articles

How to add login form on home page in Magento

I found a interesting question on Magento forums. Some of the clients would like to see the login box on home page. Here is a quick howto.

Open customer.xml from layout folder, and locate (around line 91)

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

Now open cms.xml and locate (around line 46)

<reference name=”content”>
<block type=”cms/page” name=”cms_page”/>
</reference>

Now copy the
<block type=”customer/form_login” name=”customer_form_login” template=”customer/form/login.phtml”/>

from customer.xml to cms.xml making it like

<reference name=”content”>
<block type=”customer/form_login” name=”customer_form_login” template=”customer/form/login.phtml”/>
<block type=”cms/page” name=”cms_page”/>
</reference>

That’s it. Play with the rest.

  • Joan

    I use “mini.login.phtml” to get a reduced version of login on the home page.

    great blog!

  • Joan

    I use “mini.login.phtml” to get a reduced version of login on the home page.

    great blog!

  • Shiju

    Hi Branko,

    thanks for your support…

    I used your code for adding a login box in the home page.

    but it is showing to come other pages also….how can I eliminate from other page….I want that box in the home page only

    thanks in advance
    SHIJU

  • Shiju

    Hi Branko,

    thanks for your support…

    I used your code for adding a login box in the home page.

    but it is showing to come other pages also….how can I eliminate from other page….I want that box in the home page only

    thanks in advance
    SHIJU

  • Saggy

    Hi Shiju,

    You can put it in Admin ->CMS->Manage Pages->home->Layout Update XML

    This way it will come only for home page. Hope this makes sense.

    Cheers
    Saggy

  • Saggy

    Hi Shiju,

    You can put it in Admin ->CMS->Manage Pages->home->Layout Update XML

    This way it will come only for home page. Hope this makes sense.

    Cheers
    Saggy

  • Slava

    Hi, Saggy
    What if I only want to give login page if customer did not login yet? And if he is logged in, then normal home page appear…
    Salut,
    Slava

  • Slava

    Hi, Saggy
    What if I only want to give login page if customer did not login yet? And if he is logged in, then normal home page appear…
    Salut,
    Slava

  • ruxx

    I don't have customer.xml in my layout folder. In my layout folder, I only have: catalog.xml, cms.xml, directory.xml, newsletter.xml, page.xml, report.xml, and tag.xml – Is there another way of doing it. I'm using template # 24546 – thank you.

  • ruxx

    I don't have customer.xml in my layout folder. In my layout folder, I only have: catalog.xml, cms.xml, directory.xml, newsletter.xml, page.xml, report.xml, and tag.xml – Is there another way of doing it. I'm using template # 24546 – thank you.

  • sanjayjangid

    where this code is paste

  • sanjayjangid

    where login page codding is paste

blog comments powered by Disqus