Magento - Get category description from CMS block or page

Magento - Get category description from CMS block or page

August 4, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Get category description from CMS block or page

Magento: Rendering Category Descriptions from CMS Blocks

As a senior developer, I often encounter requests to display category descriptions using Magento’s built-in CMS functionality. By leveraging the power of Magento’s block system, you can easily fetch and render category descriptions using either a CMS page or block.

Getting Started with the Block System

The first step is to understand how Magento handles blocks. Blocks are XML-based definitions that describe what content should be rendered on a given page. They allow you to combine multiple elements like product lists, static content, and HTML snippets in a single output.

To render the category description, we’ll create or modify an existing block that already includes your category-specific product list.

Using CMS Blocks with Block Types

The {{block}} directive allows you to insert any defined block into your layout. To fetch the category description, you can use the catalog/category_view_container block type and combine it with your existing product listing.

Here’s an example of how to modify the block in your template:

{{block type="catalog/category_view_container" name="category.view.container" as="categoryView"}}

Fetching the Category Description

Next, you need to access the category description data within your template. Magento stores this information in the catalog_category_entity table under the description column.

To fetch the description, you can use the getCategory() function provided by the Mage_Catalog_Block_Category_View class:

<?php $category = Mage::registry('current_category');
if ($category->getDescription()) {
    echo '<p>' . $this->htmlEscape($category->getDescription()) . '</p>';
}

In this code snippet, Mage::registry('current_category') retrieves the current category being viewed. The getDescription() method fetches the description content.

Incorporating CMS Blocks and Pages

If you want to fetch a block or page description from the Magento CMS system instead of the native category description field, you can use the following approach:

  1. Create or edit an existing CMS page that contains your desired text.
  2. In your layout XML file (e.g., your_template/layout/catalog.xml), define a new block of type “cms/block” and assign it to a specific area:
<reference name="content">
    <block type="cms/block" name="category.cms.block" before="-">
        <action method="setBlockId"><block_id>your_cms_block_id</block_id></action>
    </block>
</reference>

Replace your_cms_block_id with the ID of your CMS block.

  1. In your template, you can now display the content of this block using the getContent() method:
<?php $cmsBlock = Mage::getModel('cms/block')->load('your_cms_block_id');
if ($cmsBlock->getContent()) {
    echo '<p>' . $this->htmlEscape($cmsBlock->getContent()) . '</p>';
}

Conclusion

Displaying category descriptions using Magento’s CMS functionality is a straightforward process that requires knowledge of the block system and some basic PHP programming.

By combining blocks like catalog/category_view_container with your existing product listings, you can create a seamless integration between the native category description fields and your custom CMS content.

Remember to always ensure your code adheres to Magento best practices, such as escaping output using $this->htmlEscape(), to prevent security vulnerabilities.

For more advanced techniques in Magento development, I recommend exploring the resources available on Laravel Company. They offer a wealth of guides and tutorials for both beginners and experienced developers looking to expand their skills within the Magento ecosystem.

When working with category descriptions and CMS content, feel free to experiment with different block types and attributes to create dynamic and engaging product listings that drive customer engagement.

Catalog Database Themes Deployment

Our network