Magento2 Attributes – Get Option Label/Text from Option ID

attributescollection;eav

Suppose I have an attribute that is a collection of option (dropdown/multiselect).

I can retrieve the attribute value for a given product:

$store_id = [something];
$productId = [something];
// this is a select/multiselect
$attribute_code = [something]; 

$option_id = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, $attribute_code, $store_id );
$option_label = ???

Now, I got the attribute option_id which is a numeric value …

… What is the best way to load the frontend attribute label for my attribute value ? (without loading the full product)

Solution thanks Marius:

// Not loading the product - just creating a simple instance
$product = Mage::getModel('catalog/product')
->setStoreId($store_id)
->setData($attribute_code,$option_id); 
$option_label = $product->getAttributeText($attribute_code);

Best Answer

In addition to your code put this:

$product = Mage::getModel('catalog/product')
                ->setStoreId($store_id)
                ->setBrand($brand_value); // not loading the product - just creating a simple instance
$brandLabel = $product->getAttributeText('brand');