2014-03-05 76 views
0

我想要显示主页上的所有主要类别与图像。我为达特写下面的代码,但它不是显示图像。如何在magento主页上显示主要类别图像?

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

试试这个

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