如何在magento主页上仅显示主要类别图像?

时间:2014-03-05 07:15:15

标签: php magento-1.7

我想在主页上显示图像的所有主要类别。我为此编写了以下代码,但它不是显示图像。

    <?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; ?>

1 个答案:

答案 0 :(得分:0)

试试这个

  give the path for src in the img tag as src="<?php echo '/media/catalog/category/'.$_categoryThumb; ?>"