Skip to content

Instantly share code, notes, and snippets.

@abdev
Created April 13, 2012 13:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdev/2376792 to your computer and use it in GitHub Desktop.
Save abdev/2376792 to your computer and use it in GitHub Desktop.
Magento -update product attribute backend type
$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());
@traedamatic
Copy link

This gist wont work! After the update you can't update the attributes through the admin anymore.

@chuckdrew
Copy link

Worked for me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment