Change grid view column for Product Listing
In v1.4 Magento, changing columns in Grid View for product listing page has become easy, however there is still confusion and it does not seemed to be working right out-of-the-box.
First let’s see what we have in Default theme. In catalog.xml, around line #97 and line #138 both in “Category default layout” and “Category layered navigation layout” we see:
empty 6 one_column 5 two_columns_left 4 two_columns_right 4 three_columns 3
You would have thought if we change the number, e.g, from “3″ to “4″ for three columns layout you would get the 4 columns in grid view product listing for three columns layout right?
But it does not work in our test for different sites which included a fresh v1.4 installation using Default theme and Simple Data. On top of that, the two columns left/right and one columns are still showing 3 columns for grid view.
Let see what we have in Modern theme. It shows only this code in catalog.xml:
4
If we use the same code for Default theme’s layout, we will get the 4 columns in grid view product listing page regardless which template is used.
Turned our that in order for the addColumnCountLayoutDepend” to work, an update handle is needed. Example, if you want to change a template from 3 columns to 4 columns grid view, you need to do this:
Simply place the above code in the catalog_category_default and catalog_category_layered .
Depending on your design, you may need to adjust the width for the listing area in your style sheet.
Note that both method still does not work for homepage even an update handle is added–it’s still showing 3 columns grid view regardless which template is used.
A bug report has been filed, let’s just hope it’s a bug and that it will be fixed in the next upgraded for that this is really a great feature because it offers flexible and reliable equal height columns layout in grid view without using table layout. Why do we said that? Because if you use CSS floated elements, unless a height or min-height is declared (which is always a bad idea for layout that you don’t know how much height is needed for a product); an alternative method maybe using “display:table-row” and “display:table-cell” but this does not work in IE 7/6. Javascript approach is another option but we rather not mess with it because it’s also not reliable.
8 Comments to “ Change grid view column for Product Listing ”