Jump to content

[Solved] How to change Product list to Grid


Recommended Posts

Hi,

I use Prestashop 1.5.4.1.

I want to change my product list to grid view.

I've already tried the tutorial from nemo (http://nemops.comgrprestashop-1-5/) and it's not working for me because it's about the layout with 2 columns, in my case I have 3 columns.

Any help or guidance would be appreciated.

Edited by bruce-rez (see edit history)
Link to comment
Share on other sites

hey

 

follow all steps there, upload new product-list.tpl file to your theme directory (don't forget about backup!)

 

and then:

 

Notice the “{if $smarty.foreach.products.iteration%4 == 0}last_row_item” part of the code. If you want to change the number of items displayed, change the 4 to something else. Of course, you’ll then need to change the css accordingly.

 

 

change the 4 to 3 - should fit to your design, if not - change it to 2

Link to comment
Share on other sites

hello,,

 

you can change the css to do this.

 

#product_list li {

 

 

border: 1px solid #EEEEEE;

border-radius: 3px 3px 3px 3px;

float: left;

height: 150px;

margin-bottom: 14px;

padding: 12px 8px;

width: 150px;

}

 

and it will show you grid on your site inform me if it solved

Link to comment
Share on other sites

but if he will have 4 products in row css styles will not help - because product list will look weirdy (thin block with huge overlaping image)

 

the most important thing is to decrease the number of products in row - then edit the css

 

that's only my opinion ;)

Link to comment
Share on other sites

if you do this css like this it will solve your issue.

#product_list li {
border: 1px solid #EEEEEE;
border-radius: 3px 3px 3px 3px;
float: left;
height: 222px;
margin-bottom: 14px;
padding: 12px 8px;
width: 160px;
}
#product_list li .left_block {
display: block;

}

#product_list li .center_block {
border-right: 1px dotted #CCCCCC;

padding: 0 7px;

}
#product_list li .right_block {
clear: both;

position: relative;
text-align: right;
width: 100%;
}
#product_list li .content_price {
float: left;
margin: 26px 0 15px;
}
#product_list li .discount, ul#product_list li .on_sale, ul#product_list li .online_only {
color: #990000;
display: block;
font-weight: bold;
margin-right: 10px;
text-transform: uppercase;
}

 

i have see live by fire bug here is the image after edit the css, let me inform if that solve your issue.

post-460779-0-49943000-1368960964_thumb.png

Link to comment
Share on other sites

vekia,

hey

 

follow all steps there, upload new product-list.tpl file to your theme directory (don't forget about backup!)

 

and then:

 

 

 

 

change the 4 to 3 - should fit to your design, if not - change it to 2

vekia,

As you mentioned I changed %4 to %3 in the codes to get 3 products per row but other blocks like "View", "Description","Compare", etc were messed up.

 

smartdatasoft,

I replaced my product_list.css by your codes but for some unknown reasons I do not get the 3 products per row, it's still shows the product in list.

Edited by bruce-rez (see edit history)
Link to comment
Share on other sites

vekia,

hey

 

follow all steps there, upload new product-list.tpl file to your theme directory (don't forget about backup!)

 

and then:

 

 

 

 

change the 4 to 3 - should fit to your design, if not - change it to 2

vekia,

As you mentioned I changed %4 to %3 in the codes to get 3 products per row but other blocks like "View", "Description","Compare", etc were messed up.

 

smartdatasoft,

I replaced my product_list.css by your codes but for some unknown reasons I do not get the 3 products per row, it's still shows the product in list.

Edited by bruce-rez (see edit history)
Link to comment
Share on other sites

vekia...

 

add to #product_list li display:inline-block;

(product-list.css file in your theme directory)

 

#product_list li {
display: inline-block;
}

 

 

i've noticed that you use CCC to minify css / js files. In this case - remember to turn force compilation on. It is necessary when you changing tpl files or css / js with CCC option turned to on.

 

waiting for your reply

 

regards

Link to comment
Share on other sites

vekia,

I inserted the code

#product_list li {

display: inline-block;

}

but I get this 2 or 3 products per row (I want to set correctly 3 products per row and centered equally), it's not consistent and some product titles are moved incorrectly.

 

Thank you

Edited by bruce-rez (see edit history)
Link to comment
Share on other sites

You have to add additional styles to <h3> block:

 

#product_list li h3 {
padding: 0 0 10px 0;
font-size: 13px;
color: #000;
display: block;
clear: both;
max-width: 140px;
text-align: center;
}

 

you can personalize design of the list by editing css styles

Link to comment
Share on other sites

vekia,

I used and mixed your codes with some of mine, It looks much better, actually It works.

I have an issue that I have to fix, This is about the Tablecloth products. Some of them are not aligned correctly horizontally.

The issue starts from third row from top. I think personally this is because of the long length of some products Name.

Do you have any idea how we can use the Line Break {(br /)} in product name to resolve this miss alignment?

 

 

Tested with FireFox 20 Mac version.

 

Thank you

Edited by bruce-rez (see edit history)
Link to comment
Share on other sites

hello

 

it's because name of the product is much longer than other names:

gPgpGO2.png

 

so h3 height values are different for each product (one has got 20px other 40px)

 

just add height param with clear:both;

 

#product_list li h3 {

height:40px;

clear:both;

}

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Thank you for this information. I seem to be having a little trouble with it and was hoping someone could double check what I did? I'm hoping a fresh pair of eyes can tell me where I went wrong. The site I am using to test on is: http://boojh.x10host...roller=category

 

You can see where things look a bit wonky here and towards the bottom the

Sort by and Show X Products per page are not sitting on the page properly.

 

I've attached the product_list.css as well. Any insight would be greatly appreciated.

 

Thanks.

 

product_list.css

Link to comment
Share on other sites

Vekia - I know, I'm not sure how that happened.

 

I've been trying to figure it out but my brain has gone to mush.

 

I'm using Prestashop 1.5.4.1 and using the default template (Which I made a copy of).

Link to comment
Share on other sites

remove the height: 234px; from:

http://boojh.x10host.com/ps/themes/cjrtheme/css/product_list.css

#product_list li .center_block {
border-right: 1px dotted #CCCCCC;
padding: 0 7px;
height: 234px;
}

 

+

 

top:0px; to top:-180px; in

#product_list li .discount {
position: absolute;
top: -180px;
right: 0;
display: inline-block;
font-weight: bold;
padding: 1px 5px;
font-size: 10px;
color: #fff;
text-transform: uppercase;
background: none repeat scroll 0 0 #9B0000;
}

 

+

 

remove the:

float: left;

margin: 26px 0 15px;

from:

#product_list li .content_price {
float: left;
margin: 26px 0 15px;
clear: both;
}

Link to comment
Share on other sites

  • 8 months later...

Quick and dirty solution for changing default view from list to grid prestashop:

 

{if $smarty.get.product_mode == 'list'} became {if $smarty.get.product_mode == 'grid'}

and

{if $smarty.get.product_mode == 'grid'} became {if $smarty.get.product_mode == 'list'}

 

The code is in product-list.tpl

 

Be sure you are renaming the picture list/grid  too.

Mine are located in themes/blabla/img/list.png and themes/blabla/img/grid.png

 

Prestashop version: 1.5.4.1

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

  • 3 weeks later...
×
×
  • Create New...