Page 1 of 2

Changing default view to grid

Posted: Wed Apr 11, 2012 11:47 pm
by Cassiefa
I'm having trouble setting my default view in categories from list to grid.

I've tried a few things from other threads on the forum including downloading the vqmod and adding this mod uksb_grid_view_default.xml but it hasn't changed the view, despite clearing cookies.

I'm using the default template of Opencart 1.5.2.1 - so do I need to make changes to anything in my admin area to make the default grid setting apply?

This is my store: http://www.tutuswingsandprettythings.com

Any help is greatly appreciated!

Re: Changing default view to grid

Posted: Thu Apr 12, 2012 12:00 am
by dbassa
Hello Casiefa,

Try to locate this piece of code, generally at the bottom of the tpl category list file:

Code: Select all

view = $.cookie('display');

if (view) {
	display(view);
} else {
	display('list');
}
You should just change de part: display('list') to display('grid')

Like this:

Code: Select all

view = $.cookie('display');

if (view) {
	display(view);
} else {
	display('grid');
}
Best regards,

Re: Changing default view to grid

Posted: Mon Apr 16, 2012 8:23 am
by Melanie
Hi there,

I done the above but it still didnt make a difference.

Still listing in list view...


Any help?
Thanks.

Re: Changing default view to grid

Posted: Mon Apr 16, 2012 10:24 am
by MarketInSG
Clear your browser cookies after you done that and you should see the effect. New users to your website will see view as default 'grid'. Else if you want permanent grid layout, add this:

Code: Select all

<script type="text/javascript">$(document).ready(function() { if(typeof display == 'function') { display('grid'); } });</script>

Re: Changing default view to grid

Posted: Mon Apr 16, 2012 8:22 pm
by dbassa
MarketInSG,

Could you explain what does exactly this script?

Thanks,

Re: Changing default view to grid

Posted: Mon Apr 16, 2012 9:36 pm
by MarketInSG
MarketInSG wrote:Clear your browser cookies after you done that and you should see the effect. New users to your website will see view as default 'grid'. Else if you want permanent grid layout, add this:

Code: Select all

<script type="text/javascript">$(document).ready(function() { if(typeof display == 'function') { display('grid'); } });</script>

Re: Changing default view to grid

Posted: Mon Apr 16, 2012 11:19 pm
by dbassa
I meant the javascript code. It doesn't matter. Thanks anyway.

Re: Changing default view to grid

Posted: Tue Apr 17, 2012 9:41 am
by jariusj77
Hopefully somebody else can give you a better answer![img]Hopefully%20somebody%20else%20can%20give%20you%20a%20better%20answer[/img]

Re: Changing default view to grid

Posted: Tue Apr 17, 2012 2:16 pm
by MarketInSG
jariusj77 wrote:Hopefully somebody else can give you a better answer![img]Hopefully%20somebody%20else%20can%20give%20you%20a%20better%20answer[/img]
Not useful comments can be kept :)

Re: Changing default view to grid

Posted: Thu Apr 26, 2012 1:17 pm
by opm595
I had the same prob, wanting to have Grid by default.
I went with what dbassa instructions and it worked fine for me.
Just changed display('list'); to display('grid'); in the category TPL file, cleared my cache and presto!
All good here.
Many thanks for that tip, dbassa.
Cheers! ;D

Re: Changing default view to grid

Posted: Fri Apr 27, 2012 5:26 pm
by dbassa
You're welcome!

Re: Changing default view to grid

Posted: Tue May 29, 2012 1:16 pm
by werepair
UKsitebuilder has a vqmod for this http://forum.opencart.com/viewtopic.php?f=131&t=38143

Regards

Re: Changing default view to grid

Posted: Fri Jun 01, 2012 12:16 am
by onlyjf
Thanks for this

Re: Changing default view to grid

Posted: Fri Jun 01, 2012 4:36 pm
by hellreturn
Can someone please tell me the path for that file?

Re: Changing default view to grid

Posted: Fri Jun 01, 2012 7:48 pm
by dbassa
tpl category list file:

catalog/view/theme/default/template/product/category.tpl

At the end of the file you will find it.

Best Regards,

Re: Changing default view to grid

Posted: Mon Jun 11, 2012 11:56 am
by lmw1
The javascript above to make the grid view permanent. Where do you place this script? I put it in the bottom of the category.tpl file and you can still choose list.

Or am I misinterpreting this? lol

Respectfully,
Len

Re: Changing default view to grid

Posted: Fri Jun 15, 2012 5:03 am
by sjiitb
hi
I've changed the default view to grid but what happens now is that it goes back to list randomly - only sometimes, on some machines.

Could someone please point me in the right direction?

This is what i've done

f (view) {
display(view);
} else {
display('list'); ---> change to grid
}

Re: Changing default view to grid

Posted: Thu Jul 05, 2012 3:41 am
by Rosettes
dbassa wrote:Hello Casiefa,

Try to locate this piece of code, generally at the bottom of the tpl category list file:

Code: Select all

view = $.cookie('display');

if (view) {
	display(view);
} else {
	display('list');
}
You should just change de part: display('list') to display('grid')

Like this:

Code: Select all

view = $.cookie('display');

if (view) {
	display(view);
} else {
	display('grid');
}
Best regards,

Just wanted to say you star, it worked perfectly for me too! However after clicking around my website I decided I preferred the list view instead, but awesome it worked straight away so thought I would comment :)

Re: Changing default view to grid

Posted: Thu Jul 26, 2012 5:08 am
by SunehraTech
dbassa help worked for me.. thanks

Re: Changing default view to grid

Posted: Fri Jul 27, 2012 6:25 am
by ForgetfulGuru
@dbassa Thanks this simple change was just what I was looking for.