In Magento how do I specify how many products I would like displayed horizontally in the grid. By default it is 3 and I can't see where to change this (I开发者_开发百科 would like to set it to 2).
Thanks, Alan.
Difficult to find comprehensive instruction for Magento 1.4 with theming changes and local.xml, however there's possibly a bug with the columns in grid view as noted here:
http://www.lotusseedsdesign.com/blog/change-grid-view-column-4-product-listing
I got by with this in local.xml for a one column page/4 column grid:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!-- Other template tweaks here -->
<catalog_category_default>
<reference name="content">
<reference name="category.products">
<reference name="product_list">
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>4</count></action>
</reference>
</reference>
</reference>
</catalog_category_default>
in the catalog.xml layout file you can add an 'action' tag inside the product-list block that will set the number of columns... the template (list.phtml) will call it as get[Something], so you want to have the method="set[Something]" in the layout file be the same. The class the methods are being called on is in app/code/core/Mage/Catalog/Block/Product/List.php ... I think. catalog.xml has in it some commented out examples of using 'action' for doing paging, so you should be able to copy those. Bit vague...but no code handy to look at.
精彩评论