Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取类别缩略图为空_Php_Magento_Magento 1.9 - Fatal编程技术网

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()‌​钉子()给了我空值