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:
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action> <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action> <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action> <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action> <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
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:
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:
<update handle="page_two_columns_left" />
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.