how to display thumbnail from category using getThumbnailUrl() in Magento

后端 未结 3 912
轮回少年
轮回少年 2021-01-24 07:03

I have bee trying to make this work but had no luck, Basically I need to display the main menu categories on the content block and I did, but now I need to display the thumbnail

3条回答
  •  臣服心动
    2021-01-24 07:56

    Use this below function to display category thumbnail image

       public function getThumbnailImageUrl() 
       {
          $url = false;
    
          if ($image = $this->getThumbnail()) {
    
             $url = Mage::getBaseUrl('media').'catalog/category/'.$image;
          }
          return $url;
       }
    

    Then, using for any category :

    $_imageUrl=$this->getCurrentCategory()->getThumbnailImageUrl()

    you can get the thumbnail image.

    Refer this article http://www.douglasradburn.co.uk/getting-category-thumbnail-images-with-magento/

提交回复
热议问题