Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

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

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