Page 1 of 1

Redirect to a specific category on the homepage

Posted: Tue Dec 09, 2014 5:49 am
by sasha-ua
Hi!

I need to replace the main page(home.tpl) to a category with the goods(product/category).

As described here did not work:
http://forum.opencart.com/viewtopic.php?f=20&t=59830

home.tpl

Code: Select all

<?php $this->redirect($this->url->link('product/category', 'path=59')); ?>
Don't Work.

Re: Redirect to a specific category on the homepage

Posted: Tue Dec 09, 2014 1:44 pm
by fido-x
sasha-ua wrote:Hi!

I need to replace the main page(home.tpl) to a category with the goods(product/category).

As described here did not work:
http://forum.opencart.com/viewtopic.php?f=20&t=59830

home.tpl

Code: Select all

<?php $this->redirect($this->url->link('product/category', 'path=59')); ?>
Don't Work.
That may have worked in OC 1.5.6.x (or earlier) but it won't work in OC 2 (or beyond). You need to add the redirect to the controller.

In catalog/controller/common/home.php, insert the following:

Code: Select all

$this->response->redirect($this->url->link('product/category', 'path=59'));
near the beginning of the file after:

Code: Select all

$this->document->setKeywords($this->config->get('config_meta_keyword'));

Re: Redirect to a specific category on the homepage

Posted: Tue Dec 09, 2014 4:17 pm
by sasha-ua
Big Thanks!