Created
July 23, 2015 22:42
-
-
Save xyn22/72f9812557a735891649 to your computer and use it in GitHub Desktop.
Magento - add an attribute option in setup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$installer = $this; | |
$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); | |
$attr_model = Mage::getModel('catalog/resource_eav_attribute'); | |
$attr = $attr_model->loadByCode('customer', $attribute_name); | |
$attr_id = $attr->getAttributeId(); | |
$option = array('attribute_id' => $attr_id, 'values' => array(1000 => $option_label)); | |
$setup->addAttributeOption($option); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment