2013-05-06 57 views
5

我想在左侧栏中显示类别说明,而不是主栏。Magento:如何显示左侧栏中的类别说明?

我将此添加到我的catalog.xml:

<reference name="left"> 
     <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/> 
    </reference> 
      <reference name="left"> 
     <block type="catalog/navigation" name="catalog.catdes" after="catalog.leftnav" template="catalog/navigation/description.phtml"/> 
    </reference> 

我创建这个文件:目录/导航/ description.phtml

<?php 
$_helper = $this->helper('catalog/output'); 
$_category = $this->getCurrentCategory(); 
    ?> 
     <?php if($_description=$this->getCurrentCategory()->getDescription()): ?> 
<div class="category-description"> 
    <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?> 
</div> 

毫无结果可言。我可能做错了什么?

+0

你有参考标签再次定义引用名称可能是这个问题的原因 – Mufaddal 2013-05-08 06:05:18

回答

4

你刚试过回声$ _description因为你设置它等于if语句?

如果不工作,那么只是尝试加载它:

$cat = Mage::getModel('catalog/category')->load($_category->getId()); 
$description = $cat->getDescription(); 
8

下面的解决了这个问题对我来说。

echo Mage::getModel('catalog/layer')->getCurrentCategory()->getDescription(); 
0
<?php if($category = Mage::registry('current_category')): ?> 
<div class="category-description std"> 
    <?php echo $category->getDescription(); ?> 
</div> 
<?php endif; ?>