Is there an actual way to handle the columnCount in Magento's 1.9 RWD theme?

It is not possible to use addColumnCountLayoutDepend in layout.xml to set the column counts depending on the page layout in this theme and is only used to set the maximum columns.

I can manually set $_columnCount = 2; in the list.phtml and whilst $_columnCount; outputs 2, the columns on the front end don't actually change.

I see that the widths (%) for the <li> items are all hardcoded in styles.css to 4 decimal places - surely there is a way to handle this without altering all the widths in the stylesheet to get the amount of products per row you want in your grid?

Even if it were a case of altering all the widths, how do you get this perfect with 4 decimal places like so:-

width: 30.8642%;
margin-right: 3.7037%;

I'm sure I must be overlooking something else?

2 Answers 2


To set the column count for a particular category, select that category in the backend under Manage Categories. Then select the Custom Design tab—here, add in the following code and modify as needed:

<reference name="product_list">
    <action method="setColumnCount"><count>3</count></action>
  • Useful, thanks for adding this to the discussion.
    – zigojacko
    Jul 1, 2014 at 7:39
  • @david-sinclair, very useful. thank you David. I can made custom layout with that from inside Category Custom Layout Update for Custom Design Jun 1, 2016 at 6:28

Ah, I've figured it out...

The class gets changed depending on the columnCount, i.e:-

<ul class="products-grid products-grid--max-4-col">

And the default styles only cater for 4, 5 and 6 columns so the styles get applied on these as expected but as I was trying to change to a two column layout, there was no styles for this the class products-grid--max-2-col.

In my case, it is just case of creating a set of styles for a two column layout.

Hope that helps others if they struggle with this.

In terms of setting columnCount, it was still possible to set this in list.phtml with something such as:-

switch ($pageLayoutRootTemplate) {
case 'page/1column.phtml':
    $_columnCount = 4;

case 'page/1col-split-2col.phtml':
    $_columnCount = 2;

case 'page/2columns-left.phtml':
    $_columnCount = 4;

case 'page/2columns-right.phtml':
    $_columnCount = 2;

case 'page/3columns.phtml':
    $_columnCount = 2;

    $_columnCount = 2;

And then comment out:-

$_columnCount = $this->getColumnCount();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.