Restoring Pending Order Graphs in Magento
Since upgrading from Magento 1.4 to 1.7, many users have noticed that the pending order graphs no longer display the correct information. The default behavior now only shows “processing” or “complete” orders, which excludes any orders that haven’t been invoiced yet.
If your company doesn’t process orders directly through Magento but instead uses an external ERP system for order management, you’ll find that the built-in graph becomes less useful. However, there are ways to restore this functionality and display pending order quantities and values in the dashboard once again.
Understanding the Core Changes
The core changes in Magento versions 1.6 and later focus on improving the order status tracking process. By default, only orders with a status of “processing” or “complete” will be included in the graphs. This is because these statuses indicate that the order has been invoiced and processed, providing more meaningful data for most users.
However, if your business model doesn’t follow this typical flow, you may need to modify the core functionality to better suit your needs.
Modifying the Core Code
To restore the display of pending orders in the dashboard graph, you’ll need to make changes to the Magento core code. This requires a good understanding of PHP and Magento’s architecture.
First, navigate to app/code/core/Mage/Adminhtml/Block/Dashboard/Pending.php. Open this file as it contains the logic for generating the pending order graph data.
Around line 60, you’ll find the following condition:
if (!in_array($order->getStatus(), array('pending', 'processing', 'complete'))) {
continue;
}
This code snippet is responsible for excluding any orders with a status that doesn’t match “pending”, “processing”, or “complete”. To include pending orders again, you can modify this condition to:
if (!in_array($order->getStatus(), array('pending', 'processing', 'complete')) && $order->getState() != 'canceled') {
continue;
}
The change here is that we’ve added a second condition: && $order->getState() != 'canceled'. This ensures that only non-cancelled pending orders are included in the graph.
Testing the Changes
After making this modification, save the file and clear your Magento cache. You can do this by navigating to “System” > “Cache Management” in your admin panel and selecting all the cache types (except for “Configuration”) before clicking the “Flush Cache Storage” button.
Now, when you visit your dashboard, you should see that the pending order graphs are displaying the correct information once again. The graph will include all non-cancelled orders with a status of “pending”.
Conclusion
Restoring the display of pending orders in the Magento dashboard graph requires modifications to the core code. By understanding the changes introduced in versions 1.6 and later, you can make strategic adjustments to adapt the functionality to your business model.
Remember that modifying core files should be approached with caution. Always backup your data before making any changes and ensure that you understand the implications of your modifications.
If you’re looking for more advanced customizations or need expert assistance in Magento development, consider reaching out to LaravelCompany. Our team of experienced developers specializes in Magento e-commerce solutions and can help you optimize your store’s performance and functionality.
With this modification, you should now have the pending order graphs displayed correctly in your Magento dashboard once again. The marketing department can continue using this valuable data to track incoming orders effectively.