Php 获取类别缩略图为空
我在从商店获取分类缩略图时遇到问题,在管理面板中,它显示了添加到分类上的分类缩略图 但是当我试着在前端展示时,我不明白为什么Php 获取类别缩略图为空,php,magento,magento-1.9,Php,Magento,Magento 1.9,我在从商店获取分类缩略图时遇到问题,在管理面板中,它显示了添加到分类上的分类缩略图 但是当我试着在前端展示时,我不明白为什么 $category = Mage::getModel('catalog/category')->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('paren
$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();
?>
您必须加载集合
$category = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('parent_id', Mage::registry('current_category')->getId())
->load();
为什么要打印“
$cat[“magic_-thumbnail”]”
?对不起,这是错误的,不要把这两者都打印出来..试试img src=Mage::getBaseUrl('media').“catalog/category/”.$cat->getThumbnail()
而不是$cat->getthumbn()钉子()给了我空值