Search code examples
zend-framework2magento-1.9

How to show categories on cms home page slider in magento 1.9 ?


I am trying to show my categories in home page within a slider, that redirects to the relevant category page ?


Solution

  • Ist you need to create a custom Phtml file then use this code

    <?php 
    $_helper = Mage::helper('catalog/category');
    $_categories = $_helper->getStoreCategories();
    if (count($_categories) > 0){
        foreach($_categories as $_category){
            $_category = Mage::getModel('catalog/category')->load($_category->getId());
            $_subcategories = $_category->getChildrenCategories();
            if (count($_subcategories) > 0){
                echo $_category->getName();
                echo $_category->getId();      
                foreach($_subcategories as $_subcategory){
                     echo $_subcategory->getName();
                     echo $_subcategory->getId();
                }
            }
        }
    }
    ?>
    

    Call it on your homepage then you can easily do HTML and slider what you want if you want more help you can ask me