Post by rincerofwinds » Wed Mar 03, 2010 9:21 pm

Hi,

I've done a few test purchases on my site, and that all works fine. However if I cancel the order without marking it as payment received, the values are still included in the 'Total Sales' figure on the dashboard - even though the product has not been sold.

Is there anyway to get this to only include those orders marked as complete - ie the ones that have actually been sold, rather than the total value of orders placed.

Thanks
Ian

OC1.4.0

New member

Posts

Joined
Fri Oct 10, 2008 1:45 am


Post by i2Paq » Wed Mar 03, 2010 10:16 pm

I think you need to change the way the Total Sales is counted in the Stats.

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by rincerofwinds » Thu Mar 04, 2010 4:32 am

Thanks for that - any idea where/how i would go about doing it?

New member

Posts

Joined
Fri Oct 10, 2008 1:45 am


Post by i2Paq » Thu Mar 04, 2010 4:47 am

rincerofwinds wrote:Thanks for that - any idea where/how i would go about doing it?
No, sorry.

You need someone that can adjust the queries that generates the Stats.

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Qphoria » Thu Mar 04, 2010 6:31 am

I checked the function.. It already omits products that have order status of 0

The file is admin/model/sale/order.php

and find:

Code: Select all

$query = $this->db->query("SELECT SUM(total) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0'");
If you want to ignore additional status ids then you can change it to:

Code: Select all

$query = $this->db->query("SELECT SUM(total) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id NOT IN ('0', '1', '2')");
where the numbers are the ids of the order statuses you want to exclude from the total sales

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by i2Paq » Sat Dec 18, 2010 11:02 pm

To also have the total per year correct use in \admin\model\sale\order.php

Code: Select all

	public function getTotalSalesByYear($year) {
      	$query = $this->db->query("SELECT SUM(total) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id NOT IN ('0', '1', '2') AND YEAR(date_added) = '" . (int)$year . "'");

		return $query->row['total'];
	}
You can add any other Order-status to ('0', '1', '2'), to find the other status numbers use phpMyAdmin and look at the Tabel: order_status.

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by i2Paq » Sat Jan 05, 2013 1:43 am

Works also in 1.5.4.1!

I have no clue why this is not changed because cancelled orders are no sale.....

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by stokeyblokey » Sun May 31, 2015 10:24 pm

I cannot believe this wasn't incorporated into later versions. I found this old post after trying to fix the Dashboard totals in my OC1.5.6 site...

Thanks Qphoria and i2paq :)

Stokey

Stokey


User avatar
Active Member

Posts

Joined
Sat Aug 31, 2013 10:19 pm

Post by islam store » Wed Jan 22, 2020 6:34 am

Hello
I am using opencart version 3.0.3.2
I have the same problem, I followed the steps but found my codes different and I did not know how to change it
Attach the code for Version 3.0.3.2, please

Newbie

Posts

Joined
Tue Mar 14, 2017 5:06 am
Who is online

Users browsing this forum: Amazon [Bot], RiguPhoto and 201 guests