Magento get option id for specified attribute set and value
magento, php
Solution
If you want to fetch the option id you do it easily just like this :
$productModel = Mage::getModel('catalog/product')->load('1234', 'sku');
$attr = $productModel->getResource()->getAttribute("color");
if ($attr->usesSource()) {
echo $color_id = $attr->getSource()->getOptionId("Red");
}
For details you can check this link
Problem
I've been searching for hours now and haven't found any solution to this problem. I need to get the option ID for a configurable product. The current informations I have are the SKU, the attribute set ID and the option label. How can I fetch the option ID using these values? Many thanks to those who can help me. ** UPDATE ** Here's a sample of the database table eav_attribute_option_value (from wich I'm guessing Magento take the value for the ID) ``` value_id option_id store_id value 729141 57 0 Rose 729142 57 3 Rose 729143 57 1 Pink 728847 749 0 Pink 728848 749 3 Pink 728849 749 1 Pink ``` I need to get the value ID 57. When the locale is in french, I get the right value. But when I switch to english, I get the ID 749, which is from another attribute set.