In this article we will discuss how to merge login and registration form on one single page. Customer have not used to click on link for form switch or reloading.Login and registration on one single page is better process for customer either to create a new account or to login if has an account. Let us start tutorial we need to follow given below step:
There are mainly two steps which we are going to discuss:
Step 1 : Layout Change
Path : app/design/frontend/package/theme/layout
Filename : customer.xml file
• Find for <block type=”customer/form_login” using CTRL+F
• Add the register block within the login block.
<!--Layout for customer login page--> <customer_account_login translate="label"> <label>Customer Account Login Form</label> <!-- Mage_Customer --> <remove name="right"/> <remove name="left"/> <reference name="root"> <action method="setTemplate"><template>page/1column.phtml</template></action> </reference> <reference name="content"> <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" /> <!--put register block code below login block--> <!-- register block--> <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"> <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label"> <label>Form Fields Before</label> </block> </block> <!--register block ends--> </reference> </customer_account_login>
Step 2 : Template Change.
I) Open the customer/form/register.phtml and remove given below snippet otherwise same message display in each block.
Path : persistent/customer/form
Filename : register.phtml
<?php echo $this->getMessagesBlock()->toHtml() ?>
Note: Just remove container row from login and registration page to get both form in same row
II) Remove back button no need after merge. See below. Remove this snippet
<p class="back-link"><a href="<?php //echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>« </small><?php //echo $this->__('Back') ?></a></p>
Now flush the cache and open account login page(http://www.website.com/customer/account/login/) and we get one single page with login and registration form.That’s it.
If you feel useful 🙂 article please share 🙂 with your friends and colleague.