This way we can see if our product sales are on the decline, or on the incline, and what products are doing the best this month, etc!
Code is below, attached is a screenshot!
I think your added criteria is a good idea. However, the underlying Products Purchased report on which it is based is incorrect. I posted so in 'Bugs' but it was ignored.
Order_product.tax contains tax RATE so SUM(op.total + op.tax) should be SUM(op.total + op.total*op.tax/100) so Totals are all wrong (as was pointed out by my client). Also, many shops don't use model and those that do often duplicate it for different products so grouping needs to be by product_id.
I was going to provide an alternative report as a free extension and probably add criteria but, since your addition is free, it would be better incorporated into yours otherwise there will be three different versions of the same trivial report.
The changes I made to the original admin/model/report/purchased.php which now reports correctly for me were:
Change:
Code: Select all
$query = $this->db->query("SELECT op.name, op.model, SUM(op.quantity) AS quantity, SUM(op.total + op.tax) AS total FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (op.order_id = o.order_id) WHERE o.order_status_id > '0' GROUP BY model ORDER BY total DESC LIMIT " . (int)$start . "," . (int)$limit);
To:
Code: Select all
$query = $this->db->query("SELECT op.name, op.model, SUM(op.quantity) AS quantity, SUM(op.total+op.total*op.tax/100) AS total FROM `" . DB_PREFIX . "order` o INNER JOIN " . DB_PREFIX . "order_product op ON (op.order_id = o.order_id) WHERE o.order_status_id > 0 GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$start . "," . (int)$limit);
Code: Select all
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_product` GROUP BY model");
Code: Select all
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_product` GROUP BY product_id");
Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products
hardly, it has mention in the main bug threadmystifier wrote: I posted so in 'Bugs' but it was ignored.
http://forum.opencart.com/viewtopic.php ... 293#p94363
ALLEGED BUG ?! Q, It was reported to me by my client because the results are totally false and caused a minor panic.
Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products
Alleged until it can be confirmed by others. You are the first to report it since inception and that code has never changed so I'd like a second opinion. On my test store I just checked. In 5 orders, I bought 2 macbooks ($2000 each), 4 canon cameras ($100 ea), 3 ipods ($150 ea)mystifier wrote:Sorry I wasn't there when I looked.
ALLEGED BUG ?! Q, It was reported to me by my client because the results are totally false and caused a minor panic.
On my Product Purchased Report I see:
Macbook 2 4000
canon 4 400
Ipod 3 450
So far I see no issue.
Then I try your first sql from the bug report and I get:
Code: Select all
name model price Qty Orders Total order_status_id
Canon EOS 5D Product 3 100.0000 4 2 400.0000 1
iPod Classic product 20 150.0000 3 2 430.0000 1
Then I tried your final sql fix and got this:
Code: Select all
iPod Classic product 20 3 431.500000000000
Canon EOS 5D Product 3 4 400.000000000000
The standard report calculates SUM(op.total + op.tax) which simply added £17.50 to each order rather than 17.5% of it.
I acknowledge that 'model' is not unique and often duplicated in each category but this field is not a unique key and there are no guide-lines on its intended use (they didn't even particularly want it).
Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products
Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products
Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products
Code: Select all
WHERE o.order_status_id IN (1,2,3,5)
Code: Select all
WHERE o.order_status_id > '0'
The latter will included cancelled, refunded etc orders right - or have I misunderstood?
just my €0.02c
Rich
but when installed, they have no translations text,the site is in english and french, either, no text!
and my client asked if we could separate options ? have MORE details ? i'll check for the options...
VotreEspace Services Internet (Français)
VotreEspace Services Internet (english)
I am using OC 1.5.0.5, and would like to modify the Report > Product Purchased to show the product option, eg size, colour and etc.
I have purchased a 1 new extensions, and it only works for OC 1.5.1. I was wandering could anyone point me in the right direction to mod this Product Purchased with Option?
Any help would be much appreciated. Thanks
Advanced Products Purchased Report for OCv1.5.x
http://forum.opencart.com/viewtopic.php?f=124&t=44419
Users browsing this forum: No registered users and 58 guests