如何设置页面显示子类别而不显示产品?


Answers:


10

要从类别页面隐藏产品,请将类别的设置Display ModeStatic block only

要列出所有子类别,请在您的中包含以下代码catalog/category/view.phtml

<ul>
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
    <li><a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?></a></li>
<?php endforeach ?>
</ul>

您可能需要添加检查,以检查子类别是否处于活动状态,是否存在子类别,以及可能带有某种标志的对象,从而通过简单的使整个事情变得更加灵活Custom Layout Update

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.