1

I want to be able to filter orders "pending" and "processing" at the same time (like the last option on the image).

How would I do that?

enter image description here

4
  • Is this your custom grid? Commented Feb 27, 2020 at 9:27
  • yes, but the grid may vary to different users. so it's irrelevant.
    – Matus
    Commented Feb 27, 2020 at 9:29
  • Grid created using ui-component? If yes then add status column code in question. Commented Feb 27, 2020 at 9:31
  • use field to filter on order status collection on this option in your block then render your grid on the collection
    – Asad Ullah
    Commented Feb 27, 2020 at 12:51

1 Answer 1

0

You can get processing and pending order from order collection like this

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderCollectionFactory = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\CollectionFactory')->create();
$orderCollection = $orderCollectionFactory
                ->addAttributeToSelect("*")
                ->addFieldToFilter('status', array('in' => array('processing','pending')))
                ->setOrder('created_at','desc');

echo "<pre>";
print_r($orderCollection->getData());
echo "</pre>";

Try to use factory method instead of Object Manager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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