How to create multi select attribute for customer using install script?
-
31-10-2019 - |
Question
I'm following many articles but i'm not able create multi select attribute. and i'm getting following error.
a:5:{i:0;s:50:"Source model "" not found for attribute "exinent1"";i:1;s:3008:"#0 C:\wamp\www\magento8\app\code\core.
and my script is:
<?php
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$setup->addAttribute('customer', 'exinent1', array(
'input' => 'multiselect',
'type' => 'varchar',
'backend' => 'eav/entity_attribute_backend_array',
'label' => 'exinent1',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'option' => array (
'value' => array('optionone' => array('First Option'),
'optiontwo' => array('Second Option'),
'optionthree' => array('Third Option'),
)
),
));
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'exinent1',
'100'
);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'exinent1');
$oAttribute->setData('used_in_forms', array('adminhtml_customer'));
$oAttribute->save();
$setup->endSetup();
and config.xml is:
<?xml version="1.0"?>
<config>
<modules>
<Exinent_Cusatt>
<version>3.1.5.6</version>
</Exinent_Cusatt>
</modules>
<global>
<resources>
<exinent_cusatt_setup>
<setup>
<module>Exinent_Cusatt</module>
</setup>
</exinent_cusatt_setup>
</resources>
</global>
</config>
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange