1

I know there are more than a way to change the number of products in a row on category view page.

One way to do so is to open catalog.xml and changing the number in following code:

<action method="setColumnCount"><count>4</count></action>

However as I am learning Magento, I learned that you shouldn't change Magento XML files and instead you should create a local.xml file and put all your changes inside it.

Following this logic I added following code to my local.xml file to change the number of products in a row to 3:

<catalog_category_layered translate="label">
    <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="core/text_list" name="product_list.name.after" as="name.after" />
                <block type="core/text_list" name="product_list.after" as="after" />
                <action method="setColumnCount"><count>3</count></action>
            </block>
    </block>
</reference>
</catalog_category_layered>

This works, however the problem is that as the same code (however with number 4) also excists in catalog.xml if you open any of catalog view pages the product grid is showing twice!

What is the right way to change the number of products in a row? Is it ok if I just replace 4 with 3 in catalog.xml?

Thanks

1 Answer 1

0

What you are doing is creating your list a second time. You have to refer to it like this:

<catalog_category_layered translate="label">
   <reference name="product_list">
     <action method="setColumnCount"><count>3</count></action>
   </reference>
</catalog_category_layered>

I can also advice you to never replace something in the core files, also not the template and layout files. It will be overridden when you upgrade Magento and will give you alot of trouble if you need an upgrade.

0

Your Answer

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

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