2013-05-06 33 views
5

Tôi muốn hiển thị mô tả danh mục trong thanh bên trái của tôi thay vì cột chính.Magento: Làm cách nào để hiển thị mô tả danh mục ở thanh bên trái?

tôi thêm này để catalog.xml tôi:

<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> 

Và tôi tạo ra tập tin này: Danh mục/hướng/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> 

Có kết quả không có gì cả. Tôi có thể làm gì sai?

+0

bạn có xác định tên tài liệu tham khảo lại trong thẻ tham khảo có thể đây là nguyên nhân gây ra vấn đề – Mufaddal

Trả lời

4

Bạn vừa thử lặp lại $ _description vì bạn đặt nó bằng nhau trong câu lệnh if?

Nếu điều đó không làm việc sau đó chỉ cần cố gắng để tải nó:

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

Sau đây giải quyết vấn đề này đối với tôi.

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; ?> 
Các vấn đề liên quan