2013-09-04 7 views
1

제품 목록보기에서 현재 사용자 정의 카테고리 속성 값을 얻는 방법은 무엇입니까? 나는이Magento - 카테고리 사용자 정의 속성 값 얻기

$attribute = Mage::getModel('catalog/category')->getAttributes(); 

같은 시도하고있다 그리고 나는 거기에 볼 수 있지만 그것을 어떻게 얻을? 이름 attribue 내 사용자 정의 catalog_pdf

또한이 방법으로 tryed

,하지만 아무것도 얻을 :이 일을해야

$attribute = Mage::getModel('catalog/category')->getAttribute('catalog_category','catalog_pdf'); 

답변

2

합니다.

$category = Mage::registry('current_category'); 
if ($category){ //this is necessary in case you are in a product listing that is's not a category 
    $value = $category->getData('catalog_pdf');//catalog_pdf is the attribute code 
    //or 
    //$value = $category->getCatalogPdf(); 
} 
+0

내 인생을 저장하고 있습니다. 정말 고맙습니다! – user2746186

0

이 작동합니다 :

$id = $this->getCurrentCategory()->getId(); 

$category = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getCode()->getId())->load($id); 
echo $category->getData('catalog_pdf'); 
//or 
echo $category->getCatalogPdf(); 

편집 누락 포함 할 제품 목록하는 int 경우 는 당신은 그래서 다음과 같이 할

Mage::registry('current_category'); 

의 현재 범주를 가져야한다

+0

이것은 나를 위해 일했습니다. – totneschap

관련 문제