Magento Grid View Debug

In order to check if everything is working properly in your grid view you maybe will be willing to check that the SQL statements look as you expected:

Way to do that in Magento is $collection -> load(true); to the _prepareCollection() of the Grid view that you want to debug

Example Invoice Grid View.


protected function _getCollectionClass() {
    return 'sales/order_invoice_grid_collection';
}


protected function _prepareCollection() {
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->load(true);
    $this->setCollection($collection);
    return parent::_prepareCollection();
}

That is working for the first select but unfortunately it does not apply to the filter  values. If you want to see all filter values used per in the SQL, you can use this script:


$filter = $this->getParam('filter')
$filter_data = Mage::helper('adminhtml')->prepareFilterString($filter);
print_r($filter_data);