我一直在尝试完成这项工作,但没有运气,基本上我需要在内容块上显示主菜单类别,我做到了,但现在我需要在内容块内的类别名称旁边显示缩略图类别。我在 app/desing/fronend/default/THEME/template/catalog/navigation/category_listing.php 中创建了一个新的自定义模块,如下所示:
<div class="box layered-nav">
<div class="head">
</div>
<div class="border-creator">
<div class="narrow-by">
<dl id="narrow-by-list">
<dd>
<ol>
<?php foreach ($this->getStoreCategories() as $_category): ?>
<dt>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="active"<?php endif ?>><?php echo $this->htmlEscape($_category->getName()) ?>
<img src="<?php echo $_category->getThumbnailUrl() ?>" width="100" height="100" style="background:red; height: 100px; width: 100px; display: block" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
</a>
</dt>
<?php endforeach ?>
</ol>
</dd>
</dl><script type="text/javascript">decorateDataList('narrow-by-list')</script>
</div>
</div>
</div>
然后我将它添加到 app/code/core/Mage/Catalog/model/Categorie.php
public function getThumbnailUrl()
{
$url = false;
if ($image = $this->getThumbnail()) {
$url = Mage::getBaseUrl('media').'catalog/category/'.$image;
}
return $url;
}
任何想法为什么不拉和显示图像?我已经使用管理面板添加到类别,清除缓存并刷新数据,有什么想法吗?