Post by edbloom » Tue Aug 24, 2010 6:30 am

Hi all,

I want to change my home template to actually be one of my category pages.

Now before I go creating a new controller and output all the values into the home.tpl file is there a better more efficient way of doing this?

Thanks,

Ed

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by JAY6390 » Tue Aug 24, 2010 8:08 am

Open up

Code: Select all

/catalog/controller/common/home.php
and just after

Code: Select all

public function index() { 
on a new line put

Code: Select all

$this->redirect(HTTP_SERVER . 'index.php?route=product/category&path=20_27'); 
changing the 20_27 to the correct category path

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by edbloom » Wed Aug 25, 2010 2:26 am

Jay,

my friend you are a genius!

you probably just saved me a couple of hours of writing a module to output the category listing.

thanks so much!

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by JAY6390 » Wed Aug 25, 2010 3:35 am

lol no problem. At the most, you'd just have to duplicate the category controller and view, and then save them in the home controller and view files respectively :)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by edbloom » Wed Aug 25, 2010 3:37 am

that's what I was about to do but your solution works perfectly!

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by JAY6390 » Wed Aug 25, 2010 3:48 am

hehe glad its all sorted :)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by edbloom » Wed Aug 25, 2010 4:23 am

ahh
slight snag with this neat little solution

it's messed up the currency switcher.

i assume something in home.php which normally sets the currency session value is no longer getting called as a result of the redirect kicking in.

this would make sense if I was on the home page but doesn't make sense on a category page.

what happens is that the refresh occurs but the session value does not change.

I'm looking into it right now...

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by edbloom » Wed Aug 25, 2010 4:29 am

so what seems to be happening is that say I'm on the cart page and switch from sterling to euro.... instead of the page refreshing and the currency switching - I get redirected back to my category page that I've set in home.php

I wonder why the cart page (or any other page for that matter) is intercepting a redirect that is set in home.php - surely this line I added would only intercept any requests to home...

strange...

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by edbloom » Wed Aug 25, 2010 4:32 am

what's also even stranger is that the form redirect is being set correctly on each page

e.g.

<input type="hidden" name="redirect" value="http://localhost.dev/opencart/index.php ... ckout/cart

is where the form redirect is set to go when on the cart page - not the product category page

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by JAY6390 » Wed Aug 25, 2010 4:39 am

I thought I answered this. Are you sure you've edited home.php and not header.php by mistake?

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by edbloom » Wed Aug 25, 2010 4:53 am

Hi Jay,

I thought I had too - but I've double and triple checked - I definitely edited home.php not header.php

very odd

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by edbloom » Wed Aug 25, 2010 4:55 am

I recreated the issue on a clean install just to be sure aswell...

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by edbloom » Thu Aug 26, 2010 4:45 am

hmmm - racking my brains and still can't figure this one out - any ideas?

Newbie

Posts

Joined
Fri Jan 08, 2010 7:19 am

Post by robinpecha » Fri Dec 04, 2020 3:19 am

Hi, in opencart 3 it doesnt work, whole page freeze. Please any updated solution?

Newbie

Posts

Joined
Mon Aug 03, 2020 11:36 pm
Who is online

Users browsing this forum: No registered users and 207 guests