<?php
/*获取当前分类的image(如果是子分类就获取它父分类的)*/
$currentCat = Mage::registry('current_category');
//echo $currentCat->getName();
//如果是根目录则显示当前目录
if ( $currentCat->getParentId() == Mage::app()->getStore()->getRootCategoryId() ){
//当前目录id
$parentCate_id = $this->getCurrentCategory()->getId();
}else{
//当前目录的父分类id
$parentCate_id = $this->getCurrentCategory()->getParentCategory()->getId();
}
$category_img = Mage::getModel('catalog/category')->load($parentCate_id)->getImageUrl();
?>
<?php /*列表页大图*/?>
<?php if(!empty($category_img)):?>
<div class="prdbann">
<img src="<?php echo $category_img;?>" />
</div>
<?php endif;?>
Magento 获取当前分类的image(如果是子分类就获取它父分类的)
最新推荐文章于 2020-05-26 16:51:03 发布