Created
April 13, 2012 13:17
-
-
Save abdev/2376792 to your computer and use it in GitHub Desktop.
Magento -update product attribute backend type
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
$installer = new Mage_Eav_Model_Entity_Setup('core_setup'); | |
$entityTypeId = $installer->getEntityTypeId('catalog_product'); | |
// replace <my_attribute_code> with your attribute code | |
$idAttribute = $installer->getAttribute($entityTypeId, '<my_attribute_code>', 'attribute_id'); | |
$installer->updateAttribute($entityTypeId, $idAttribute, array( | |
'backend_type' => 'varchar' | |
)); | |
// let's see if it worked | |
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', '<my_attribute_code>'); | |
Zend_Debug::dump($attribute->getData()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist wont work! After the update you can't update the attributes through the admin anymore.