Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opencart Url redirect

I made a custom registration module for Opencart,

my registration page has the following url:

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

while the default registration page url is:

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

I want to redirect users to my registration page (route=account/customregister) when users click on any link that points to the default registration module(route=account/register). I know I can edit the .htaccess file to make a redirect or a url rewriting but I want to do that by php. Do someone knows if there is some class/function or some kind of code I can put on my extension to automatically redirect users to the new url?

Thanks all in advance

P.s. I cannot modify the core files and I would not edit the .htaccess.

like image 709
Frank Avatar asked Jan 08 '13 11:01

Frank


3 Answers

This can be achieved with a vQmod pretty easily. You need to use a vQmod to edit the file /catalog/controller/account/register.php and put

$this->redirect($this->url->link('account/customregister', '', 'SSL'));

just inside the index() method declaration (so use this as the search for the vQmod and use the after position)

like image 51
Jay Gilford Avatar answered Oct 23 '22 01:10

Jay Gilford


You can redirect from homepage to any product by adding this code in:

catalog/controller/common/home.php

$this->response->redirect($this->url->link('product/product', 'product_id=50', ''));

Where 50 is your product id. This is on Opencart 2.0.1.1. I did this because I only sell one product, hope this helps.

like image 26
Josue Avatar answered Oct 23 '22 00:10

Josue


for redirection this may also work in opencart

$this->redirect($this->url->link('account/customregister', '', 'SSL')); 
like image 1
krishna Avatar answered Oct 23 '22 01:10

krishna