Page 1 of 1
Q's Login Sidebox - How to Stay on Same Page?
Posted: Mon Jul 25, 2011 3:49 am
by Sidecutter
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?
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Mon Jul 25, 2011 4:47 am
by uksitebuilder
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');
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Mon Jul 25, 2011 8:28 am
by Qphoria
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');
}
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Mon Jul 25, 2011 9:01 am
by Sidecutter
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.
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Mon Jul 25, 2011 9:14 am
by Qphoria
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');
}
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Mon Jul 25, 2011 9:25 am
by Sidecutter
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();
}
}
?>
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Tue Jul 26, 2011 6:38 am
by Sidecutter
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?
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Wed Jul 27, 2011 7:55 am
by Sidecutter
Any further ideas?
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Sun Jul 31, 2011 9:14 pm
by Sidecutter
Ello?
Re: Q's Login Sidebox - How to Stay on Same Page?
Posted: Thu Aug 04, 2011 6:04 am
by Sidecutter
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.
