Thursday, 11 February 2016

Add a mini login form to header – Magento

In default, Magento have a mini login form and we can use it any where in our page blocks.

Now I’m going to add this mini login form in our page header with in few simple steps.

First we want to add login form block to header for sign out customers. We can use our theme’s local.xml file for this purpose.

Just add below code snippet to our theme’s local.xml file.

<layout>

<customer_logged_out>
 <reference name="header">
 <block type="customer/form_login" name="header_customer_form_mini_login" template="customer/form/mini.login.phtml"/>
 </reference>
</customer_logged_out>

</layout>

Then call this login form in header section of our template file.

<?php echo $this->getChildHtml('header_customer_form_mini_login') ?>

No comments:

Post a Comment