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.
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.
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
app/code/{{your_code_pool}}/Namespace/ModuleName/Block/Adminhtml/Seller/Grid/Renderer/SellerName.php
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.