Show Magento Shop Categories as Left Column Side Menu

Show your Magento Shop Categories as a Left Column Side Menu:

Customize the built in RWD template and add a shop categories menu listing to your magento store. Make your shop categories show up as side bar menu items automatically. Connect to your magento shop using SSH, with Putty. On the console, use VIM to edit the files. Insert the following snippets of code into your template PHTML files.

./app/design/frontend/rwd/default/template/page/html/sidemenu.phtml


<?php $_helper = Mage::helper('catalog/category') ?>

<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
    <ul>
        <?php foreach($_categories as $_category): ?>
            <li>
                <a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
                    <?php echo $_category->getName() ?>
                </a>
                <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
                <?php $_subcategories = $_category->getChildrenCategories() ?>
                <?php if (count($_subcategories) > 0): ?>
                    <ul>
                        <?php foreach($_subcategories as $_subcategory): ?>
                            <li>
                                <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
                                    <?php echo $_subcategory->getName() ?>
                                </a>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>


Add this line to page.xml in the 3column section:
./app/design/frontend/rwd/default/layout/page.xml

<block type="page/html" name="sidemenu" as="sidemenu" output="toHtml" template="page/html/sidemenu.phtml" />

In your 2columns-left.phtml template:
...
                <div class="col-left sidebar">Shop Menu<?php echo $this->getChildHtml('left'); ?>
                     <?php echo $this->getChildHtml('sidemenu') ?>
                </div>
...

...
                <div class="col-left sidebar">Shop Menu<?php echo $this->getChildHtml('left'); ?>
                     <?php echo $this->getChildHtml('sidemenu') ?>
                </div>
...


Source: Stackexchange
https://magento.stackexchange.com/questions/38449/list-all-categories-in-footer

Comments

Popular posts from this blog

Microsoft Visio 2010 Premium Product Keys

Mercedes Benz Diesel CDI EGR Emulator Circuit Diagrams

Fix: The Diagnostic Service Host service failed to start due to the following error. [ solved, no kidding ]