Try the Demo

Magento Forum

   
Show all category links at static block
 
vijay_gst
Jr. Member
 
Total Posts:  4
Joined:  2012-12-17
 

Hii friends, I want to show all categories in static block at my shop page.Help me Thanks in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lyonscg
Sr. Member
 
Avatar
Total Posts:  173
Joined:  2009-11-13
Chicago IL
 

You will need to call a phtml file into the static block:

{{block type="core/template" template="YOUR_PHTML_FILE"}}

Replace “YOUR_PHTML_FILE” with the path to your phtml file from the app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template directory.

For example, let’s say you have your phtml file named “test.phtml” in the template/page/html directory, you would replace “YOUR_PHTML_FILE” with “page/html/test.phtml”

Once that is done, add the following code to your phtml file:

<?php 
    $_helper 
Mage::helper('catalog/category');
    
$_categories $_helper->getStoreCategories();
    
    if (
count($_categories) > 0)
    
{
        
foreach($_categories as $_category)
        
{
            
echo $_category->getName().'<br />';
        
}
    }
?>

You should now have a list of all top level categories. If you want to show root and sub categories, look at this site: http://magentosnippet.blogspot.com/2011/06/getting-all-top-and-sub-categories-in.html

With a little tweaking you can get this to work in your phtml file instead of the top.phtml file.

I hope this helps

 Signature 

Andrew J.
Sr. Applications Engineer
Lyons Consulting Group

Lyons Consulting Group is the premier digital agency specializing in strategy, ux/design, development, and ongoing support. With a proven track record to deliver creative, robust and most importantly, increasingly profitable ecommerce sites, our diverse group of experts are committed to customer satisfaction and project excellence.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top