0

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>
        </ul>
        <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">
                        <li>
                            <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>
                        </li>
                        <li>
                            <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>
                        </li>
                        <li>
                            <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>
                            </div>
                        </li>
                        <?php echo $this->getChildHtml('form.additional.info'); ?>
                        <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                    </ul>
                    <div class="forgat-pass">
                            <div class="stay_signin">
                                <input type="checkbox" id="stay_signin"><label for="stay_signin">Stay signed in</label>
                            </div>
                            <!--<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>
                </form>

                        <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>
            </div>
            <div id="tabs-2">
                <?php echo $this->getChildHtml('customer_form_register'); ?>
            </div>
        </div>
        <script type="text/javascript">
    //<![CDATA[
        var dataForm = new VarienForm('login-form', true);
    //]]>
    </script>
    </div>
</div>
0

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 '16 at 14:08
0

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

app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

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

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

or

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.

==========alternative==================

change localhost to 127.0.0.1 paste your error if you can see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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