获取类别缩略图 NULL
Get category thumbnail NULL
我无法从商店获取类别缩略图,在管理面板中它显示了添加到类别中的类别缩略图。
但是当我尝试在前端显示时,却给我 null 不明白为什么。
$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>
您将必须加载集合
$category = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('parent_id', Mage::registry('current_category')->getId())
->load();
我无法从商店获取类别缩略图,在管理面板中它显示了添加到类别中的类别缩略图。
但是当我尝试在前端显示时,却给我 null 不明白为什么。
$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>
您将必须加载集合
$category = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('parent_id', Mage::registry('current_category')->getId())
->load();