Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change column count Magento

Ok, this is an issue that seems to be easy to solve, but it's eluding me...

I've got some categories on my Magento Web, and some products on each category. I want them to show as 4 column count, but it always shows as 3 column count, like seen here:

enter image description here

I have tried this: On app/desing/frontend/default/mytheme/layout/catalog.xml, I modified this code:

<!--
Category default layout
-->

<catalog_category_default translate="label">
    <label>Catalog Category (Non-Anchor)</label>
    <reference name="left">
        <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
    </reference>
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                    <!-- The following code shows how to set your own pager increments -->
                    <!--
                        <action method="setDefaultListPerPage"><limit>4</limit></action>
                        <action method="setDefaultGridPerPage"><limit>9</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
                        <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                    -->
                </block>
                <action method="setColumnCount"><columns>4</columns></action>
                <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>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>
    </reference>
</catalog_category_default>

So I supposedly set column count to 4, but it still keeps showing 3 products... Any idea?

PS: Using Magento 1.7.

like image 902
Sonhja Avatar asked Dec 19 '12 11:12

Sonhja


1 Answers

Under list.phtml file add following code

$this->setData('column_count',4);

below the

$_helper = $this->helper('catalog/output');
like image 74
Swapna Taru Avatar answered Sep 21 '22 15:09

Swapna Taru