LLMS_Analytics_Sales_Widget

LLMS_Analytics_Sales_Widget class


Description Description

Locates number of active / completed orders from a given date range by a given group of students.


Top ↑

Source Source

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

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class LLMS_Analytics_Sales_Widget extends LLMS_Analytics_Widget {
 
    public $charts = true;
 
    protected function get_chart_data() {
        return array(
            'type'   => 'count',
            'header' => array(
                'id'    => 'sales',
                'label' => __( '# of Sales', 'lifterlms' ),
                'type'  => 'number',
            ),
        );
    }
 
    public function set_query() {
 
        $this->set_order_data_query(
            array(
                'query_function' => 'get_results',
                'select'         => array(
                    'orders.post_date AS date',
                ),
                'statuses'       => array(
                    'llms-active',
                    'llms-completed',
                ),
            )
        );
 
    }
 
    protected function format_response() {
 
        if ( ! $this->is_error() ) {
 
            return count( $this->get_results() );
 
        }
 
    }
 
}


Top ↑

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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