Magento: change applied attribute product types

Sometimes it is necessary to change the product type(s) an attribute is applied to in Magento. A common example is, that you designed and implemented an attribute for a configurable product, because you thought its real world value is equal over all childĀ manifestations.
But after a while you realize, that there are differences that you have to consider. Let’s say the Magento products attributes attribute1 and attribute2 are currently applied to configurable products only. The following snippet shows, how you can achieve this within a modules setup script in Magento:

$oInstaller = $this;
/* @var $oInstaller Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */


$aAttributes = [

foreach ($aAttributes as $sCode) {


// mark index as "reindex required"
$aIndexerCodes = [

$oIndexer = Mage::getModel('index/process');
foreach ($aIndexerCodes as $sCode) {
    $oIndexer->load($sCode, 'indexer_code')


Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.