I have defined a lastname2
attribute for customer and customer_address, it shows up correctly in all forms, but when I'm creating a new address, its does not get 'prefilled' with the customer's value.
Any clues on how to do it?
The definition of my fields:
$entityAttributes = array(
'customer'=>array(
'lastname2' => array(
'store_label'=>'Apellido Materno',
'label' => 'Apellido Materno',
'input' => 'text',
'type' => 'varchar',
//System = False and visible true = Show in 'customer_account_create', 'customer_account_edit', 'checkout_register'
'system'=>true,
'visible'=>true, //Watch out!! Only visible fields get processed by the form controllers!!!
'user_defined'=>false,
'used_in_forms' => array('adminhtml_customer', 'customer_account_edit', 'checkout_register','customer_account_create'),
'required' => 0,
'position' =>69
),),
'customer_address'=> array(
'lastname2' => array(
'store_label'=>'Apellido Materno',
'label' => 'Apellido Materno',
'input' => 'text',
'type' => 'varchar',
//System = False and visible true = Show in 'customer_account_create', 'customer_account_edit', 'checkout_register'
'system'=>false,
'visible'=>true, //Watch out!! Only visible fields get processed by the form controllers!!!
'user_defined'=>false,
'used_in_forms' => array('customer_account_create','customer_register_address','customer_address_edit','adminhtml_customer_address','adminhtml_customer'),
'required' => 0,
'position' =>49
),
),
);
# Install Attributes
foreach($entityAttributes as $entity=>$attributes)
{
foreach($attributes as $attribute_code=>$definition)
{
$installer->addAttribute($entity, $attribute_code, $definition);
/**
* @var Mage_Eav_Model_Config
*/
Mage::getSingleton('eav/config')
->getAttribute($entity, $attribute_code)
->setData('used_in_forms',$definition['used_in_forms'])
->save();
}
}
My config.xml (relevant extracts, the full version is here)
<global>
<!-- [...] -->
<fieldsets>
<!-- @see http://www.excellencemagentoblog.com/customer-registration-fields-magento1-6 -->
<customer_account>
<lastname2>
<create>1</create>
<update>1</update>
<name>1</name>
<to_quote>customer_lastname2</to_quote>
<to_customer_address>lastname2</to_customer_address>
<to_customer_address>customer_lastname2</to_customer_address>
</lastname2>
</customer_account>
<customer_address>
<lastname2>
<to_quote_address>*</to_quote_address>
</lastname2>
</customer_address>
</fieldsets>
<!-- [...] -->
</global>