How do I set an option in a dropdown attribute as the default? I am adding the options to an existing attribute with this code where $aName is an array of names.
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$aName = array("Name1", "Name2");
$aOption = array();
$aOption['attribute_id'] = $attr_id;
for($iCount=1;$iCount<sizeof($aName);$iCount++){
$aOption['value']['option'.$iCount][0] = $aName[$iCount];
$aOption['order']['option'.$iCount] = $iCount ;
}
$installer->addAttributeOption($aOption);
$installer->endSetup();
I think the answer is in Stackoverflow here but I don't know how to apply it. In my case the Attribute exists, I'm just updating the option list and setting the default.