vensires → credited anpel → .
I encountered this issue as well.
In the process of fixing this, I also:
- Updated the order query so that it can be executed just once
- Fixed a loop on getSalesData that would run 14 * 86400 times more than needed
- Refactored getTopProducts so that it can use the new getOrders() function
- Added a few checks to ensure there will be no errors when getting top products
- Ordered top products by revenue and limited the result to top 20 (maybe this should be configurable in the future)
- Added a limit to return the top 40 most recent carts
- Updated the module dependencies
- Fixed an issue where numbers would show up with many decimal points
Here is a proposed patch.
I added the comment lines and linked to this issue. Please let me know if I should rephrase.
anpel → made their first commit to this issue’s fork.
Indeed #6 makes sense. Updated MR.
anpel → made their first commit to this issue’s fork.
Patch at #2 could not apply in version 2.4, here is an updated version.
Patch at #41 worked for me but caused issues when the view results use groupping.
Here is a modified version, it's most likely not the most performant solution but it can be a good starting point.