0

In magento one could define his own CMS Block for a Category.

Question: I would like to be able to get the contents of the static block, defined for a category and use this block anywhere in my phtml layouts.

EDIT: Approaching the problem from the wrong angle. I could resolve this by using getLayout()->createBlock('cms/block')->setBlockId('category_banner')->toHtml(); ?>

Already did some searches but I was unable to find the solution so far.

In catalog/category/view.phtml we have:

<?php if ($this->isContentMode()): ?>
    <?php echo $this->getCmsBlockHtml() ?>

<?php elseif ($this->isMixedMode()): ?>
    <?php echo $this->getCmsBlockHtml() ?>
    <?php echo $this->getProductListHtml() ?>

<?php else: ?>
    <?php echo $this->getProductListHtml() ?>
<?php endif; ?>

The getCmsBlockHtml() ?> returns the CMS block defined in Category Management. This is a static block one can assign himself.

Is there a way to get this block from a layout by calling a specific method?

Rubytastic
  • 15,001
  • 18
  • 87
  • 175

1 Answers1

0
    <block type="cms/block" name="block_name">
        <action method="setBlockId"><block_id>cms_block_id</block_id></action>
    </block>
Vladimir Ramik
  • 1,920
  • 2
  • 13
  • 23