Try the Demo

Magento Forum

   
Displaying Gender on Admin Customer Grid problem
 
RioModa
Jr. Member
 
Total Posts:  6
Joined:  2010-06-25
 

I am trying to display the Gender attribute in a new column on the admin customer grid.

I have modified /public_html/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php to show gender by:

protected function _prepareCollection()
    
{
        $collection 
Mage::getResourceModel('customer/customer_collection')
            ->
addNameToSelect()
            ->
addAttributeToSelect('email')
            ->
addAttributeToSelect('created_at')
            ->
addAttributeToSelect('gender')
            ->
joinAttribute('billing_postcode''customer_address/postcode''default_billing'null'left')
            ->
joinAttribute('billing_city''customer_address/city''default_billing'null'left')
            ->
joinAttribute('billing_telephone''customer_address/telephone''default_billing'null'left')
            ->
joinAttribute('billing_region''customer_address/region''default_billing'null'left')
            ->
joinAttribute('billing_country_id''customer_address/country_id''default_billing'null'left');
and
$this->addColumn('gender', array(
            
'header'    => Mage::helper('customer')->__('Gender'),
            
'align'     => 'center',
            
'index'     => 'gender'
        
));

When I then view this in admin I can only see the option_id not the value, so the column displays a number instead of the text (1 instead of ‘Male’)

Does anyone know how to display the value text instead?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top