Magento - Get category description from CMS block or page

6k views Asked by At

On the homepage I am using the following code to display a few products from a specific category:

{{block type="catalog/product_list" category_id="213" column_count="6" template="catalog/product/list.phtml"}}

Is there a block I can use to also render the category description via a CMS page or block?

1

There are 1 answers

0
Marius On BEST ANSWER

There is no built in functionality for this, but you can add a block yourself. Add this in the homepage content:

{{block type="core/template" template="catalog/category/description.phtml" category_id="213"}}

Now create the file app/design/frontend/{interface}/{theme}/template/catalog/category/description.phtml with the following content

<?php $categoryId = $this->getCategoryId();?>
<?php $category = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($categoryId);?>
<?php if ($category->getId() && $category->getIsActive() && $_description = $category->getDescription()) : ?>
    <?php echo $this->helper('catalog/output')->categoryAttribute($category, $_description, 'description')?>
<?php endif;?>