I want to display customer name based on customer id in my custom module grid column.

Currently customer id only showing in the grid column. Please check attached image. enter image description here


You can do this by adding renderer in you column. here is the example.

In your _prepareColumns() function of the Grid.php file add renderer in your Seller column

    protected function _prepareColumns() {
   //other columns data
  $this->addColumn('seller_id', array(
    'header'    => Mage::helper('adminhtml')->__('Seller Name),
    'align' => 'center',
    'index'     => 'seller_id',
    'type'  => 'text',
    'renderer' => 'Namespace_ModuleName_Block_Adminhtml_Seller_Grid_Renderer_SellerName',     

Create SellerName.php file in this location


and Add this code.

class Namespace_ModuleName_Block_Adminhtml_Seller_Grid_Renderer_SellerName extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
          public function render(Varien_Object $row)
             return "your logic here to return seller name."

Replace Namespace_ModuleName with your Namespace and ModuleName.

| improve this answer | |
  • But in this case search by name not working . Only search by id is working – Hussain Jan 11 '18 at 6:24
  • For that you have to add 'filter_condition_callback' option in column in grid.php file. – Rakesh Varma Jan 11 '18 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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