我正在尝试仅在第一页上显示类别说明。以下代码无效 - 任何想法如何解决?
<div class="category-description std">
<?php
if (strlen($_SERVER['QUERY_STRING']) = 0 || $_GET['p'] = '1')
{
echo $_helper->categoryAttribute($_category, $_description, 'description');
}
?>
</div>
答案 0 :(得分:1)
请尝试这个:
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<?php $currentPage = (int) Mage::App()->getRequest()->getParam('p');
if($currentPage <= 1):
?>
<div class="category-description std">
<?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
<?php endif; ?>
<?php endif; ?>'
答案 1 :(得分:0)
您可以使用产品列表工具栏来了解您是否在第一页:
if ($this->isContentMode()
|| $this->getChild('product_list')->getToolbarBlock()->isFirstPage()) {
// Display description (assuming that content mode is always first page)
}