12/09/2010

How to add a new custom login block in left/right side in magento

If you want to add login page in a statick block and want to place that in left side or right side then use the following code to make your login block and place it anywhere it will work.

<?php $custmlogin= new Mage_Customer_Block_Form_Login();?>
<form action="<?php echo $custmlogin->getPostActionUrl() ?>" method="post" id="login-form">
<ul class="topLogin">
<li>
<label for="email" class="required"><?php echo $this->__('Email Address') ?><em>*</em></label>
<input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
</li>
<li>
<label for="pass" class="required"><?php echo $this->__('Password') ?><em>*</em></label>
<input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
</li>
<li class="logInButton">
<label>&nbsp;</label>
<button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><?php echo $this->__('Login') ?></span></button>
</li>
</ul>
</form>

3 comments:

  1. Anonymous1/12/2012

    Hi, can you tell me why the validation is not working on this form?

    ReplyDelete
    Replies
    1. write below java script to validate that block.
      <script type="text/javascript">
      //<![CDATA[
      var dataForm = new VarienForm('login-form', true);
      //]]>
      </script>
      where login-form is the ID of the form

      Delete
  2. Hello Friends,

    This code is really working. But I have one query. When I put this code at sidebar-left, it will run properly. But when I put this code in popup window this for is not working at all. Can u please give me any solution for this.

    Thanking you.

    ReplyDelete