Checking the eav_attribute
table for the attribute group_id
you can see the source model
(The class that returns the options for the dropdown) is customer/customer_attribute_source_group
.
The getAllOptions
method uses the class Mage_Customer_Model_Resource_Group_Collection
to actually get the array, so we'll rewrite that class.
In it's config.xml
you'll need the following
[...]
<global>
[...]
<models>
<customer_resource>
<rewrite>
<group_collection>[Namespace]_[Module]_Model_Customer_Resource_Group_Collection</group_collection>
</rewrite>
</customer_resource>
</models>
[...]
<global>
[...]
Now in the Model
directory create a file with path Customer/Resource/Group/Collection.php
with the following
class [Namespace]_[Module]_Model_Customer_Resource_Group_Collection extends Mage_Customer_Model_Resource_Group_Collection
{
/**
* Convert items array to array for select options
*
* rewritten from Varien_Data_Collection
*
* @param string $valueField
* @param string $labelField
* @return array
*/
public function toOptionArray($valueField='id', $labelField='name', $additional=array())
{
$res = array();
foreach ($this as $item) {
$res[] = array(
'value' => $item->getData($valueField),
'label' => "{$item->getData($labelField)} ({$item->getData('external_id')})",
);
}
return $res;
}
}
Which should return you a dropdown with the correct labels