This tutorial explains how to upgrade product attribute magento using the install script.In the previous tutorial I have explained how to create the custom product attribute.Please click here for the file structure and step by step explanation.If you want to create custom dropdown attribute with options please click here.
In the previous tutorial I have created Burn time custom dropdown attribute. Here I am upgrading the product attribute type to multiselect input type .
As the first step create the upgrade file as shown below inside your module folder.
Then change the version number from 0.1.0 to 0.2.0 in the config.xml file as shown below.
Upgrade product attribute magento
Please refer my previous tutorial. I have created dropdown attribute using the install script. Here I am changing the input type from dropdown to multiselect
<?php $installer = $this; $entityTypeId = $installer->getEntityTypeId('catalog_product'); $idAttributeOldSelect = $this->getAttribute($entityTypeId, 'product_burntime', 'attribute_id'); $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, array( 'frontend_input' => 'multiselect' )); $installer->endSetup();
Once you make changes to these files please clear the cache and navigate to the Catalog->Attribute->Manage Attribute page and refresh the page.
If you select the attribute now you can find the attribute with multiselect input type as sown below.
You can also check your core_resource table .
Table name : core_resource