Magento: how to call static block in category page within content

Magento: how to call static block in category page within content

October 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: how to call static block in category page within content

Magento: Calling Static CMS Block within Category Page Content

As an experienced Magento developer, I often get asked about how to place static CMS blocks precisely within the content area of category pages. While many developers resort to custom layout updates, there is a more elegant and flexible solution available through the use of XML layout files.

Understanding the Limitations of Current Approaches

The common approach involves using Custom Layout Updates in your theme’s local.xml or catalog_category_view.xml file. This method allows you to define where the block appears within the category page structure, but it lacks the fine-grained control over its position within the content area.

The provided code:

<reference name="content">
    <block type="cms/block" name="BLOCKID">
        <action method="setBlockId"><block_id>BLOCKID</block_id></action>
    </block>
</reference>

Works well for applying the block to a specific section of the page, but it doesn’t let you pinpoint its exact position within the rich text content.

The Power of XML Layout Files

The key lies in using Magento’s built-in XML layout functionality. Instead of adding the block as a reference to the content area, you can use the insert function to place it at a specific point within your CMS block content.

Here’s how you do it:

  1. Navigate to your theme directory: app/design/frontend/<Vendor>/<Theme>/templates/cms/page.phtml

  2. Find the line where the rich text content is being rendered using $this->getContentHtml(). This is typically near the bottom of the file.

  3. Insert the following code immediately after the line rendering the content:

$block = $this->getLayout()->createBlock('cms/block')->setBlockId('BLOCKID');
echo $block->toHtml();

Replace 'BLOCKID' with your desired CMS block ID.

Why This Approach Works

Using this method, you’re directly interfacing with Magento’s layout engine to create and render the block. It bypasses the need for a custom layout update file, making it more efficient and cleaner.

Moreover, since you’re inserting the code within the page.phtml template, you have complete control over its position relative to your CMS content. You can place it before or after specific parts of the rich text, allowing for precise placement without needing to modify the page layout XML files.

Conclusion

In summary, to overcome this challenge:

  1. Locate and edit the page.phtml file in your theme.
  2. Find the line where the CMS content is rendered.
  3. Insert the provided PHP code immediately after that line.
  4. Make sure to replace 'BLOCKID' with your actual block ID.

This approach offers a more flexible and efficient way of placing static blocks within category page content, giving you greater control over their appearance without having to resort to complex layout updates.

For further reading on Magento’s XML layout system and various ways to customize your storefront, I recommend checking out the comprehensive guides available at Laravel Company.

Catalog Themes Configuration

Our network