How get all orders data in custom page in magento2
$orderDatamodel = $objectManager->get('Magento\Sales\Model\Order')->getCollection();
foreach($orderDatamodel as $orderDatamodel1){
print_r($orderDatamodel1->getData());
}
Nothing displaying. Please help me.
Best Answer
I was facing same issue but when I added
in top of the page, I got below error.
You can try below code
This is same method you are using to print data with filter and it is working fine.
There are 2 solutions, you can increase memory limit or select fields that you want in your collection.
In addition, use the $order->debug() method instead of $order->getData(). This will prevent memory leaks.