View Single Post
  #1  
Old 10-27-2016, 04:52 AM
  ecommweb's Avatar 
ecommweb ecommweb is online now
 

Advanced Member
  
Join Date: Nov 2008
Posts: 49
 

Default 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).
Attached Files
File Type: diff xcart_include_export.diff (2.0 KB, 167 views)
__________________
www.ecommweb.co.uk
Custom X-Cart design and functions
eCommerce SEO

www.hubmaster.co.uk
Combine all your eCommerce channels in your existing website admin

+44 (0)1302 325 032
Reply With Quote