Community Forums

Changing default view to grid

Template support & advice for OpenCart v1.x

Changing default view to grid

Postby Cassiefa » Wed Apr 11, 2012 3:47 pm

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!
Cassiefa
 
Posts: 1
Joined: Wed Apr 11, 2012 3:37 pm

Re: Changing default view to grid

Postby dbassa » Wed Apr 11, 2012 4:00 pm

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,
User avatar
dbassa
 
Posts: 229
Joined: Mon May 18, 2009 4:11 pm
Location: Spain

Re: Changing default view to grid

Postby Melanie » Mon Apr 16, 2012 12:23 am

Hi there,

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

Still listing in list view...


Any help?
Thanks.
Melanie
 
Posts: 74
Joined: Tue Mar 30, 2010 1:39 am

Re: Changing default view to grid

Postby MarketInSG » Mon Apr 16, 2012 2:24 am

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>
User avatar
MarketInSG
 
Posts: 2613
Joined: Wed Nov 16, 2011 3:53 am
Location: Singapore

Re: Changing default view to grid

Postby dbassa » Mon Apr 16, 2012 12:22 pm

MarketInSG,

Could you explain what does exactly this script?

Thanks,
User avatar
dbassa
 
Posts: 229
Joined: Mon May 18, 2009 4:11 pm
Location: Spain

Re: Changing default view to grid

Postby MarketInSG » Mon Apr 16, 2012 1:36 pm

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>
User avatar
MarketInSG
 
Posts: 2613
Joined: Wed Nov 16, 2011 3:53 am
Location: Singapore

Re: Changing default view to grid

Postby dbassa » Mon Apr 16, 2012 3:19 pm

I meant the javascript code. It doesn't matter. Thanks anyway.
User avatar
dbassa
 
Posts: 229
Joined: Mon May 18, 2009 4:11 pm
Location: Spain

Re: Changing default view to grid

Postby jariusj77 » Tue Apr 17, 2012 1:41 am

Hopefully somebody else can give you a better answer![img]Hopefully%20somebody%20else%20can%20give%20you%20a%20better%20answer[/img]
jariusj77
 
Posts: 4
Joined: Thu Mar 29, 2012 1:09 am

Re: Changing default view to grid

Postby MarketInSG » Tue Apr 17, 2012 6:16 am

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 :)
User avatar
MarketInSG
 
Posts: 2613
Joined: Wed Nov 16, 2011 3:53 am
Location: Singapore

Re: Changing default view to grid

Postby opm595 » Thu Apr 26, 2012 5:17 am

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
======================================
"OpenCart . . . What a Catch! It's Marvelous!"
=======================================
User avatar
opm595
 
Posts: 1
Joined: Thu Apr 19, 2012 12:27 am
Location: Sydney, Australia

Re: Changing default view to grid

Postby dbassa » Fri Apr 27, 2012 9:26 am

You're welcome!
User avatar
dbassa
 
Posts: 229
Joined: Mon May 18, 2009 4:11 pm
Location: Spain

Re: Changing default view to grid

Postby werepair » Tue May 29, 2012 5:16 am

UKsitebuilder has a vqmod for this http://forum.opencart.com/viewtopic.php?f=131&t=38143

Regards
User avatar
werepair
 
Posts: 110
Joined: Sat May 28, 2011 6:54 am
Location: United Kingdom

Re: Changing default view to grid

Postby onlyjf » Thu May 31, 2012 4:16 pm

Thanks for this
onlyjf
 
Posts: 4
Joined: Thu Jun 24, 2010 5:57 am

Re: Changing default view to grid

Postby hellreturn » Fri Jun 01, 2012 8:36 am

Can someone please tell me the path for that file?
hellreturn
 
Posts: 50
Joined: Mon May 28, 2012 8:21 pm

Re: Changing default view to grid

Postby dbassa » Fri Jun 01, 2012 11:48 am

tpl category list file:

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

At the end of the file you will find it.

Best Regards,
User avatar
dbassa
 
Posts: 229
Joined: Mon May 18, 2009 4:11 pm
Location: Spain

Re: Changing default view to grid

Postby lmw1 » Mon Jun 11, 2012 3:56 am

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
lmw1
 
Posts: 76
Joined: Mon Jun 04, 2012 5:44 am

Re: Changing default view to grid

Postby sjiitb » Thu Jun 14, 2012 9:03 pm

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
}
sjiitb
 
Posts: 7
Joined: Sun May 20, 2012 12:51 pm

Re: Changing default view to grid

Postby Rosettes » Wed Jul 04, 2012 7:41 pm

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 :)
User avatar
Rosettes
 
Posts: 10
Joined: Tue Feb 28, 2012 8:43 pm

Re: Changing default view to grid

Postby SunehraTech » Wed Jul 25, 2012 9:08 pm

dbassa help worked for me.. thanks
SunehraTech
 
Posts: 30
Joined: Sat Jun 23, 2012 5:19 pm

Re: Changing default view to grid

Postby ForgetfulGuru » Thu Jul 26, 2012 10:25 pm

@dbassa Thanks this simple change was just what I was looking for.
Life is for the taking. It's everything else you need to pay for.
AML Candles
User avatar
ForgetfulGuru
 
Posts: 27
Joined: Sun Jul 22, 2012 3:12 pm
Location: Right hand corner as you enter the room, better feng shui.

Next

Return to Template Support

Who is online

Users browsing this forum: winter and 11 guests

Hosted by Arvixe Web Hosting