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!

1

Try following way:


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.