Skip to content

Instantly share code, notes, and snippets.

@mladenilic
Forked from anonymous/gist:fffc310cffb3a1041c23
Last active August 24, 2017 14:13
Show Gist options
  • Save mladenilic/6707beb88285084e3df3 to your computer and use it in GitHub Desktop.
Save mladenilic/6707beb88285084e3df3 to your computer and use it in GitHub Desktop.
Magento - Add customer attribute
<?php
/* @var Mage_Customer_Model_Resource_Setup $this */
$this->addAttribute('customer', 'customer_number', array(
'type' => 'int',
'input' => 'text',
'label' => 'Customer Number',
'visible' => true,
'required' => false,
'is_system' => false,
'default' => 0,
));
$attribute = Mage::getSingleton('eav/config')->getAttribute($this->getEntityTypeId('customer'), 'customer_number');
$attribute->setData('used_in_forms', array('adminhtml_customer'))
->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment