我正在尝试在父类别的页面上显示子类别网格。我已按照本教程进行操作,一切正常,除了即使我已将图像分配给每个子类别,页面仍显示占位符图像而不是实际图像。
我认为 phtml 代码中的某个地方存在问题。
// Retrieve the current category and it's children
<?php
$_maincategorylisting=$this->getCurrentCategory();
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();
$_imageUrl=$cur_category->getImageUrl();
if (!$_imageUrl) : //if the image url is false set it to the placeholder
$_imageUrl = $this->getSkinUrl('images/catalog/product/placeholder/thumbnail.jpg');
endif;
/* output */ ?>
<div class="category-box">
<a href="<?php echo $this->getCategoryUrl($_category)?>">
<img src="<?php echo $_imageUrl?>" height="80">
</a>
<p><a href="<?php echo $this->getCategoryUrl($_category)?>"> <?php echo $_category->getName()?></a></p>
</div>
<?php endif;
endforeach;
$layer->setCurrentCategory($_maincategorylisting);
endif; ?>
笔记:
我正在运行 Magento v 1.6.0.0
这是我正在测试的类别页面。