关于php:类别未出现在magento div中

Categories not appearing in magento div

我尝试使用以下代码在magento中创建侧边栏:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php $_helper1 = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper1->getStoreCategories(false, true, false); ?>
       
            Product Categories
           
<ul>

        <?php foreach($_categories as $_category): ?>
   
<li>

    getCategoryUrl($_category); ?>">
        <p><?php echo $_category->getName(); ?></p>
   
   
</li>

  <?php endforeach; ?>              
           
</ul>

我已经将类别设置为默认类别的子类别,并且清除了缓存并完成了此处所述的修复程序:

http://www.aschroder.com/2009/03/top-3-solutions-when-your-magento-categories-are-not-displaying/

我还将它的"锚定"选项设置为"是"。

但是它仍然没有显示任何东西。

可能是什么问题?


我可以建议其他解决方案吗?

获取类别的最佳方法是使用集合:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php $_categories = Mage::getModel('catalog/category')->getCollection()
                     ->addAttributeToSelect('name')
                     ->addAttributeToSelect('is_active'); ?>
   
        Product Categories
       
<ul>

        <?php foreach($_categories as $_category): ?>
           
<li>


                getUrl();?>">
                    <p><center>[wp_ad_camp_2]</center></p><p><?php echo $_category->getName(); ?></p>
               
           
</li>

        <?php endforeach; ?>              
       
</ul>

也许这可以帮助您。