嗨!我正在尝试在 cms 页面上显示类别。我已经尝试了网络上的所有解决方案,但没有一个对我有用。我试过的最后一个是这个。
1.我在我的 cms 页面的内容选项卡中添加了此代码:{{block type="catalog/navigation" template="catalog/category/list.phtml"}}
2.我已经创建了 list.phtml 并将文件放在 app/design/theme-name/template/catalog/category 上。
这是我的文件的代码
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php $open = $this->isCategoryActive($_category); ?>
<?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
if ($immagine = $this->getCurrentCategory()->getImageUrl()):
?>
<div class="catalog-image">
<div>
<a href="<?php echo $this->getCategoryUrl($_category)?>">
<img src="<?php echo $immagine ?>" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="313" height="151" />
</a>
</div>
<div class="left"><h2><a href="<?php echo $this->getCategoryUrl($_category)?>"><?php echo $_category->getName()?></a></h2></div>
</div>
<?php endif; ?>
<?php endforeach; ?>
我做错了什么?谢谢 !