Post by Sidecutter » Mon Jul 25, 2011 3:49 am

I'm using Q's login sidebox, and I've noticed it always dumps the user to the Account page (where they can view orders, edit their account etc) after they login. I don't believe it used to do this - I'm pretty sure up until 1.4.9.5 it stayed on the same page - whether you were viewing the homepage, a category, and item page, whatever.

I believe this is the code for where it goes to after login, on Line 15:

Code: Select all

		$this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/login');
What can I use here instead/add anywhere else in the file to make it stay on the same page?

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by uksitebuilder » Mon Jul 25, 2011 4:47 am

It is the default behaviour of OC to send user to the account page after successful login

The code you put above is just the form action, i.e. where the form submits the login details to, to check they are correct and to log the person in.

What you need to look at if you want to change it is catalog/controller/account/login.php

around line 40:

$this->redirect(HTTPS_SERVER . 'index.php?route=account/account');

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Qphoria » Mon Jul 25, 2011 8:28 am

1. EDIT: catalog/controller/module/login.php

2. FIND:

Code: Select all

$this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/login'); 
3. REPLACE WITH:

Code: Select all

if (!empty($this->request->get['route'])) {
    $this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=' . $this->request->get['route']);
} else {
    $this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/login');
} 

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Sidecutter » Mon Jul 25, 2011 9:01 am

Thanks Q. I did that, but it doesn't work. Now if you use the login sidebox, it reloads, but you're not logged in. Tab up top still says "Log In", the Login Sidebox is still there, and if you click on the Account tab, it takes you to the login page.

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by Qphoria » Mon Jul 25, 2011 9:14 am

lol sorry.. that was the wrong code. Try

Code: Select all

if (!empty($_SERVER['HTTP_REFERER'])) {
    $this->data['action'] = $_SERVER['HTTP_REFERER'];
} else {
    $this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/login');
} 

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Sidecutter » Mon Jul 25, 2011 9:25 am

Nope :( Same issue, appears to submit the info/reloads the page, but nothing changes and it's not logged in.

Full original file contents just for quick reference in case anything that affects it is maybe slipping past:

Code: Select all

<?php  
class ControllerModuleLogin extends Controller {
	protected function index() {
		$this->language->load('module/login');

      	$this->data['heading_title'] = $this->language->get('heading_title');
		
		$this->data['entry_email_address'] = $this->language->get('entry_email_address');
		$this->data['entry_password'] = $this->language->get('entry_password');
		
		$this->data['button_login'] = $this->language->get('button_login');
		$this->data['button_logout'] = $this->language->get('button_logout');
		$this->data['button_create'] = $this->language->get('button_create');
		
		$this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/login');
 		
		$this->id       = 'login';
		//$this->template = $this->config->get('config_template') . 'module/login.tpl';
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/login.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/login.tpl';
        } elseif (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . 'module/login.tpl')) { //v1.3.2
				$this->template = $this->config->get('config_template') . 'module/login.tpl';
		} else {
            $this->template = 'default/template/module/login.tpl';
        }
		
		$this->render();
		
	}
}
?>

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by Sidecutter » Tue Jul 26, 2011 6:38 am

Admittedly I'm not a coder but I've been playing with the second version of the code you gave off and on since last night Q, and the closest I get to a working sample is code that when you log in, immediately goes to the page saying your account has been logged off. This makes me wonder if this is what's happening when it seems like nothing is happening as noted above using your code? Could it be logging in, logging the user right back out, and returning to the referring page?

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by Sidecutter » Wed Jul 27, 2011 7:55 am

Any further ideas?

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by Sidecutter » Sun Jul 31, 2011 9:14 pm

Ello?

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by Sidecutter » Thu Aug 04, 2011 6:04 am

Sigh.

Sometimes, it feels like this community is very helpful. And sometimes, it feels quite the opposite, and openly apathetic or hostile. What the hell. ???

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am
Who is online

Users browsing this forum: No registered users and 8 guests