LLMS_Analytics_Discounts_Widget::set_query()


Source Source

File: includes/admin/reporting/widgets/class.llms.analytics.widget.discounts.php

	public function set_query() {

		global $wpdb;

		$this->set_order_data_query(
			array(
				'query_function' => 'get_var',
				'select'         => array(
					'SUM( cp_val.meta_value )',
				),
				'joins'          => array(
					"JOIN {$wpdb->postmeta} AS cp ON orders.ID = cp.post_id",
					"JOIN {$wpdb->postmeta} AS cp_val ON orders.ID = cp_val.post_id",
				),
				'statuses'       => array(
					'llms-active',
					'llms-completed',
				),
				'wheres'         => array(
					" AND cp.meta_key = '_llms_coupon_used'",
					" AND cp.meta_value = 'yes'",
					" AND cp_val.meta_key = '_llms_coupon_value'",
				),
			)
		);

	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.