Jump to content

Change default grid view to default list view in product list


Recommended Posts

Hello

 

I have seen the tutorial about changing the product list from default grid view to default list view, but the code shown in the examples are not the same as in the latest prestashop version 1.6.0.14.

 

Here are the code blocks concerning the function "function bindGrid()"

 

Code found in themes/default-bootstrap/js/global.js :

function bindGrid()

{

	var view = $.totalStorage('display');



	if (!view && (typeof displayList != 'undefined') && displayList)

		view = 'list';



	if (view && view != 'grid')

		display(view);

	else

		$('.display').find('li#grid').addClass('selected');



	$(document).on('click', '#grid', function(e){

		e.preventDefault();

		display('grid');

	});



	$(document).on('click', '#list', function(e){

		e.preventDefault();

		display('list');

	});

}


And here is the code found in /themes/default-bootstrap/product-list.tpl :

<!-- Products list -->
	<ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}">

I do use another theme, so I looked in the same files of the non default theme and found the same code as in the default bootstrap theme, so I guess the changements should be the same in both themes.

 

I tried to change it substituting "grid" with "list" more less as shown in the tutorial that Vekia wrote about Presta 1.6.0.11 (I guess it could be related to that version or earlier, anyway is not about the latest version)

 

Unfortunately I got no good results + some bugs, e.g. changing the modality by hand in front office nothing happens or causes to have tiles in the grid showing not truncated text, so one tile is longer one is shorter etcetera

Refreshing the page also causes to show a grid with not truncated text

In general grid stays to be default visualization and to obtain the list one have to click at least twice the list button....

Changing category cause the same problems.

 

So I reverted all to the original files, but I really want to get it the other way, list view as default and grid view as an user option....

 

Anyone knows how to set default list view for the product list also in prestashop 1.6.0.14?

 

Thank you in advance.

Edited by daxit_x (see edit history)
Link to comment
Share on other sites

Hi nemo

Thank you for the hint, I knew that there was something alike this, but could not find it back so I thought I was having a mistake with some other platform...

 

I was looking for this switch in the theme configuration not a module....

 

By the way I solved the issue so far, but noticed that it is not possible to disable the grid...

 

In my case I'd like to completely disable the grid view of the product list, it would be a very easy way to avoid some graphical problems with the layered navigation and the thme I am using...

 

Thank you.

Bye

Link to comment
Share on other sites

Hi Nemo

 

I just did it, very simple and efficient workaround, I commented one line ad it works properly, the users cannot switch to the grid and see the formatting failures.

It is ok for now, inexpensive and resolutive, 1 minute time solution that allows to go on for now.

Thank you very much, greatly appreciated.

Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...
  • 5 months later...
  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...