Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to move the static CMS block from the category view into the sidebar. In my themename/template/catalog/category/view.phtml it is called with


Since it's defined as

   * Retrieve current category model object
   * @return Mage_Catalog_Model_Category
  public function getCurrentCategory()
      if (!$this->hasData('current_category')) {
          $this->setData('current_category', Mage::registry('current_category'));
      return $this->getData('current_category');

  public function getCmsBlockHtml()
      if (!$this->getData('cms_block_html')) {
          $html = $this->getLayout()->createBlock('cms/block')
          $this->setData('cms_block_html', $html);
      return $this->getData('cms_block_html');

I've tried adding this:

echo $this->getLayout()->createBlock('cms/block')->setBlockId(   $this->getCurrentCategory()->getLandingPage()    )->toHtml()

into my themename/template/callout/left-col.phtml file, but this throws errors.

How do I make it work?

share|improve this question
up vote 6 down vote accepted

Well, the getCurrentCategory() method is defined in the category view block Mage_Catalog_Block_Category_View, thus the left-col.phtml template doesn't have any refference to it. So instead of calling getCurrentCategory() method to get the category, you can get it from the registry: Mage::registry('current_category')

So, you can try changing your code to this:

echo $this->getLayout()->createBlock('cms/block')->setBlockId( Mage::registry('current_category')->getLandingPage() )->toHtml()
share|improve this answer
Thanks for the quick answer. This works great! – tecjam Jun 6 '14 at 8:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.