2014-10-13 31 views
1

我添加了一個標籤爲'custom_filter'的自定義下拉類別屬性,它只有兩個值'yes'和'no'。我如何在.phtml文件中獲得它的價值?如何返回magento中category屬性的下拉值

我試圖像

Mage::getModel('catalog/category')->load($store_id)->getAttribute('custom_filter'); 

$categories = Mage::getModel('catalog/category')->getCollection()->getAttributes('custom_filter'); 

我知道這些都是不正確的代碼,所以請給它的一些提示。謝謝!

回答

2

這應該這樣做。

$category = Mage::getModel('catalog/category')->load($categoryId); 
echo $category->getResource()->getAttribute($attributeCode)->getFrontend()->getValue($category); 
+0

非常感謝!有用!但它總是返回不,即使我把它設置爲是。 –