Skip to content

TopCustomers ​

Type
Class
Namespace
craft\commerce\stats
Inherits
craft\commerce\stats\TopCustomers » craft\commerce\base\Stat
Implements
craft\commerce\base\HasStoreInterface, craft\commerce\base\StatInterface
Uses traits
craft\commerce\base\StatTrait, craft\commerce\base\StoreTrait
Since
3.0

Top Customers Stat

View source

Public Properties ​

PropertyDescription
cacheboolean
cacheDurationinteger – How long to cache the data, in seconds.
dateRangestring, null
limitinteger – Number of customers to show.
storeIdinteger, null – Store ID
typestring – Type of start either 'total' or 'average'.
weekStartDayinteger

limit ​

Type
integer
Default value
5

Number of customers to show.

View source

type ​

Type
string
Default value
'total'

Type of start either 'total' or 'average'.

View source

Protected Properties ​

PropertyDescription
_handlestring

_handle ​

Type
string
Default value
'topCustomers'

View source

Public Methods ​

MethodDescription
__construct()Stat constructor.
get()
getChartQueryOptionsByInterval()
getData()
getDateRangeInterval()
getDateRangeWording()
getEndDate()
getHandle()
getOrderStatuses()
getStartDate()
getStore()
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

Arguments ​

Throws ​

getData() ​

View source

Returns ​

mixed

getHandle() ​

View source

prepareData() ​

View source

Arguments ​

  • $data (mixed)

Returns ​

mixed

Protected Methods ​

MethodDescription
_createChartQuery()
_createStatQuery()Generate base stat query