1

Currently, only first name show on 'Customers -> Manage Customers' admin page if there are a lot of same first name user, it's hard to find right customer at once

How can I make show last name on 'Manage Customers' admin page? Between Name and Email column

(last name should be also searchable like other field)

4
  • are you talk about customer grid?
    – Amit Bera
    Commented Aug 29, 2014 at 8:51
  • Customers -> Manage Customers menu , Is it called customer grid?
    – Yohan
    Commented Aug 29, 2014 at 8:52
  • I have give answers with steps.
    – Keyul Shah
    Commented Aug 29, 2014 at 8:55
  • thethirdmoon,this called customer grid
    – Amit Bera
    Commented Aug 29, 2014 at 8:56

2 Answers 2

4

As per Magento Standard.

In Manage Customer Grid you can see the Full name with Prifix FirstName LastName.

You have to override the Customer Grid and Add new Field In grid.

Step 1: app\code\core\Mage\Adminhtml\Block\Customer\Grid.php Copy this file to app\code\local\Mage\Adminhtml\Block\Customer\Grid.php.

Step 2: Find _prepareColumns() method in this file.

Step 3: added below code.

  $this->addColumn('firstname', array(
        'header'    => Mage::helper('customer')->__('First Name'),
        'index'     => 'firstname'
    ));
    $this->addColumn('lastname', array(
        'header'    => Mage::helper('customer')->__('Last Name'),
        'index'     => 'lastname'
    ));

Step 4 : and comment below lines.

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

Step 5: You can search with now Name and LastName also.

There is another way is also you can override the Mage_Adminhtml_Block_Customer_Grid and added this filed also.

Thanks let me if any question.

1
  • It works like a charm! and easy step by step guide!! Great Solution Thank you so much! :)
    – Yohan
    Commented Aug 29, 2014 at 9:03
1

As you customer grid collection comes from Mage::getResourceModel('customer/customer_collection') ->addNameToSelect()h then this collection will consist of firstname and lastname in collection then you can first name and list name easily

just copy

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

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

add this code in _prepareColumns()

$this->addColumn('lastname', array(
            'header'    => Mage::helper('customer')->__('Last Name'),
            'index'     => 'lastname'
        ));
3
  • Can I know what file and line I have to add that code? Thank you Amit!!
    – Yohan
    Commented Aug 29, 2014 at 8:53
  • in grid.php _prepareColumns function after $this->addColumn('email', array( 'header' => Mage::helper('customer')->__('Email'), 'width' => '150', 'index' => 'email' ));
    – Amit Bera
    Commented Aug 29, 2014 at 8:55
  • Solved! Thank you!
    – Yohan
    Commented Aug 29, 2014 at 9:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.