In sales/orders is it possible to hide completed orders ? using something like filters.
or can I filter the status column with more than one status ?
In sales/orders is it possible to hide completed orders ? using something like filters.
or can I filter the status column with more than one status ?
<events>
<sales_order_grid_collection_load_before>
<observers>
<vendor_module_salesgrid>
<model>module/observer</model>
<method>filterGrid</method>
</vendor_module_salesgrid>
</observers>
</sales_order_grid_collection_load_before>
</events>
Then in your module/Model/Observer.php
<?php
class Vendor_Module_Model_Observer
{
public function filterGrid(Varien_Event_Observer $observer)
{
$collection = $observer->getOrderGridCollection();
$collection->addFieldToFilter('status',array('neq', 'complete'));
}
}
Magento sales order grid collection generate from Mage_Adminhtml_Block_Sales_Order_Grid
at class _prepareCollection
function.
you need to modify the collection from here.
So you need to override that class
<?php
class [ModuleNameSpace_ModuleName]_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
// filter ty status
$collection ->addFieldToFilter('status',array('neq', 'complete'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
}