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());
@traedamatic

This comment has been minimized.

Show comment Hide comment
@traedamatic

traedamatic Jun 19, 2015

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

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

@chuckdrew

This comment has been minimized.

Show comment Hide comment
@chuckdrew

chuckdrew Apr 22, 2016

Worked for me! Thanks!

Worked for me! Thanks!

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