Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2015 09:11
Show Gist options
  • Save anonymous/fffc310cffb3a1041c23 to your computer and use it in GitHub Desktop.
Save anonymous/fffc310cffb3a1041c23 to your computer and use it in GitHub Desktop.
4 $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
5
6
7 $installer = $this;
8 $installer->startSetup();
9
10 $entityTypeId = $setup->getEntityTypeId('customer');
11 $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
12 $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
13
14
15
16 $installer->addAttribute($entityTypeId, 'kundennummer', array(
17 'type' => 'int',
18 'input' => 'text',
19 'label' => 'Sihga Kundennummer',
20 'global' => 1,
21 'visible' => 1,
22 'required' => 0,
23 'user_defined' => 0,
24 'default' => '0',
25 'visible_on_front' => 0,
26 ));
27
28 $setup->addAttributeToGroup(
29 $entityTypeId,
30 $attributeSetId,
31 $attributeGroupId,
32 'kundennummer',
33 '999' //sort_order
34 );
35 $forms = array(
36 'adminhtml_customer'
37 );
38 $attribute = Mage::getSingleton('eav/config')->getAttribute($installer->getEntityTypeId('customer'), 'kundennummer');
39 $attribute->setData('used_in_forms', $forms);
40 $attribute->save();
41
42 $installer->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment