您好!
https://magento.stackexchange.com/questions/12899/display-more-items-per-row-in-products-page
^这篇文章是每行设置4个产品的指南适用于所有页面。
我想为每个页面布局设置不同数量的产品。
目标:
请说明每行定制产品!
谢谢
答案 0 :(得分:0)
在app / design / frontend / yourtheme / default / template / catalog / product / list.phtml中(如果你没有通过从app / design / frontend / base / default / template / catalog /复制来创建它) product / list.phtml)并替换行:
<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
与
<?php $_collectionSize = $_productCollection->count() ?>
<?php
// Get the layout's page template
$pageLayoutRootTemplate = $this->getLayout()->getBlock('root')->getTemplate();
// Set the column count based on the layout template used
switch ($pageLayoutRootTemplate) {
case 'page/1column.phtml':
$_columnCount = 5;
break;
case 'page/2columns-left.phtml':
$_columnCount = 4;
break;
case 'page/2columns-right.phtml':
$_columnCount = 4;
break;
case 'page/3columns.phtml':
$_columnCount = 3;
break;
default:
$_columnCount = 3;
break;
}
// comment normal line out $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
显然可以根据需要修改它。