2

Customer will visit the site. once customer click on Login button

it will redirect to the login page .

once customer see the login page, email and password should be there on text field

demo example :

http://magento.webkul.com/Marketplace/index.php/customer/account/login/

customer should only click on login button and it should login to the site.

Login.phtml

<?php
/**
 * Customer login form template
 *
 * @see Mage_Customer_Block_Form_Login
 */
?>
<div class="account-login">
    <div class="page-title">
        <h1><?php echo $this->__('Login or Create an Account') ?></h1>
    </div>
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php /* Extensions placeholder */ ?>
    <?php echo $this->getChildHtml('customer.form.login.extra')?>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
        <?php echo $this->getBlockHtml('formkey'); ?>
        <div class="col2-set">
            <div class="col-1 new-users">
                <div class="content">
                    <h2><?php echo $this->__('New Customers') ?></h2>
                    <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
                </div>
            </div>
            <div class="col-2 registered-users">
                <div class="content">
                    <h2><?php echo $this->__('Registered Customers') ?></h2>
                    <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
                    <ul class="form-list">
                        <li>
                            <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                            <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') ?>" />
                            </div>
                        </li>
                        <li>
                            <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                            <div class="input-box">
                                <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                            </div>
                        </li>
                        <?php echo $this->getChildHtml('form.additional.info'); ?>
                    </ul>
                    <p class="required"><?php echo $this->__('* Required Fields') ?></p>
                </div>
            </div>
        </div>
        <div class="col2-set">
            <div class="col-1 new-users">
                <div class="buttons-set">
                    <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo $this->getCreateAccountUrl() ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
                </div>
            </div>
            <div class="col-2 registered-users">
                <div class="buttons-set">
                    <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
                    <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>

                </div>
            </div>
        </div>
    </form>
    <script type="text/javascript">
    //<![CDATA[
        var dataForm = new VarienForm('login-form', true);
    //]]>
    </script>
</div>
  • You need change template file login of frontend and backend in Magento – Thao Pham Dec 1 '15 at 11:05
  • @PaW you are right. but can you please inform regarding code? what code needs to be modify ? – user33510 Dec 1 '15 at 11:07
  • In admin login page, you need change it in app/design/adminhtml/default/default/template/login.phtml, and with frontend, it require your theme – Thao Pham Dec 1 '15 at 11:14
  • @PaW i need only in frontend. i am trying app/design/frontend/default/theme_name/template/customer/form/login.phtml for frontend. please guide me what code changes i have to do. – user33510 Dec 1 '15 at 11:16
  • if you want change template file you can change it in /app/design/frontend/<name_theme>/default/template/persistent/customer/form/login.phtml, if in theme not exist this file, you can find it in base – Thao Pham Dec 1 '15 at 11:48
0

add a account with demo email and login with this script.

$customer = Mage::getModel('customer/customer');
     $email='demo@ymail.com';                       $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
                            $customer->loadByEmail($email);
                            Mage::getSingleton('customer/session')->loginById($customer->getId());
| improve this answer | |
  • i added above code in : :app/design/frontend/default/theme_name/template/customer/form/login.phtml" but still its asking to enter email & pw. – user33510 Dec 1 '15 at 11:15
  • i changed the valid email id in your answer.... – user33510 Dec 1 '15 at 11:20
  • and the code execution reload the page. it will redirect to you account page – Qaisar Satti Dec 1 '15 at 11:23
  • i added the code in login.phtml. is i have to add in another file ? – user33510 Dec 1 '15 at 11:29
  • don't add code in login.phtml create controller action and add code there.. – Qaisar Satti Dec 1 '15 at 11:34