0

I'm not sure what I did here, but I've killed my Login button when I reworked the login.phtml file. Here is the original code, which works, followed by the reworked code, which everything works on except the Login button. Any help would be appreciated. I have been messing around with this for hours now.

Original code:

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category    design
* @package     base_default
* @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License
(AFL 3.0)
*/
?>
<?php
/**
* Customer login form template
*
* @see app/design/frontend/base/default/template/customer/form/login.phtml
*/
?>

<?php
    // Check if current Magento version includes Persistent Shopping Cart Extension
     $isPersistantShoppingCartEnabled = Mage::getStoreConfigFlag      
('persistent/options/enabled');
    $isContextCheckout = 0;
if ($isPersistantShoppingCartEnabled) {
    $accountUrl = Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl());
    $isContextCheckout = Mage::helper('checkout')->isContextCheckout();
} else {
    $accountUrl = $this->getCreateAccountUrl();
}
?>

<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 echo $this->getChildHtml('paypalauth.login'); ?>
<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->htmlEscape($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('persistent.remember.me'); ?>
                </ul>
                <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
                <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 $accountUrl ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
            </div>
        </div>
        <div class="col-2 registered-users">
            <div class="buttons-set">
                <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
            </div>
        </div>
    </div>
    <?php if ($isContextCheckout): ?>
        <input name="context" type="hidden" value="checkout" />
    <?php endif; ?>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('login-form', true);
//]]>
</script>

REWORKED CODE:

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License   
(AFL 3.0)
 */
?>
<?php
/**
 * Customer login form template
 *
 * @see app/design/frontend/base/default/template/customer/form/login.phtml
 */
?>

    <?php
    // Check if current Magento version includes Persistent Shopping Cart Extension
    $isPersistantShoppingCartEnabled = Mage::getStoreConfigFlag   
('persistent/options/enabled');
    $isContextCheckout = 0;
    if ($isPersistantShoppingCartEnabled) {
        $accountUrl = Mage::helper('persistent')->getCreateAccountUrl   
($this->getCreateAccountUrl());
        $isContextCheckout = Mage::helper('checkout')->isContextCheckout();
    } else {
        $accountUrl = $this->getCreateAccountUrl();
    }
?>

<div class="account-login">
<div class="page-title">
    <h1><?php echo $this->__('Login or Create an Account') ?></h1>
</div>
    <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>
                            <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo $accountUrl ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
 <br><br>
 <h2><?php echo $this->__('Log In Using Your PayPal account') ?></h2>
<p><?php echo $this->__('Log in quickly, easily and safely with Log in with PayPal ') ?></p>
<ul style="list-style: disc outside none;padding-left: 18px;">
    <li><?php echo $this->__('Avoid the hassle of filling in yet another registration form') ?></li>
    <li><?php echo $this->__('Just one password to remember') ?></li>
    </ul><br>
<a id="login-with-paypal" href="<?php echo Mage::helper('opc/paypal')->getLoginUrl();?>" title="Login with PayPal"></a>

 </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->htmlEscape($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> <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>

                    </li>
                    <?php echo $this->getChildHtml('persistent.remember.me'); ?></ul>

                <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
           <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>

                <p class="required"><?php echo $this->__('* Required Fields') ?></p>
            </div>
        </div>   
           </div>  
    <?php if ($isContextCheckout): ?>
        <input name="context" type="hidden" value="checkout" />
    <?php endif; ?>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('login-form', true);
//]]>
</script>

2
  • What do you mean by "it's not working"? If you have a version that works, put your code side by side with the version that works and see the differences. – Marius Mar 5 '15 at 7:43
  • I mean the button doesn't do anything when you click on it. You don't think I went through both of them side by side already? It was almost 1am and I had been messing with it for several hours, as stated in my post, and couldn't see what I did wrong. Thus I asked for help. – Classic Mar 5 '15 at 15:47
1

You miss the open form tag and varienform is watching a missing id=login-form

2
  • Thanks for the help. I'll go back and look at it again now. I tried to give your answer a +1 but I don't have enough reputation. I really appreciate you taking the time to help. – Classic Mar 5 '15 at 15:50
  • Thanks again so much. I am pretty new to magento and I was overtired when I was working on this last night. When I pulled the call for the Paypal Childhtml and replaced it with the actual code, I accidently erased that whole section not catching that it was not all for the Paypal part. No matter how many times I looked at it side by side - I must have just been glazing over that still assuming it was all Paypal reference. Anyway - that did it. Thanks again so much!! – Classic Mar 5 '15 at 16:07

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.