cancel
Showing results for 
Search instead for 
Did you mean: 

Add Nickname to Customer grid in admin panel

Add Nickname to Customer grid in admin panel

Hello I am adding the Nickname field magento store here and share them as you have done to add a new field to Grid in the customer section of the administration panel

First go to this file into the following path:

 

app/code/core/Mage/Adminhtml/Block/Customer/Grid.php

 

and copy to the following path

 

app/code/local/Mage/Adminhtml/Block/Customer/Grid.php

 

Then add the following lines ...

 

First!!

 

->addAttributeToSelect('nickname')

 

    protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel('customer/customer_collection')
            ->addNameToSelect()
            /* Esta linea */
           ->addAttributeToSelect('nickname')
            /* Resto del codigo */
            ->addAttributeToSelect('email')
            .............

 

and this other lines....

 

 

        $this->addColumn('nickname', array(
            'header'    => Mage::helper('customer')->__('Nicname'),
            'index'     => 'nickname'
        ));

 

 

 

    protected function _prepareColumns()
    {
......
......
.......
        $this->addColumn('email', array(
            'header'    => Mage::helper('customer')->__('Email'),
            'width'     => '150',
            'index'     => 'email'
        ));

        /* Estas lineas */
        $this->addColumn('nickname', array(
            'header'    => Mage::helper('customer')->__('Nickname'),
            'index'     => 'nickname'
        ));
        /*  Hasta aqui */

 

These last lines can be changed to the position where you want it then appears the field .. I leave it after the email.


I hope they serve !!!

Cheers ...

 

 

1 REPLY 1

Re: Add Nickname to Customer grid in admin panel

and if you want to know how to make this field

 

here the link to the first post  Smiley Happy

 

https://community.magento.com/t5/Programming-Questions/Unique-nickname-on-Customer-data/m-p/27217#U2...