Magento 1-如何使每行的产品数量不同,每个页面布局也不同
你好强> ^这篇文章是为所有页面设置每行4个产品的指南。 我想为每个页面布局设置不同数量的产品 目标:Magento 1-如何使每行的产品数量不同,每个页面布局也不同,magento,magento-1,Magento,Magento 1,你好 ^这篇文章是为所有页面设置每行4个产品的指南。 我想为每个页面布局设置不同数量的产品 目标: 3列页面布局的每行3个产品 2列的每行4种产品 1列的每行5种产品 请给出每行定制产品的说明 感谢您在app/design/frontend/yourtheme/default/template/catalog/product/list.phtml(如果您没有从app/design/frontend/base/default/template/catalog/product/list.pht
- 3列页面布局的每行3个产品
- 2列的每行4种产品
- 1列的每行5种产品
感谢您在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): ?>