I've managed to display the sub categories in my own block.

$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$categories = $category->getCollection()
      ->addAttributeToSelect(array('name', 'image'))
    ->addAttributeToFilter('is_active', 1)
    ->addAttributeToSort('position', 'asc')
<ul class="products-grid grid-type-1 column4 row">
<?php foreach ($categories as $category): ?>
   <li class="item">
        <div class="product-image-wrapper">
             <a title="<?php echo $category->getName() ?>" href="<?php echo $category->getUrl() ?>">
                <img width="300" height="300" src="<?php echo $category->getImageUrl() ?>" alt="<?php echo $this->htmlEscape($category->getName()) ?>" />
        <h2 class="product-name">
            <a title="<?php echo $category->getName() ?>" href="<?php echo $category->getUrl() ?>">
                <?php echo $category->getName() ?>
<?php endforeach; ?>

Call this block from a CMS static block and when necessary set this in the design settings in the category.

My problem is that while I was developing I had the cached turned off it was working fine, once I enabled the cache it broke, to get around this issue I've disabled the 'Blocks HTML output' in the cache management, this is only a temporary measure but this module will need to enable to help page speed

The version of Magento is Is there any fix to get around this issue.


I've created a block and overridden the getCacheKeyInfo method

public function getCacheKeyInfo()
    return array(

1 Answer 1


You don't want to disable the caching for the block, but instead implement your own block type and make sure, that the cache key contains all informations about the context - I think in your case this is only parent category?

What you want is to implement getCacheKeyInfo() on your own block class to solve this.

  • Better than mine, I am deleting my answer Jan 29, 2016 at 15:35
  • I don't have separate code for this, I just have the .phtml file which contains the code above. Can I add the code in here?
    – user9252
    Feb 1, 2016 at 11:30
  • No, but you can do it via Layout-xml as in the first example here fbrnc.net/blog/2015/06/cache-and-layout-xml-tricks Feb 1, 2016 at 14:25
  • I've created a block which extends from Mage_Core_Block_Abstract and overridden the getCacheKeyInfo method but it is not working
    – user9252
    Feb 2, 2016 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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