我想在主页上显示图像的所有主要类别。我为此编写了以下代码,但它不是显示图像。
<?php
$_helper = Mage::helper('catalog/category');
$_categories = $_helper->getStoreCategories();
foreach ($_categories as $_category):
$_categoryThumb = $_category->getThumbnail();
echo $_category->getImageUrl();
?>
<li>
<h2> <a href="<?php echo $_helper->getCategoryUrl($_category) ; ?>">
<img src="<?php echo $this->getUrl() . 'media/catalog/category/' . $_categoryThumb; ?>" alt="<?php echo $_category->getName()?>"/>
</a>
</li>
<?php endforeach; ?>
答案 0 :(得分:0)
试试这个
give the path for src in the img tag as src="<?php echo '/media/catalog/category/'.$_categoryThumb; ?>"