Display slide login form on onclick of login link in header in Magento

First add following code in head.phtml at last.

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js”&gt;
</script>

<script type=”text/javascript”>

jQuery.noConflict();

var c = jQuery ;
c(document).ready(function(){

<?php
if (!$this->helper(‘customer’)->isLoggedIn() )
{ ?>
c(“li:last a”, “ul.links”).remove();
c(“li:last”, “ul.links”).addClass(“ma-login”);
c(‘ul.links li.last’).append(‘<a class=”login-show” href=”javascript:void(0);”>Log In</a>’);
c(‘.ma-login’).click(function(){
c(‘.ma-quicklogin’).slideToggle();
});
<?php } ?>

});

</script>

 

Now add following code in page/html/header.phtml just after  <?php echo $this->getChildHtml(‘topLinks’) ?>

<div class=”ma-quicklogin” style=”display: none;”>
<form method=”post” action=”<?php echo $base_url;?>customer/account/loginPost/”>
<div class=”ma-content-login”>
<div class=”ma-user”>
<div class=”ma-label”><label for=”mini-login”>Email:</label></div>
<input type=”text” class=”input-text” id=”mini-login” name=”login[username]”>
</div>
<div class=”ma-pass”>
<div class=”ma-label”><label for=”mini-password”>Password:</label></div>
<input type=”password” class=”input-text” id=”mini-password” name=”login[password]”>
</div>
<div class=”actions”>
<button class=”button” type=”submit”><span><span>Login</span></span></button>
<?php /* <button class=”button btn-cancel” type=”submit”><span><span>Cancel</span></span></button> */ ?>
</div>
<div class=”ma-register”><a title=”register” href=”<?php echo $base_url;?>customer/account/create/”>Register</a></div>
<div class=”ma-forgotpass”> <a title=”forgot your password” href=”<?php echo $base_url;?>customer/account/forgotpassword/”>Forgot Your Password?</a></div>
</div>
</form>
</div>

Now add following css code into ma-quicklogin.css  which is created in skin\frontend\default\default\css path.

.ma-quicklogin {
    -moz-border-bottom-colors: none;
    -moz-border-image: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    background-attachment: scroll;
    background-clip: border-box;
    background-color: #FFFFFF;
    background-image: none;
    background-origin: padding-box;
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto auto;
    border-bottom-color: #CDCDCD;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color-ltr-source: physical;
    border-left-color-rtl-source: physical;
    border-left-color-value: #CDCDCD;
    border-left-style-ltr-source: physical;
    border-left-style-rtl-source: physical;
    border-left-style-value: solid;
    border-left-width-ltr-source: physical;
    border-left-width-rtl-source: physical;
    border-left-width-value: 1px;
    border-right-color-ltr-source: physical;
    border-right-color-rtl-source: physical;
    border-right-color-value: #CDCDCD;
    border-right-style-ltr-source: physical;
    border-right-style-rtl-source: physical;
    border-right-style-value: solid;
    border-right-width-ltr-source: physical;
    border-right-width-rtl-source: physical;
    border-right-width-value: 1px;
    border-top-color: #CDCDCD;
    border-top-style: solid;
    border-top-width: 1px;
    display: none;
    line-height: 30px;
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    position: absolute;
    right: 20px;
    text-align: left;
    top: 75px;
    width: 155px;
    z-index: 999;
}

.header .header .links li.ma-login {
    background-attachment: scroll;
    background-clip: border-box;
    background-color: transparent;
    background-image: none;
    background-origin: padding-box;
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto auto;
}
.ma-quicklogin .ma-user, .ma-quicklogin .ma-pass, .ma-quicklogin .actions, .ma-quicklogin .ma-forgotpass, .ma-quicklogin .ma-register {
    clear: both;
    float: left;
}
.ma-quicklogin .actions {
    padding-bottom: 4px;
    padding-left: 0;
    padding-right: 0;
    padding-top: 10px;
}
.ma-quicklogin .actions .button {
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 15px;
    padding-top: 0;
}
.ma-quicklogin .actions .button {
    float: left;
}
.ma-quicklogin .ma-label {
    float: left;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 6px;
    padding-top: 0;
    width: 60px;
}
.ma-quicklogin .input-text {
    clear: both;
    float: left;
    width: 150px;
}
.ma-quicklogin .ma-forgotpass, .ma-quicklogin .ma-register {
    line-height: 25px;
}
ul.ma-account {
    -moz-border-bottom-colors: none;
    -moz-border-image: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    background-attachment: scroll;
    background-clip: border-box;
    background-color: #FFFFFF;
    background-image: none;
    background-origin: padding-box;
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto auto;
    border-bottom-color: #CDCDCD;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color-ltr-source: physical;
    border-left-color-rtl-source: physical;
    border-left-color-value: #CDCDCD;
    border-left-style-ltr-source: physical;
    border-left-style-rtl-source: physical;
    border-left-style-value: solid;
    border-left-width-ltr-source: physical;
    border-left-width-rtl-source: physical;
    border-left-width-value: 1px;
    border-right-color-ltr-source: physical;
    border-right-color-rtl-source: physical;
    border-right-color-value: #CDCDCD;
    border-right-style-ltr-source: physical;
    border-right-style-rtl-source: physical;
    border-right-style-value: solid;
    border-right-width-ltr-source: physical;
    border-right-width-rtl-source: physical;
    border-right-width-value: 1px;
    border-top-color: #CDCDCD;
    border-top-style: solid;
    border-top-width: 1px;
    padding-bottom: 15px;
    padding-left: 0;
    padding-right: 0;
    padding-top: 8px;
    position: absolute;
    text-align: left;
    visibility: hidden;
}
.header ul.ma-account li {
    background-attachment: scroll;
    background-clip: border-box;
    background-color: transparent;
    background-image: none;
    background-origin: padding-box;
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto auto;
    display: block;
    float: none;
    padding-bottom: 0;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 0;
}
.header ul.ma-account li a {
    -moz-text-blink: none;
    -moz-text-decoration-color: -moz-use-text-color;
    -moz-text-decoration-line: none;
    -moz-text-decoration-style: solid;
    background-attachment: scroll;
    background-clip: border-box;
    background-color: #FFFFFF;
    background-image: none;
    background-origin: padding-box;
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto auto;
    border-bottom-color: #CDCDCD;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    color: #000000;
    display: block;
    padding-bottom: 3px;
    padding-left: 0;
    padding-right: 0;
    padding-top: 3px;
    width: 150px;
}
.header ul.ma-account a:hover {
    color: #EA7900;
}
.header .links li.ma-login {
    background-attachment: scroll;
    background-clip: border-box;
    background-color: transparent;
    background-image: none;
    background-origin: padding-box;
    background-position: 0 0;
    background-repeat: repeat;
    background-size: auto auto;
}

Now add following code in page.xml just after <action method=”addCss”><stylesheet>css/styles.css</stylesheet></action>

<action method=”addCss”><stylesheet>css/ma-quicklogin.css</stylesheet></action>

 

Thats it…!!!

 

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: