简体   繁体   中英

How to set the source for a new select type customer address attribute in magento?

Here I'm trying to add a select type customer address attribute. Can I use an array to set the option values and labels?

$newAttributeName = "adt";

$attribute  = array(
'type'          => 'int',
'input'         => 'select',
'label'         => 'Ad TYPE',
'visible'       => true,
'required'      => true,
'user_defined'  => true,
'searchable'    => true,
'filterable'    => true,
'comparable'    => true,
'visible_on_front' => true,
'source' =>  

);

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$setup->addAttribute('customer_address', $newAttributeName, $attribute);

Can someone give me a help with this?

This page has some information that might help answer your question. It's not about customer attributes, but it does discuss adding dropdown attributes to products and should point you in the right direction.

Set Dropdown Option Value of a Product

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM