i wrote custom code to assign attribute to product , issue is with dropdown attribute say color with values : red , green , yellow
not i want to set value of color to be red so i used code below
$product->setColor('red')
but it does not works as i neet to put id instead of vlaue , but i do not want to put id , can anyone help in this case