Page 1 of 5

[1.5.x]Set grid view as default

Posted: Fri Jun 03, 2011 9:22 am
by manny79
Love the changes in OC 1.5

Is there a way to set grid view as default in OC 1.5?

Any help will be greatly appreciated

Re: [1.5.0]Set grid view as default

Posted: Fri Jun 03, 2011 5:02 pm
by justinv
Edit catalog/view/theme/<themename>/template/common/footer.tpl:

Place this code before the </body> tag:

Code: Select all

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

Re: [1.5.0]Set grid view as default

Posted: Sat Jun 04, 2011 7:10 pm
by manny79
justinv wrote:Edit catalog/view/theme/<themename>/template/common/footer.tpl:

Place this code before the </body> tag:

Code: Select all

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

Thanx for your reply. Sorry for the late reply... Been on a sabbatical for the last 24 hours...
Thank you again

Re: [1.5.0]Set grid view as default

Posted: Thu Jun 16, 2011 5:14 pm
by sjmaceyful
This wont work. Well it will, but it will, throw up an error on any page that doesn't have a category view on it (ie Home page).

Does anyone have a better solution? Surely there must be a way to change this in the admin section.

Re: [1.5.0]Set grid view as default

Posted: Thu Jun 16, 2011 7:36 pm
by qahar
Open category.tpl and find code bellow:

Code: Select all

if (view) {
	display(view);
} else {
	display('list');    ---> change to grid
}
Do the same thing on other page used grid-list, like manufacturer, special etc

Re: [1.5.0]Set grid view as default

Posted: Wed Jun 22, 2011 4:36 pm
by budfox
I just cannot get this to work...Cleared cookies, tried in different browsers...nada. Still getting a list view.

Ideas anyone?

Re: [1.5.0]Set grid view as default

Posted: Wed Jun 22, 2011 5:46 pm
by jomachi
Also, i prefer the grid view. So i try the trick given by qahar and it works on the last version of OC 1.5.0.5

Re: [1.5.0]Set grid view as default

Posted: Wed Jun 22, 2011 5:51 pm
by budfox
Ah, best get 1.5.05 then...

Re: [1.5.0]Set grid view as default

Posted: Fri Jun 24, 2011 2:42 am
by chokoret
Find

Code: Select all

  <div class="product-list"> 
from category.tpl
and change it to

Code: Select all

  <div class="product-grid">

Re: [1.5.0]Set grid view as default

Posted: Fri Jun 24, 2011 1:26 pm
by Dubblicious
qahar wrote:Open category.tpl and find code bellow:

Code: Select all

if (view) {
	display(view);
} else {
	display('list');    ---> change to grid
}
Do the same thing on other page used grid-list, like manufacturer, special etc
Thanks qahar that worked like a charm.
anyone that is looking for it, it is catalog\view\theme\default\template\product.

Re: [1.5.0]Set grid view as default

Posted: Fri Jun 24, 2011 9:47 pm
by Jacob
anyone that is looking for it, it is catalog\view\theme\default\template\product.
Remember to make your own theme and not edit the default files, it is fairly easy to do :)

Theme documentation

Re: [1.5.0]Set grid view as default

Posted: Fri Jun 24, 2011 10:51 pm
by Jacob
I got rid of the following divs and their code (which includes display grid/list) as it was not wanted on our site.

Code: Select all

  <div class="product-filter">
    <div class="display"></div>
    <div class="limit"></div>
    <div class="sort"></div>
  </div>

<div class="display"></div>
I then deleted all the js at the bottom of the page. ;)

In the css file I commented out all the .product-list styles.

Then renamed .product-grid to .product-list.

This has set our product's default display to grid ;D

It worked for me - someone with more coding knowledge than myself may want to comment on whether they think it is a good solution or not?

Re: [1.5.0]Set grid view as default

Posted: Sat Jun 25, 2011 2:57 am
by Dubblicious
Jacob wrote:
anyone that is looking for it, it is catalog\view\theme\default\template\product.
Remember to make your own theme and not edit the default files, it is fairly easy to do :)

Theme documentation
Thanks for that, I did not know you could do a child theme like WordPress.

Re: [1.5.0]Set grid view as default

Posted: Sat Jun 25, 2011 4:22 pm
by uksitebuilder
Thanks to Qahar

There is however an additional code change that is required, especially if using SEO URLs otherwise a cookie is set only on a per category basis and when switching to a different category sometimes it defaults back to list view.

Here is the full code change for category.tpl

Find:

Code: Select all

$.cookie('display', 'grid');
Change to:

Code: Select all

$.cookie('display', 'grid', { path: '/' });
Find:

Code: Select all

$.cookie('display', 'list');
Change to:

Code: Select all

$.cookie('display', 'list', { path: '/' });
Find:

Code: Select all

display('list');
Change to:

Code: Select all

display('grid');
The above changes should be done to the following files:

catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer_info.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/special.tpl

or better still use vQmod -> http://forum.opencart.com/viewtopic.php ... ilit=vqmod

With my attached xml file:

Re: [1.5.0]Set grid view as default

Posted: Tue Jun 28, 2011 7:49 pm
by teratyke
The above changes should be done to the following files:

catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/special.tpl

or better still use vQmod -> http://forum.opencart.com/viewtopic.php ... ilit=vqmod

With my attached xml file

uksb_grid_view_default.xml
Grid View Default vQmod xml file
Thank you for posting this vQmod xml file - very helpful indeed!
I think I found an error though - manufacturer.tpl should be manufacturer_info.tpl - at least it is in my 1.5.0.5 installation.

Many thanks again
Rob

Re: [1.5.0]Set grid view as default

Posted: Tue Jun 28, 2011 8:08 pm
by uksitebuilder
Thanks for spotting my error Rob.

I have edited my post above and the vQmod XML attachment to fix this.

Re: [1.5.0]Set grid view as default

Posted: Sun Jul 03, 2011 7:42 am
by rfary
tried it and still will not work on my oc1.5.0.5. not sure why. using Vqmod and manual also don't work. any other suggestion?

Re: [1.5.0]Set grid view as default

Posted: Sun Jul 03, 2011 6:28 pm
by i2Paq
rfary wrote:tried it and still will not work on my oc1.5.0.5. not sure why. using Vqmod and manual also don't work. any other suggestion?
Default template?

Re: [1.5.0]Set grid view as default

Posted: Sun Jul 03, 2011 9:53 pm
by rfary
i2Paq wrote:
rfary wrote:tried it and still will not work on my oc1.5.0.5. not sure why. using Vqmod and manual also don't work. any other suggestion?
Default template?
i tried both default and my personal and still don't work.

Re: [1.5.0]Set grid view as default

Posted: Mon Jul 04, 2011 12:16 am
by uksitebuilder
make sure you have cleared your cookies