Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Changing # of Products Displayed in Grid View (2 across vs. 3 across, etc.)
 
VosSavant
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-05-29
Colorado
 

Maybe this information will come in useful for someone. I spent a little bit getting frustrated since I have a 3-column layout for my store, and the middle column was too narrow to accommodate 3 products horizontally in grid view.

Here’s what I wanted to accomplish: instead of showing, say, a grid of 9 products in 3 rows of 3, I wanted to show those same 9 products in 5 rows of 2. Adjusting CSS classes to force containing table/div to shrink won’t work. What you need to do is open up the list.phtml file:

<your interface> / <your theme> / template / catalog / product / list.phtml

On or around lines 86, 119, 123, and 126, you’ll see code that looks like this:

Line 86:

<?php if ($i++%3==0): ?>

Line 119:

<?php if ($i%3==&& $i!=$_collectionSize): ?>

Line 123:

<?php for($i;$i%3!=0;$i++): ?>

Line 126:

<?php if ($i%3==0): ?>

Simply replace the number “3” with whatever number you want going across; so for a grid with 2 products per row, you’d replace each of those 3s with a 2, and for a grid with 4 products per row, you’d replace the 3 with a 4, etc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rubbergob
Jr. Member
 
Total Posts:  2
Joined:  2008-07-12
 

Handy tips!
Thanks, David

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top