Page 1 of 1

Redirecting Categories to other OpenCart Pages

Posted: Sat Aug 19, 2017 5:39 pm
by screwtape_mk
Hi

I have created Gift Voucher as a category and have made it appear here:
http://liomi.co.za/index.php?route=common/home

Now i want to specify the redirect route of that Gift Voucher Tab to:

http://liomi.co.za/index.php?route=account/voucher

Instead of where it currently is:

http://liomi.co.za/index.php?route=prod ... ry&path=73

Re: Redirecting Categories to other OpenCart Pages

Posted: Mon Aug 21, 2017 7:03 pm
by sachin6609
Hii

You can do it by little custome

But Why you add that opencart page in the category..??

i can do that by costume code easily

Thanks

Sachin

Re: Redirecting Categories to other OpenCart Pages

Posted: Fri Dec 01, 2017 4:01 am
by screwtape_mk
Hi

Sorry for the late response- but i still need your help with this; what would would you need from me in order to produce

Re: Redirecting Categories to other OpenCart Pages

Posted: Mon Dec 04, 2017 1:28 pm
by sachin6609
screwtape_mk wrote:
Fri Dec 01, 2017 4:01 am
Hi

Sorry for the late response- but i still need your help with this; what would would you need from me in order to produce
Hii

sure I will Help You

Let Me know Which Opencart version you are using..?

So i can help you to edit the files

Thanks

Sachin

Re: Redirecting Categories to other OpenCart Pages

Posted: Mon Dec 04, 2017 6:46 pm
by opencartboost
That is easy.
Open file category.php in folder catalog/controller/product/category.php
Find :

Code: Select all

$category_info = $this->model_catalog_category->getCategory($category_id);
Before, add:

Code: Select all

if ($category_id == '73') {
	$this->response->redirect($this->url->link('account/voucher'));
}
73 is your category_id, may be need change that.

Re: Redirecting Categories to other OpenCart Pages

Posted: Tue Jan 16, 2018 9:43 pm
by screwtape_mk
Thanks so much opencartboost

I will try out your solution - do you mind explaning what Category Id is so i can put the correct Id; since you said i may have to change that

Re: Redirecting Categories to other OpenCart Pages

Posted: Tue Jan 16, 2018 11:28 pm
by Johnathan
Just to note, if you want to do this without having to edit files manually yourself, my Redirect Manager extension can do this. You enter the URL your want to redirect, and then can redirect it wherever you want. It should work for your purpose, if you can't (or don't want to) get the manual edit working.

Re: Redirecting Categories to other OpenCart Pages

Posted: Wed Jan 17, 2018 2:31 am
by screwtape_mk
Hi

I have added this line of code:

if ($category_id =='73')
{
$this->response->redirect($this->url->link('account/voucher'));
}



Before this line:
$category_info = $this->model_catalog_category->getCategory($category_id);

Nothing changed. Im using version 2.0.1.1

Re: Redirecting Categories to other OpenCart Pages

Posted: Wed Jan 17, 2018 11:26 pm
by Johnathan
If you have any ocMods installed, don't forget to refresh your ocMod cache in Extensions > Modifications after making an edit. If any ocMod edits the same file you did, your edit won't be active until you refresh the cache.

Re: Redirecting Categories to other OpenCart Pages

Posted: Fri Jan 19, 2018 9:03 pm
by screwtape_mk
It worked - except every Category or Category item redirects to :

http://liomi.co.za/index.php?route=account/voucher

Re: Redirecting Categories to other OpenCart Pages

Posted: Sat Jan 20, 2018 1:52 am
by screwtape_mk
Hi

Thanks once again for your help my problem has been solved.
I just now need to redirect all the products in the that are listed in the Category tabs to their actual product pages.
For instance 'Female Fragrances >212 VIP Carolina Herrera' redirects to

http://liomi.co.za/index.php?route=prod ... h=25_32_65

I would like it to redirect to :

http://liomi.co.za/index.php?route=prod ... duct_id=43