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 } ?>
4

1 に答える 1

0

試す:

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

$productsChildrenがカテゴリ コレクションのインスタンスである場合に機能します。

于 2013-01-15T18:07:20.227 に答える