2014-12-18 3 views
0

드롭 다운에서 magento 속성 값을 얻으려면 어떻게해야합니까? yes 또는 no 옵션과 다중 값 드롭 다운?마젠타 색 속성 드롭 다운 값

내가 아는 한 - 단일 텍스트이하여 값을 얻을 것이다 :

<?php $designer = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('brands'); ?> 

감사합니다.

답변

0

당신은 다음과 같이 수행 할 수 있습니다

... 
$attrCode = 'color'; 
$storeid = Mage::app()->getStore()->getStoreId(); 
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attrCode); 
$attr_id = $attribute->getId(); 
$values = array(); 
$valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection') 
    ->setAttributeFilter($attr_id) 
    ->setStoreFilter($storeid, false) 
    ->load(); 
foreach ($valuesCollection as $item) { 
    $values[$item->getId()] = $item->getValue(); 
} 
var_dump($values); // prints that attribute values as array 
... 

그것은 당신을 도울 것입니다 바랍니다.

0

당신은 다음과 같이 코드를 작성해야합니다

$attribute_code = "color"; 
    $attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code); 
    $options = $attribute_details->getSource()->getAllOptions(false); 
    foreach($options as $option){ 
    echo $option["label"]; 
    }