TopCustomers
- Type
- Class
- Namespace
- craft\commerce\stats
- Inherits
- craft\commerce\stats\TopCustomers » craft\commerce\base\Stat
- Implements
- craft\commerce\base\StatInterface
- Uses traits
- craft\commerce\base\StatTrait
- Since
- 3.0
Top Customers Stat
View source (opens new window)
# Public Properties
Property | Description |
---|---|
cache | boolean (opens new window) |
cacheDuration | integer (opens new window) – How long to cache the data, in seconds. |
dateRange | string (opens new window), null (opens new window) |
limit | integer (opens new window) – Number of customers to show. |
type | string (opens new window) – Type of start either 'total' or 'average'. |
weekStartDay | integer (opens new window) |
# limit
- Type
- integer (opens new window)
- Default value
5
Number of customers to show.
View source (opens new window)
# type
- Type
- string (opens new window)
- Default value
'total'
Type of start either 'total' or 'average'.
View source (opens new window)
# Protected Properties
Property | Description |
---|---|
_handle | string (opens new window) |
# _handle
- Type
- string (opens new window)
- Default value
'topCustomers'
View source (opens new window)
# Public Methods
Method | Description |
---|---|
__construct() | Stat constructor. |
get() | |
getChartQueryOptionsByInterval() | |
getData() | |
getDateRangeInterval() | |
getDateRangeWording() | |
getEndDate() | |
getHandle() | |
getOrderStatuses() | |
getStartDate() | |
prepareData() | |
setEndDate() | |
setOrderStatuses() | Set order statuses to limit stat query. Accepts array of OrderStatus models, handle strings or uid strings. |
setStartDate() |
# __construct()
Stat constructor.
View source (opens new window)
Arguments
$dateRange
(string (opens new window), null (opens new window))$type
$startDate
(DateTime (opens new window), boolean (opens new window), null (opens new window))$endDate
(DateTime (opens new window), boolean (opens new window), null (opens new window))
Throws
# getData()
View source (opens new window)
Returns
mixed
# getHandle()
View source (opens new window)
# prepareData()
View source (opens new window)
Arguments
$data
Returns
mixed
# Protected Methods
Method | Description |
---|---|
_createChartQuery() | |
_createStatQuery() | Generate base stat query |