Magento - 在页脚中列出所有类别

时间:2011-07-13 09:24:42

标签: magento categories footer

我想在页脚中显示所有可用和活动的类别。像这儿: http://cl.ly/242T162h1l121D0f3Y30

我知道如何显示至少一个:

$category = Mage::getModel('catalog/layer')->getCurrentCategory()->getName();

你能给我一些提示吗? :)

3 个答案:

答案 0 :(得分:4)

在默认代码

下的app/design/frontend/interface/theme/layout/catalog.xml中添加此内容
<reference name="footer.menu">
    <block type="catalog/navigation" name="catalog.footer" template="catalog/navigation/footer.phtml"/>
</reference>

使用以下内容创建文件app/design/frontend/interface/theme/template/catalog/navigation/footer.phtml

<div id="footer-navi">
    <ul class="clearfix">
        <?php echo $this->renderCategoriesMenuHtml() ?>
    </ul>
</div>

然后,使用CSS设置导航样式: - )

希望这会有所帮助......

答案 1 :(得分:1)

如果您使用的是主题,请打开app / design / frontend / your_package / your_theme / template / page / html / footer.phtml并输入此代码

<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>

答案 2 :(得分:1)

在app / design / frontend / rwd / [your-theme] / layout中创建local.xml:

<reference name="footer">
            <block type="catalog/navigation" name="catalog.footer" template="catalog/navigation/footer.phtml" />
</reference>

在默认标记下的app / design / frontend / rwd / [your-theme] /layout/local.xml中添加:

<div class="links footer-navi">
<div class="block-title"><strong><span>Our products</span></strong></div>
    <ul>
        <?php echo $this->renderCategoriesMenuHtml() ?>
    </ul>
</div>

使用以下内容创建文件app / design / frontend / rwd / theme / [your-theme] /catalog/navigation/footer.phtml:

        Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
    photoPickerIntent.setType("image/*");
    startActivityForResult(photoPickerIntent, SELECT_PHOTO);