2013-01-15 5 views
0

Magento 홈페이지에서 사용자 지정 범주 특성의 일부 값을 사용하여 특정 범주의 하위 범주를 나열하려고합니다. 목록이 작동하지만 맞춤 카테고리 속성에서 값을 가져올 수 없습니다.범주 페이지 외부의 사용자 지정 범주 특성 값 가져 오기

출력이 비어 있습니다. 내가 뭘 잘못하고 있니? 관련 속성은 category_subtitle 및 category_slidertext입니다.

<?php 
    $_helper = Mage::helper('catalog/category'); 
    $productsChildren = Mage::getModel('catalog/category')->getCategories(3); 
    foreach ($productsChildren as $productCat) { 
?> 
<li> 
    <div class="content-wrapper"> 
     <div class="content"> 
      <h2><?php $_category_subtitle = $productCat->getData('category_subtitle'); if($_category_subtitle): ?><span><?php echo $_category_subtitle; ?></span><?php endif; ?></h2> 
      <?php $_category_slidertext = $productCat->getData('category_slidertext'); if($_category_slidertext): ?><h3><?php echo $_category_slidertext; ?></h3><?php endif; ?> 
      <a href="<?php echo $_helper->getCategoryUrl($productCat) ?>"><?php echo $this->__('View our products') ?> &gt;</a> 
     </div> 
    </div> 
</li> 
<?php } ?> 

답변

0

시도 : $productsChildren이 카테고리 수집의 인스턴스 인 경우

$productsChildren = Mage::getModel('catalog/category')->getCategories(3,0,false,true,false); 
$productsChildren->addAttributeToSelect('category_subtitle') 
        ->addAttributeToSelect('category_slidertext'); 

가 작동합니다.

관련 문제