Total Posts: 11
Our sales fulfillment staff wanted to see different columns in the sales grid to make fulfilling orders easier. After doing a bunch of research and finding similar changes others had made, I copied:
Then I altered the new local copy of Grid.php to have a totally new _prepareCollection() as follows:
protected function _prepareCollection()
$separatorStyle = "border:0;border-bottom:1px dashed #aaa;";
$collection = Mage::getResourceModel($this->_getCollectionClass())
'skus' => new Zend_Db_Expr('group_concat(`sales/order_item`.sku SEPARATOR "<BR><BR>")'),
'names' => new Zend_Db_Expr('group_concat(`sales/order_item`.name SEPARATOR "<BR><BR>")'),
Then I altered prepareColumns() to handle the new columns from the above _prepareCollection() (I’d paste that method here as well, but it is too large for a forum post.)
After making these changes, the new fields appear in the grid on the sales->Orders grid, and the fulfillment staff began to sing my praises. However, this also broke the pagination. Our store has well over 10k orders over the years, but if you go to the sales->Orders grid, the pagination always shows page 1 of 1. If you select to show 50 orders per page, it loads and shows 50 orders, indicating page 1 of 1. If you tell it to show 200 orders per page, it shows 200 orders, indicating page 1 of 1.
If I revert my local changes to match the original core Grid.php, the pagination works as expected, but of course then my custom fields are removed from the grid.
How do I get it to paginate correctly with custom fields in that grid?