Opencart登录到以前查看过的页面登录吗? [英] Opencart Login to Previous Viewed Page After Logging in?
问题描述
Opencart登录后是否登录到以前查看的页面?
Opencart Login to Previous Viewed Page After Logging in?
有人知道可以这样做吗?使用1.5.4版
Anyone know a way this can be done? Working on Version 1.5.4
希望有人可以提供建议/帮助!
Hope someone can advise/help!
谢谢!
推荐答案
感谢shadyyx的回答.我的代表权不足,无法投票,所以我在这里张贴我的vQmod代码以表示感谢.
Thanks to shadyyx's answer above. I had too little rep power to up-vote it, so instead I'm posting my vQmod code here as a thank you.
请注意,下面的代码替换了$this->redirect($this->url->link('account/account', '', 'SSL'))
的所有3个实例,因为仅替换第一个实例对我不起作用(尚未进行详尽的测试).
Note that the code below replaces all 3 instances of $this->redirect($this->url->link('account/account', '', 'SSL'))
since replacing only the first instance did not work for me (it has not been exhaustively tested).
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>Login Redirects (to where user was prior to login)</id>
<version>1</version>
<vqmver>2.4.1</vqmver>
<author>Salad_Dressing (with help from shadyyx)</author>
<file name="catalog/controller/account/login.php">
<operation>
<search position="after"><![CDATA[
public function index() {
]]></search>
<add><![CDATA[
if(!isset($this->session->data['login_redirect']) && (strpos($_SERVER['HTTP_REFERER'], HTTP_SERVER) !== false || strpos($_SERVER['HTTP_REFERER'], HTTPS_SERVER) !== false)) {
$this->session->data['login_redirect'] = $_SERVER['HTTP_REFERER'];
}
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$this->redirect($this->url->link('account/account', '', 'SSL'));
]]></search>
<add><![CDATA[
if(!empty($this->session->data['login_redirect'])) {
$url = $this->session->data['login_redirect'];
unset($this->session->data['login_redirect']);
$this->redirect($url);
} else {
$this->redirect($this->url->link('account/account', '', 'SSL'));
}
]]></add>
</operation>
</file>
</modification>
这篇关于Opencart登录到以前查看过的页面登录吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!