My stab at a query above returns sensible data but the Products Purchased report shows very different results that don't account at all (and I think grouping all options for a product is fine).
One problem (but not the entire problem) is that the way that
they use 'model' (which I didn't impose) means that the values are not always unique whereas the Product Name is.
Among other things, the provided report contains SUM(op.total + op.tax), but op.tax holds tax RATE (17.5) so this should be SUM(op.total+op.total*op.tax/100)
I will implement my above query which they are happy makes sense. I find it odd that there don't appear to be other complaints about the report so can't decide whether I should add mine as a Free Extension alternative.
I make shortest query to return existing report fields correctly:
Code: Select all
SELECT
order_product.name, order_product.model,
SUM(order_product.quantity) AS Quantity,
SUM(order_product.total) AS Total,
`order`.order_status_id, order_product.product_id
FROM `order` INNER JOIN order_product ON `order`.order_id = order_product.order_id
WHERE `order`.order_status_id > 0
GROUP BY order_product.product_id
ORDER BY order_product.name