Magento 1.9 Static Block – How to Add Categories in a Static Block

magento-1.9static-block

How can I add categories to a static block so that I can call that block in my footer section.
enter image description here

the above image is from footer and I want to insert all my categories there.

Best Answer

Try to put this in a new file say footer_categories.phtml:

<div class="footer_categories">
          <ul>
               <?php $helper = $this->helper('catalog/category') ?>
             <?php foreach ($helper->getStoreCategories() as $_category): ?>
             <li>
                 <a href="<?php echo Mage::getModel('catalog/category')->setData($_category->getData())->getUrl(); ?>" title="<?php echo $_category->getName() ?>"><?php echo $_category->getName() ?></a>
             </li>
             <?php endforeach ?>
          </ul>

    </div>
     <?php echo $this->getChildHtml() ?>

Now open your static block and call in this way

{{block type="core/template" template="catalog/footer_categories.phtml"}}

you can get the required output.