1

I've 1.9.1.0 version of magento.

So far after researching I've deleted the lines under

app/code/core/Mage/Checkout/controllers/OnepageController.php

These lines

$action = $this->getRequest()->getActionName();
        if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)
            && !in_array($action, array('index', 'progress'))
        ) {
            $this->_ajaxRedirectResponse();
            return true;
        }

I'm still noticing that when I enter credentials under one page checkout, it still redirects to cart page. It must redirects to the checkout page itself.

Here is the HTML

<form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
        <?php $checkout_link = Mage::helper('checkout/url')->getCheckoutUrl(); ?>
        <input type="hidden" value="<?php echo $checkout_link; ?>" name="login_redirect" />
        <input type="hidden" name="wronrg_redirect" value="<?php echo $this->helper('core/url')->getCurrentUrl(); ?>"  />
        <fieldset>
            <h4><?php echo $this->__('Already registered?') ?></h4>
            <p><?php echo $this->__('Please log in below:') ?></p>
            <ul class="form-list">
                <li>
                    <?php $title = Mage::getStoreConfig('sms_section/sms_group/title'); ?>  
                          <?php /*?>  <label for="mobilenumber" class="required"><em>*</em><?php echo $this->__('%s',$title) ?></label><?php */?>
                    <div class="input-box">
                                <input type="text" name="login[mobilenumber]" value="<?php echo $this->htmlEscape($this->getMobilenumber()) ?>" id="mobilenumber" class="input-text required-entry" title="<?php echo $this->__('%s',$title) ?>" placeholder="Mobile/Email" />
                            </div>
                </li>
                <li>
                   <?php /*?> <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label><?php */?>
                    <div class="input-box">
                        <input type="password" class="input-text required-entry" id="login-password" name="login[password]" placeholder="Password" />
                    </div>
                </li>
            </ul>
        </fieldset>
        </form>
        <button type="submit" class="button btn pull-right" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
4
  • What is the value of $checkout_link?
    – user4351
    Commented Apr 16, 2015 at 16:49
  • <?php $checkout_link = Mage::helper('checkout/url')->getCheckoutUrl(); ?> Commented Apr 16, 2015 at 17:04
  • Yeah, I see the code, but what does it output in the html for the browser? Cause that's not the cart URL it should output there.
    – user4351
    Commented Apr 16, 2015 at 17:22
  • The output is /checkout/onepage/ Commented Apr 16, 2015 at 17:31

2 Answers 2

1

I have faced the similar issue once on Magento 1.5 and fixed it by increasing the cookie life time to 86400 under

Sytem -> Configuration -> Web -> Session and Cookie Management


The Reason that I found out after doing some research on internet and different forum is that in Magento, by default cookie lifetime is set to 3600 (1 hour). But if the end users computer time runs ahead of server’s time, cookies will not get set for Magento frontend as well as backend. For example, end user’s computer time is 1 hour forward than server’s time, that means the cookie (holding user’s session id) will expire as soon as user logs in or tries to add an item.

Also try debugging the code and check what is the error.

$quote = $this->getOnepage()->getQuote();
        if (!$quote->hasItems() || $quote->getHasError()) {
            // DEBUG HERE for error
            $this->_redirect('checkout/cart');
            return;
        }
0

I simply changed the below code under OnepageController.php

 $quote = $this->getOnepage()->getQuote();
        if (!$quote->hasItems() || $quote->getHasError()) {
            $this->_redirect('checkout/cart');
            return;
        }

to

$quote = $this->getOnepage()->getQuote();
            if (!$quote->hasItems() || $quote->getHasError()) {
                $this->_redirect('checkout/onepage');
                return;
            }

and it finally worked!!

4
  • 1
    This is not the right fix. You have errors in your cart.
    – user4351
    Commented Apr 16, 2015 at 22:09
  • How to check what kind of errors my cart has? Commented Apr 17, 2015 at 6:03
  • 1
    It should normally display as an error message. If your cart has no errors before logging in, then you probably have an old abandoned cart tied to your account with products that are out of stock or disabled.
    – user4351
    Commented Apr 17, 2015 at 6:41
  • This change will give you more problem, than solve your issue. You have simply told the code flow to ignore essential traps that makes entering checkout invalid. Determine why it is invalid (!$quote->hasItems() || $quote->getHasError()) and resolve the cause of the issue.
    – ProxiBlue
    Commented Jan 21, 2016 at 3:51

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.