Try this:
$installer->addAttribute('customer', 'testveri', array(
'label' => 'Working?',
'input' => 'select',
'type' => 'int',
'required' => 0,
'user_defined' => 0,
'source' => 'eav/entity_attribute_source_table',
'option' => array('values' => array('Value 1', 'Value 2', 'Value 3'))
));
EDIT
Add the new attribute as a column in the grid.
Override the default customer grid and in _prepareColumns
add this:
protected function _prepareColumns(){
$values = array(
1 => Mage::helper('customer')->__('Yes'),
0 => Mage::helper('customer')->__('No')
);
$this->addColumnAfter('testveri', array(
'header' => Mage::helper('customer')->__('Working?'),
'index' => 'testveri',
'type' => 'options',
'options' => $values,
),'email');
return parent::_prepareColumns();
}
if you want this for all regions not only US, you need to change the method Mage_Directory_Model_Resource_Region_Collection::toOptionArray
.
Instead of this:
$options = $this->_toOptionArray('region_id', 'default_name', array('title' => 'default_name'));
you need
$options = $this->_toOptionArray('region_id', 'code', array('title' => 'code'));
If you want it only for US regions, you need to modify the data in the table directory_country_region
and directory_country_region_name
. You will identify the state names easily.
Best Answer
I tried doing this some time ago and I found that modifying the billing address and shipping address templates was a time consuming job, a big error source.
I ended up doing it with javascript. I'm not 100% sure that it covers all the possible cases but I didn't find any issue so far.
The following piece of js did the trick.
Place this in one of your js files (note: it works with jQuery only) and in the billing and shipping address templates (or in checkout/onepage.phtml) and in the mutishipping pages just add these lines: