Exporting Order Items is slow with a Date Range
We have an xcart 4.1.12 running on PHP5.6 MySQL 5.1.73 (soon to be upgraded)
In this xcart we can export all orders and all order items in one go, and it works. But if we add a date range by searching for orders and ticking export to csv (in this example, 1 year (10,000 orders)) it didn't work.
To be more specific, it exported the orders but when it got to order items it just stopped at "Exporting order items..."
So I've looked at the code and I found out why this was happening - for every loop of func_export_get_row, its executing a query to get the entire orders list for that date range which is slowing it down.
I've made some changes to include/export.php to solve this (diff is attached). With the change the page hangs for about 2 minutes on "Exporting order items..." and then continues.
I was hoping for some feedback on this change because this bit of code is still the same in xcart 4.7.6 (although it has moved to func.export.php).
Custom X-Cart design and functions
Combine all your eCommerce channels in your existing website admin
+44 (0)1302 325 032