Totally Zenned
- Join Date:
- Apr 2006
- Location:
- London, UK
- Posts:
- 10,475
- Plugin Contributions:
- 11
Sales report 2.0
rcrosier:
Has anyone figured out the problem with the totals when you run a report for ONE manufacturer?
On my system, if I run a report for one manufacturer, for a custom date range OR a preset, some of the totals at the top include ALL records for that range, NOT just the ones for that manufacturer. Very difficult to get totals for just one manufacturer.
Does anyone else have this problem?
I looked at the code briefly, but being very green at PHP, I could not find where the problem is.I have tracked down the problem. It's in the sales report class in the build_li_totals function.
This function is very careful only to extract product line information for the products from those manufacturers that you are filtering on. Unfortunately it then goes on to extract order level information, such as discount coupons and gift certs used and shipping costs. Since these are not recorded as being associated with any particular product, neither is there a manufacturer to filter them against and they all make it into the totals.
It's very difficult to see a solution to this. Yes, there's the obvious one of trailing back to the database to examine the products in each order and apportion the order level transactions against those to which they could apply, with appropriate error handling when the information needed is no longer in the database, but this would be horrendously complicated to do.
I have a partial fix, which simply suppresses the order level transactions when the manufacturers filter is in use. Unfortunately I don't have good data to test this with, but have asked a store owner who does to take it for a test drive. If they agree, I'll post the outcome and if appropriate the code change.
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)