Opencart Url重定向

Fra*_*ank 6 redirect opencart

我为Opencart制作了一个自定义注册模块,

我的注册页面有以下网址:

www.mysite.com/index.php?route=account/customregister

而默认注册页面网址是:

www.mysite.com/index.php?route=account/register

当用户点击任何指向默认注册模块的链接(route = account/register)时,我想将用户重定向到我的注册页面(route = account/customregister).我知道我可以编辑.htaccess文件来重定向或重写URL但我想通过php来做.有人知道是否有一些类/功能或某种代码我可以放在我的扩展程序上以自动将用户重定向到新的URL?

在此先感谢所有人

Ps我无法修改核心文件,我不会编辑.htaccess.

Jay*_*ord 12

这很容易通过vQmod实现.您需要使用vQmod编辑文件/catalog/controller/account/register.php并放入

$this->redirect($this->url->link('account/customregister', '', 'SSL'));
Run Code Online (Sandbox Code Playgroud)

只是在index()方法声明中(所以使用它作为搜索vQmod并使用after位置)


小智 5

您可以通过添加以下代码从主页重定向到任何产品:

目录/控制器/common/home.php

$this->response->redirect($this->url->link('product/product', 'product_id=50', ''));
Run Code Online (Sandbox Code Playgroud)

其中 50 是您的产品 ID。这是在 Opencart 2.0.1.1 上。我这样做是因为我只卖一种产品,希望这会有所帮助。