1

This question already has an answer here:

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)

marked as duplicate by Fabian Schmengler, Marius Feb 15 '15 at 8:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • are you talk about customer grid? – Amit Bera Aug 29 '14 at 8:51
  • Customers -> Manage Customers menu , Is it called customer grid? – Moon Aug 29 '14 at 8:52
  • I have give answers with steps. – Keyul Shah Aug 29 '14 at 8:55
  • thethirdmoon,this called customer grid – Amit Bera Aug 29 '14 at 8:56
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.

  • It works like a charm! and easy step by step guide!! Great Solution Thank you so much! :) – Moon Aug 29 '14 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'
        ));
  • Can I know what file and line I have to add that code? Thank you Amit!! – Moon Aug 29 '14 at 8:53
  • in grid.php _prepareColumns function after $this->addColumn('email', array( 'header' => Mage::helper('customer')->__('Email'), 'width' => '150', 'index' => 'email' )); – Amit Bera Aug 29 '14 at 8:55
  • Solved! Thank you! – Moon Aug 29 '14 at 9:04

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