我想知道是否可以将一个类别的描述更改为紧接在产品之后。 这里的例子: http://www.theprinterdepo.com/refurbished-printers/monochrome-laser-refurbished-printers
我想某处有一个 phtml 文件,我可以为此轻松更改
我找到了这个文件,代码如下
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description std">
<?php
//$currentPage = $this->getCollection()->getCurPage();
echo $_helper->categoryAttribute($_category, $_description, 'description')
?>
</div>
<?php endif; ?>
然而 getCurPage 给出了错误
最佳答案
// get category id
$category = $category->load($category_id);
// get collection
$category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect('*');
// print out the description
echo $category->getDescription();
// get current page
$currentPage = $this->getCollection()->getCurPage();
if($currentPage = 1) {
// show Description Here
echo $category->getDescription();
} else {
// Show category name instead of description
echo $category->getName();
-- 编辑 -- 尝试这个而不是上面
$currentPage->getSelect()->getCurPage();
关于php - 更改描述顺序或类别页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8983793/