0

I am working with Magento 1.9.2 and i am working on a custom extension.

I have created a copy from

/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

Copy to :

/app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php

And then in the second one i was modifiyng this function:

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

To this:

protected function _prepareCollection()
{
    $collection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status',array('neq' => 'epaycc'));;
    $this->setCollection($collection);
    return parent::_prepareCollection();
}

And now i have other problem. It seems it is not showing orders with status epaycc as i wanted but now it is not showing the names for the customers who created the order. Take a look:

enter image description here

I think the problem occur because i have not set the filter right. Where is my mistake, how can i fix it and achieve what i want ?

Thanks in advance!

Venelin
  • 2,905
  • 7
  • 53
  • 117

2 Answers2

0

Try this:

protected function _prepareCollection() {
  $collection = Mage::getModel('sales/order')->getCollection();
  $collection->addFieldToFilter('status',array('neq', 'epaycc'));
  $this->setCollection($collection);
  return parent::_prepareCollection();
}
Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
Sanjay Gohil
  • 306
  • 1
  • 14
0

I tried this:

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
        // filter ty status 
    $collection ->addFieldToFilter('status',array('neq' => 'complete'));
    $this->setCollection($collection);
    return parent::_prepareCollection();
} 

and it worked perfectly, showing all the columns details.