i need to add 'company' attribute of customer to invoice grid. below is the code i change and its showing correct query results in phpmyadmin, but somehow it only shows 2 as a Total records on Invoice grid.
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinInner(array('order_address' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order_address')),'order_address.parent_id = main_table.order_id',array('company'))->group('parent_id')->order('entity_id', 'desc');
$this->setCollection($collection);
return parent::_prepareCollection();
}
and query is
SELECT `main_table`.*, `order_address`.`company` FROM `sales_flat_invoice_grid` AS `main_table` INNER JOIN `sales_flat_order_address` AS `order_address` ON order_address.parent_id = main_table.order_id GROUP BY `parent_id`
if i change the number of records to 200 per page , it shows all that records , but there is some issue in paging and total records.
It always shows 1 page and 'Total 2 records found'. So i can not move to next page.
Anye help please.
Thanks