Running the following SQL script directly from phpMyAdmin gives exactly what I'm expecting.
<------------ code ------------>
SELECT op.name, op.model, SUM( op.quantity ) AS quantity, SUM( op.total + op.total * op.tax /100 ) AS total
FROM oc_order_product op
LEFT JOIN oc_order o ON ( op.order_id = o.order_id )
WHERE o.order_status_id > '0'
GROUP BY op.model
ORDER BY total DESC
<------------ code ------------>
Looking into php code, it turns out that there is a bug in admin/controller/report/product_purchased.php and/or admin/model/report/product.php. After the code block
<------------ code ------------>
if (isset($this->request->get['filter_order_status_id'])) {
$filter_order_status_id = $this->request->get['filter_order_status_id'];
} else {
$filter_order_status_id = 0;
}
<------------ code ------------>
in controller product_purchased.php has been executed, $filter_order_status_id can't be null. However, in model product.php, there is the following block:
<------------ code ------------>
if (!is_null($data['filter_order_status_id'])) {
$sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
} else {
$sql .= " WHERE o.order_status_id > '0'";
}
<------------ code ------------>
This means that we never branch into the else branch. I wrote a simple vQmod fix for that.
<------------ code ------------>
SELECT op.name, op.model, SUM( op.quantity ) AS quantity, SUM( op.total + op.total * op.tax /100 ) AS total
FROM oc_order_product op
LEFT JOIN oc_order o ON ( op.order_id = o.order_id )
WHERE o.order_status_id > '0'
GROUP BY op.model
ORDER BY total DESC
<------------ code ------------>
Looking into php code, it turns out that there is a bug in admin/controller/report/product_purchased.php and/or admin/model/report/product.php. After the code block
<------------ code ------------>
if (isset($this->request->get['filter_order_status_id'])) {
$filter_order_status_id = $this->request->get['filter_order_status_id'];
} else {
$filter_order_status_id = 0;
}
<------------ code ------------>
in controller product_purchased.php has been executed, $filter_order_status_id can't be null. However, in model product.php, there is the following block:
<------------ code ------------>
if (!is_null($data['filter_order_status_id'])) {
$sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
} else {
$sql .= " WHERE o.order_status_id > '0'";
}
<------------ code ------------>
This means that we never branch into the else branch. I wrote a simple vQmod fix for that.
Didn't know if I should revive this thread of not, but here goes,
We migrated from OSC to OC, using an official extension here,
I noticed the Reports/Products/Purchased made no sense, the total moneys did but not the actual items/quantity sold,
I put it down to the migration/bug, we cleared history and tallied up all accounts.
So, we just upgraded to 154.1 from 153.1, orders have been processed since and we are faced with the same issue.
Will the vQmod fix mentioned here work for my situation?
Many thanks.
We migrated from OSC to OC, using an official extension here,
I noticed the Reports/Products/Purchased made no sense, the total moneys did but not the actual items/quantity sold,
I put it down to the migration/bug, we cleared history and tallied up all accounts.
So, we just upgraded to 154.1 from 153.1, orders have been processed since and we are faced with the same issue.
Will the vQmod fix mentioned here work for my situation?
Many thanks.
Skills: Ripp, copy, paste.
I know that in the past the report showed the total of all orders-statuses.
In my 1.4.9.x I have a modified code so it will only show the total of a certain order-status: Shipped
I have no idea if the code in the 1.5.4.x version is still the same as it was in 1.4.9.x?
Edit: Found the related topic: Order Status "Cancelled/Refund"
In my 1.4.9.x I have a modified code so it will only show the total of a certain order-status: Shipped
I have no idea if the code in the 1.5.4.x version is still the same as it was in 1.4.9.x?
Edit: Found the related topic: Order Status "Cancelled/Refund"
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
I think we are experiencing something different.
I will explain:
We are a distribution and online shop for 17 labels, so we sell CDs, Vinyl, Merch & Digital media.
So downloadable and tangible.
In Reports/Products/Purchased,
For example, 50 sales in a few hours, more or less an even spread between our latest products,
But in the Purchased totals, it states 40 sales of the same Mp3, where in fact it was really 10 CD's and 35 other products and maybe 5 of the bloated mp3's sales.
Our products are set to completed.
This is a clean install of 154.1 with our db from 153.1, upgraded and live.
This is a big issue for us, in essence we can't get a total online, nor can we see what's sold the most, basic functions that we had implemented on OSC from 2002.
I will explain:
We are a distribution and online shop for 17 labels, so we sell CDs, Vinyl, Merch & Digital media.
So downloadable and tangible.
In Reports/Products/Purchased,
For example, 50 sales in a few hours, more or less an even spread between our latest products,
But in the Purchased totals, it states 40 sales of the same Mp3, where in fact it was really 10 CD's and 35 other products and maybe 5 of the bloated mp3's sales.
Our products are set to completed.
This is a clean install of 154.1 with our db from 153.1, upgraded and live.
This is a big issue for us, in essence we can't get a total online, nor can we see what's sold the most, basic functions that we had implemented on OSC from 2002.
Skills: Ripp, copy, paste.
for all those facing the problem, i fixed it by modifying some amount of code, and i can confirm it is working for me. i am posting it here with the intention of helping someone with the same problem.
thanks for solution provided by @aurevilly.
navigate to /admin/model/report , this are the files which handles reports. you need slight modification here. in my case i was having the problem in customer, product and sale for all statuses it was not showing the record. so what i did was.
open up the corresponding file in /admin/model/report directory. for example in
customer.php line 6:
change it to
find the code in all of the files in the directory and change it to . this will solve the problem.
thanks for solution provided by @aurevilly.
navigate to /admin/model/report , this are the files which handles reports. you need slight modification here. in my case i was having the problem in customer, product and sale for all statuses it was not showing the record. so what i did was.
open up the corresponding file in /admin/model/report directory. for example in
customer.php line 6:
Code: Select all
if (!is_null($data['filter_order_status_id']))
Code: Select all
if (!empty($data['filter_order_status_id']))
Code: Select all
if (!is_null($data['filter_order_status_id']))
Code: Select all
if (!empty($data['filter_order_status_id']))
It seems the problem we were experiencing was due to OC reporting totals by model ID and not Product ID.
We only have a few models, ie; !2", MP3, WAV, 10", 7", LP, EP, but lots of different products,
So reporting by product ID solved our issues.
We only have a few models, ie; !2", MP3, WAV, 10", 7", LP, EP, but lots of different products,
So reporting by product ID solved our issues.
Skills: Ripp, copy, paste.
Who fixt it, the seller of the migration tool?
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
I know this is an old thread but I just wanted to say thanks!HATEPOLICY wrote:It seems the problem we were experiencing was due to OC reporting totals by model ID and not Product ID.
We only have a few models, ie; !2", MP3, WAV, 10", 7", LP, EP, but lots of different products,
So reporting by product ID solved our issues.
I had the same issue on a relatively new installation of 1.5.6.4 and changing this solved it
Who is online
Users browsing this forum: No registered users and 15 guests