2011-08-01 8 views
0

Magento(バージョン1.4)カテゴリの製品リスト(list.phtml)でカスタム属性を取得するにはどうすればよいですか?list.phtmlでカスタムMagento属性を取得するにはどうすればよいですか?

私は

<action method="addAttribute"><code>format</code></action> 

list.phtml

<?php echo $_product->getAttributeText('format'); ?> 

または

<?php echo $_product->getFormat(); ?> 

にを追加することでcatalog.xmlを編集しようとしています。しかし、それは動作しません。これはどうすればできますか?

+0

の可能重複【商品一覧ページで製品の詳細説明を表示する方法?](http://stackoverflow.com/questions/6027532/how-to-display-product-detail-description-on-product -listing-page) – clockworkgeek

答えて

1

経由の属性。

$attribute = $_product->getResource()->getAttribute('unit'); 
if ($attribute){ 
    echo $attribute_value = $attribute ->getFrontend()->getValue($_product); 
} 
+0

は素晴らしい、良い仕事の仲間です。 –

関連する問題