Get attribute admin option value if you have option Id or store view value

I'm trying since hours but I'm not able to load the admin option value of a certain attribute. Although I have enough information like option_id and store view value:

$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product','color');
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
$attributeOptions = $attribute ->getSource()->getAllOptions();

My attribute (name: color) option table looks like

Admin      Default Store View
15            white
20            yellow
22            blue
45            green

Following gives me only the option ids:

$colorOfProduct = "white";
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product','color');
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
$attributeOptions = $attribute ->getSource()->getAllOptions();

foreach ($attributeOptions as $option) {
    if ($option['label'] == $colorOfProduct)
    echo $option['value'];

I have the Default store view value (i.e. white) and need the assigned Admin value. Unfortunately I don't get it done and appreciate every help.


Here my full solution for a certain problem. Perhaps someone can use it.

    function getImgColor($productId, $colorOfProduct)
    $optionId = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'color', 1);

    $attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product','color');
    $collection = Mage::getResourceModel('eav/entity_attribute_option_collection')

    $collection = $collection->toOptionArray();

    foreach ($collection as $option) {
        if ($option['value'] == $optionId) {
            $img = $option["label"];

    return file_exists(Mage::getBaseDir('media')."/colorall/_thumbs/color/".$img.".png") ? "<img src=\"".Mage::getBaseUrl('media')."colorall/_thumbs/color/".$img.".png\" title=\"".$colorOfProduct."\" />" : Mage::getBaseDir('media')."/colorall/_thumbs/color/".$img.".png";

For getting option value for admin

then you can get by below code and Where 0 is admin store id

$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product','color');
 $collection =Mage::getResourceModel('eav/entity_attribute_option_collection')
                echo "<pre>";
                echo "</pre>";

You need to just change store

 view ids on place of 0;

set store id before retriving value


Similar questions

The value you set has already been locked. To change the value, use the --lock-env option
I'm trying to do But I get: The value you set has already been locked. To change the value, use the --lock-env option. What does this mean and how can I achieve what I want?
How to get store information (e.g Store Base Url) of another store in a multi-store setup for Magento 2
I have multiple stores on my Magento 2 installation. So I have store 1 base url as and store 2 base url as How do i get the base url of store 2 dynamically on a phtml file in store 1. Note: $block->getBaseUrl() will only return the current store url. Is there a function like getBaseUrl of store id = 2 ?
i have Warning in my admin front view when i remove the underscore then front view is not loading as befaore
WARNING | Property name "$_template" should not be prefixed with an underscore to indicate visibility
I want to create admin grid using ui component . if you have any article or blog then please share
Issue: I am trying to create admin grid in Magento 2 but I stuck. If you have created admin grid using UI Component Then Please Share With me. Thank you
Magento 2: how to get the product attribute option label instead of option value in admin grid in custom module?
I want to show product attribute option label instead of option value in admin grid in custom module? Can any one help me in this? In magento 1 I get this suggestion and same I want in magento 2. below is the file that show static status in admin grid and I want to retrieve product attribute options and values in admin grid:- How to retrieve attrib...
How do you correctly specify a filter to get all orders that have been updated since date
I have tried to create a filter to get all updated orders since date... I got the following error I read this as ... can't use a date with a gt condition. How do I get the result I am looking for?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.