我有蜜蜂試圖使這項工作,但沒有運氣,基本上我需要顯示內容塊上的主菜單類別,我做了,但現在我需要在內容塊內顯示類別名稱旁邊的縮略圖分類。我創建的應用程序/德興/ fronend /默認/主題/模板/目錄/導航/ category_listing.php,看起來像內一個新的自定義模塊:如何使用Magento中的getThumbnailUrl()從類別中顯示縮略圖
<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>
然後我加入到這個應用程序/代碼/核心/法師/目錄/型號/ Categorie.php
public function getThumbnailUrl()
{
$url = false;
if ($image = $this->getThumbnail()) {
$url = Mage::getBaseUrl('media').'catalog/category/'.$image;
}
return $url;
}
任何想法,爲什麼不拉和顯示圖像?我已經添加到使用管理面板的類別,清除緩存並刷新數據,任何想法?