Post by Ninjas-Everywhere! » Fri Jul 13, 2018 6:45 am

I have about 20 clients that are using Recurring Profiles for memberships. The profiles run just fine and when someone signs up, it all sets up just fine (using Stripe), and charges monthly like it should. The issue that I have is that the Total Sales that are reflected on the Dashboard is not being updated with the revenue generated when a Recurring Profile cycles. It is only updated when there is a new Order. If that Order is a Recurring Profile, then it's registered in the Total Sales one time and never again after that.

Using OpenCart v3.0.2.0.

Any assistance will be awesome!


Posts

Joined
Wed Feb 14, 2018 3:04 am

Post by Ninjas-Everywhere! » Thu Jul 26, 2018 4:46 am

Any ideas? Anyone?


Posts

Joined
Wed Feb 14, 2018 3:04 am

Post by straightlight » Thu Jul 26, 2018 5:14 am

One simplistic way of accomplishing your request would be to edit your admin/model/extension/dashboard/sale.php file.

Find:

Code: Select all

public function getTotalSales($data = array()) {
		$sql = "SELECT SUM(total) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0'";

		if (!empty($data['filter_date_added'])) {
			$sql .= " AND DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
		}

		$query = $this->db->query($sql);

		return $query->row['total'];
	}
replace with:

Code: Select all

public function getTotalSales($data = array()) {
		$sql = "SELECT SUM(`o`.`total`) AS `total` FROM `" . DB_PREFIX . "order` `o` LEFT JOIN `" . DB_PREFIX . "order_recurring` `or` ON (`or`.`order_id` = `o`.`order_id`) LEFT JOIN `" . DB_PREFIX . "order_recurring_transaction` `ort` ON (`ort`.`order_recurring_id` = `or`.`order_recurring_id`) WHERE `o`.`order_status_id` > '0'";

		if (!empty($data['filter_date_added'])) {
			$sql .= " AND DATE(`o`.`date_added`) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
		}

		$query = $this->db->query($sql);

		return $query->row['total'];
	}
This should resolved the issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Ninjas-Everywhere! » Mon Aug 27, 2018 1:43 am

The code worked. Thank you.


Posts

Joined
Wed Feb 14, 2018 3:04 am
Who is online

Users browsing this forum: No registered users and 48 guests