Magento产品列表每行显示的产品个数设置方法--那我们要显示3个该怎么设置呢:
方法一:通过修改app/design/frontend/(当前所用主题)/template/catalog/product/list.phtml模板文件来实现的。
找到代码:
<?php $_columnCount = $this->getColumnCount(); ?>|
|
修改为:
<?php $_columnCount = 4; ?>方法二:Magento系统还为我们提供了一个地方,在layout(布局)xml文件中修改。
1).设置产品列表,一行显示4个产品。修改模板的layout/catalog.xml文件:
<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"> <!-- 添加的代码 --> <action method="setColumnCount"><count>4</count></action> <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> --> <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"/>
