startSetup(); $attributes = array( $installer->getAttributeId('catalog_product', 'cost') ); $sql = $installer->getConnection()->quoteInto("SELECT * FROM `{$installer->getTable('catalog/eav_attribute')}` WHERE attribute_id IN (?)", $attributes); $data = $installer->getConnection()->fetchAll($sql); foreach ($data as $row) { $row['apply_to'] = array_flip(explode(',', $row['apply_to'])); unset($row['apply_to']['bundle']); $row['apply_to'] = implode(',', array_flip($row['apply_to'])); $installer->run("UPDATE `{$installer->getTable('catalog/eav_attribute')}` SET `apply_to` = '{$row['apply_to']}' WHERE `attribute_id` = {$row['attribute_id']}"); } $installer->endSetup();