2013-08-04 2 views
1

모든 의미 목록을 "color"속성으로 가져와야합니다.Magento - 모든 속성 값을 얻으십시오

(
     [0] => Array 
      (
       [value] => 6 
       [label] => blueAdmin 
      ) 
     [1] => Array 
      (
       [value] => 5 
       [label] => coralAdmin 
      ) 
     [2] => Array 
      (
       [value] => 3 
       [label] => redAdmin 
      ) 
     [3] => Array 
      (
       [value] => 4 
       [label] => limeAdmin 
      ) 
    ) 

이 웹 사이트의 행정부의 일부에 표시되는 모든 의미의 목록입니다 : 그 경우이 코드를

$name='color'; 
$attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter($name)->getFirstItem(); 
$attributeId = $attributeInfo->getAttributeId(); 
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId); 
$attributeOptions = $attribute ->getSource()->getAllOptions(false); 

을 사용할 때 목록의 종류를 얻을. 웹 사이트의 관리 부분이 아닌 상점에 표시되는 속성의 모든 의미 목록을 얻으려면 어떻게해야합니까?

감사합니다.

답변

2

당신은

$attributeOptions = $attribute->setStoreId(1)->getSource()->getAllOptions(false); 

는 ID 1과 상점에 대한 옵션 값을 얻는다, 예를 들어, 호출 getAllOptions()하기 전에 속성의 저장소 ID를 설정하여 특정 저장소에 대한 속성 옵션 값을 얻을 수 있습니다. 당신은 함께 현재 가게의 ID를 얻을 수

Mage::app()->getStore()->getId(); 

그래서 이런 일이 당신이 원하는 걸 얻을해야합니다

$storeId = Mage::app()->getStore()->getId(); 
$attributeOptions = $attribute->setStoreId($storeId)->getSource()->getAllOptions(false); 
관련 문제