Jump to content

Change Home Featured module default layout to list


Go to solution Solved by Vostillix,

Recommended Posts

Hey folks !

 

I have some trouble with the default product list layout in prestashop 1.6. As many, I wanted it to look like the old list layout.

After few researches, I found this tutorial : https://mypresta.eu/en/art/prestashop-16/grid-to-list-products-view.html

 

I made the changes and, well, it made the trick on category pages (btw, thanks @vekia) but not on home featured module :( .

 

As you can see on the screenshots below, even if it has the 'list' class, the homefeature template is still in grid when the generic product-list is in list.

 

post-377767-0-72132800-1460352983_thumb.png post-377767-0-51098000-1460352729_thumb.png

 

Does any of you have an idea ? I guess it is due to a script that is not triggered somewhere, but maybe there's a proper way to do so :)

 

Thanks in advance.

 

Edited by Vostillix (see edit history)

Share this post


Link to post
Share on other sites

Hi. Thanks for your time but I am afraid that it may not be relevant.

 

Actually, we might have to correct homefeatured.tpl but the concerned part of the code of it is pretty simple :

<div id="homefeaturedwrapper"> 
	<h2> {l s='Featured Products' mod='homefeatured'}</h2>
	{include file="$tpl_dir./product-list.tpl" }
</div>

Obviously, I already did the changes that are needed directly in product-list.tpl. And it is working on other pages. If there is a change to do here, please enlighten me about it.

 

So, I guess this is due to a script somewhere that doesn't trigger properly into the 'div#homefeaturedwrapper'.

 

I just wanted to know if there were a proper way to change homefeatured product list layout as we can do for the rest of the shop. If not, does anybody know where the script is ?

Edited by Vostillix (see edit history)

Share this post


Link to post
Share on other sites
  • Solution

Thanks for this. So there's no designed way to do so and we have to go through scripts..

 

After little analysis of the code on global.js, it's appeared that, by default, the functions 'bindGrid()', so 'display(view)' function, is not triggered on the index page, so the layout of the homefeatured module is not affected by the grid-or-list choice.

 

To correct it, we just have to modify the following :

if (typeof page_name != 'undefined' && !in_array(page_name, ['index', 'product']))

to :

if (typeof page_name != 'undefined' && !in_array(page_name, ['product']))

on global.js file, line 42.

 

This one is solved. Thanks for your time SupportPS.

Edited by Vostillix (see edit history)

Share this post


Link to post
Share on other sites

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More