I am trying to display Login form in a pop-up window on a home page.
I am displaying pop-up using Fancybox2. That is working fine.

To display Login Form, I have used

<?php echo $this->getLayout()->createBlock('customer/form_login')->setTemplate('customer/form/mini.login.phtml')->toHtml();

this code.
Above code is displaying Login Form. But when I enter correct or wrong details, it redirects to my-domain/index.php/customer/account/login/ page. On that page also I have displayed Login as well as register forms . On this page also Login Form doesn't work. It redirects to the same page.

For registration form, I have used

echo $this->getLayout()->createBlock('customer/form_register')->setTemplate('customer/form/register.phtml')->toHtml();

this code and It is working fine.

Below is the code from template/persistent/customer/form/login.phtml :

<div id="login_checkout" class="checkout-login">
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <div id="tabs">
        <ul class="login_tabs">
            <li><a href="#" class="current"><?php echo $this->__('Log in') ?></a></li>
            <li><a href="#"><?php echo $this->__('Sign Up') ?></a></li>
        <div id="panes_login">
            <div id="tabs-1">
                <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
                    <?php echo $this->getBlockHtml('formkey'); ?>
                    <ul class="form-list">
                            <div class="input-box">
                                <input type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" placeholder="Email Address" />
                            <div class="input-box">
                                <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" placeholder="Password" />
                            <div class="input-box">
                                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
                        <?php echo $this->getChildHtml('form.additional.info'); ?>
                        <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                    <div class="forgat-pass">
                            <div class="stay_signin">
                                <input type="checkbox" id="stay_signin"><label for="stay_signin">Stay signed in</label>
                            <!--<a href="#forget_pass_popup" class="forget_pass_popup f-left">I forgot my password</a>-->
                            <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left forgot-password forget_pass_popup"><?php echo $this->__('Forgot Your Password?') ?></a>

                        <div class="social-login">
                              <div class="or"><span>Or</span></div>
                              <p>Sign in with</p>
                              <!--<a class="google-login" href="#">Google</a>
                              <a class="facebook-login" href="#">Facebook</a>-->
                              <?php echo $this->getLayout()->createBlock('inchoo_socialconnect/google_button')->setTemplate('inchoo/socialconnect/google/button.phtml')->toHtml(); ?>
                              <?php echo $this->getLayout()->createBlock('inchoo_socialconnect/facebook_button')->setTemplate('inchoo/socialconnect/facebook/button.phtml')->toHtml(); ?>
            <div id="tabs-2">
                <?php echo $this->getChildHtml('customer_form_register'); ?>
        <script type="text/javascript">
        var dataForm = new VarienForm('login-form', true);

2 Answers 2


Add below line in your mini.login.phtml file inside <form> tag

<?php echo $this->getBlockHtml('formkey'); ?>
  • <?php echo $this->getBlockHtml('formkey'); ?> This is already present in the login.phtml
    – vedu
    Jul 9, 2016 at 14:08

I will help you. One more things while adding form key.

   <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

check whether you are pasting in same login.phtml that are used in frontend. sometimes in xampp also have cache issue.

For That


/* to solve login issue */
  /*if (!$cookieParams['httponly']) {
  if (!$cookieParams['secure']) {
  if (!$cookieParams['domain']) {

if (isset($cookieParams['domain'])) {
  $cookieParams['domain'] = $cookie->getDomain();*/ //I have commented these lines


Open your Magento installation directory. Locate and open index.php file.

Search for error_reporting(E_ALL | E_STRICT); code.

Comment it out like that: /error_reporting(E_ALL | E_STRICT);/

And use the following code instead:

error_reporting(E_ALL); $_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;

Uncomment it by removing the # sign, so it looks like that:

ini_set('display_errors', 1);

Save this file and upload to the server. Reload your website page to see errors.


change localhost to paste your error if you can see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.