wp-e-commerce/WP-e-Commerce — pull request #760 by leewillis77 (2013-12-27 21:50:24+00:00)
Title: Various fixes for WPSC_Stats

This PR includes fixes for various issues in the stats code that were throwing errors on my local install. After these changes errors are no longer thrown and stats are generated and stored in _postmeta successfully.

The actual data itself seems flaky as anything, particularly once you start updating existing orders. That may well be because some of the changes in this PR are bad, I'll continue to investigate over the next few days.

Here's what I'm seeing with these changes applied, starting with no _wpsc_stats post meta entries.

Updating an existing (pending) order to payment accepted generates a stats figure for the product in question based on the full order history, but it doesn't seem to match what I'd expect quite - issue #1 - it seems to be one higher than I'd expect - perhaps double counting the order being updated?

Updating the same order back to "order received" results in a negative stats figure for the product (I think the values are being subtracted from the existing stats without the existing stats being lazy loaded in time?)

Anyway - this stops the code fatal erroring - more to follow another day!