php - Magento get option id for specified attribute set and value -
i've been searching hours , haven't found solution problem. need option id configurable product. current informations have sku, attribute set id , option label. how can fetch option id using these values?
many can me.
** update **
here's sample of database table eav_attribute_option_value (from wich i'm guessing magento take value 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 value id 57. when locale in french, right value. when switch english, id 749, attribute set.
if want fetch option id :
$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 can check link
Comments
Post a Comment