I want to show the customer ip in the sales order grid in admin section.
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order_grid.entity_id',array('remote_ip') );
return parent::_prepareCollection();
}
But its returns:-
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sales_flat_order_grid.entity_id' in 'on clause', query was: SELECT
main_table
.*,sales_flat_order
.remote_ip
FROMsales_flat_order_grid
ASmain_table
INNER JOINsales_flat_order
ON main_table.entity_id = sales_flat_order_grid.entity_id