Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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());

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

Worked for me! Thanks!

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