我无法从商店获取类别缩略图,在管理面板中显示了类别上添加的类别缩略图。
但是当我试图在前端展示时,给我的是无法理解为什么。
$category = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('parent_id', Mage::registry('current_category')->getId());
?>
<ul class="catblocks">
<?php
foreach ($category as $cat){
$entity_id = $cat->getId();
$name = $cat->getName();
$url_key = $cat->getUrlKey();
$url_path = $cat->getUrlPath();
$skin_url = $cat->getThumbnail();
echo '<li>
<a href="'.$url_path.'">
<img src="https://shopping.pt/media/catalog/category/'.$skin_url.'"alt="'.$name.'">
<span>'.$name.'</span>
</a>
</li>';
}
?>
</ul>
答案 0 :(得分:0)
您必须加载集合
$category = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('parent_id', Mage::registry('current_category')->getId())
->load();