Magento - Listing all Categories in footer
I'd like to display all my available and active categories in my footer. Like her开发者_开发技巧e: http://cl.ly/242T162h1l121D0f3Y30
I know how to display at least one:
$category = Mage::getModel('catalog/layer')->getCurrentCategory()->getName();
Can you gibe me some tips? :)
Add this in the app/design/frontend/interface/theme/layout/catalog.xml
under the default tag:
<reference name="footer.menu">
<block type="catalog/navigation" name="catalog.footer" template="catalog/navigation/footer.phtml"/>
</reference>
And create a file app/design/frontend/interface/theme/template/catalog/navigation/footer.phtml
with this content:
<div id="footer-navi">
<ul class="clearfix">
<?php echo $this->renderCategoriesMenuHtml() ?>
</ul>
</div>
Afterwards, style the navigation with CSS :-)
Hope this helps...
If you are using your theme then open app/design/frontend/your_package/your_theme/template/page/html/footer.phtml and put this code
<ul class"footer">
<?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>
Create local.xml in app/design/frontend/rwd/[your-theme]/layout:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
</default>
</layout>
Add this in the app/design/frontend/rwd/[your-theme]/layout/local.xml under the default tag:
<reference name="footer">
<block type="catalog/navigation" name="catalog.footer" template="catalog/navigation/footer.phtml" />
</reference>
And create a file app/design/frontend/rwd/theme/[your-theme]/catalog/navigation/footer.phtml with this content:
<div class="links footer-navi">
<div class="block-title"><strong><span>Our products</span></strong></div>
<ul>
<?php echo $this->renderCategoriesMenuHtml() ?>
</ul>
</div>
精彩评论