Skip to content

Stat ​

Type
Abstract Class
Namespace
craft\commerce\base
Inherits
craft\commerce\base\Stat
Implements
craft\commerce\base\HasStoreInterface, craft\commerce\base\StatInterface
Uses traits
craft\commerce\base\StatTrait, craft\commerce\base\StoreTrait
Extended by
craft\commerce\stats\AverageOrderTotal, craft\commerce\stats\NewCustomers, craft\commerce\stats\RepeatCustomers, craft\commerce\stats\TopCustomers, craft\commerce\stats\TopProductTypes, craft\commerce\stats\TopProducts, craft\commerce\stats\TopPurchasables, craft\commerce\stats\TotalOrders, craft\commerce\stats\TotalOrdersByCountry, craft\commerce\stats\TotalRevenue
Since
3.0

Stat

View source

Public Properties ​

PropertyDescription
cacheboolean
cacheDurationinteger – How long to cache the data, in seconds.
dateRangestring, null
storeIdinteger, null – Store ID
weekStartDayinteger

Protected Properties ​

PropertyDescription
_handlestring

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 ​

get() ​

View source

Returns ​

mixed

Throws ​

getChartQueryOptionsByInterval() ​

View source

Arguments ​

  • $interval

getDateRangeInterval() ​

View source

getDateRangeWording() ​

View source

getEndDate() ​

View source

Returns ​

mixed

getHandle() ​

View source

getOrderStatuses() ​

Since
4.2.0

View source

Returns ​

array, null

Throws ​

getStartDate() ​

View source

Returns ​

mixed

prepareData() ​

View source

Arguments ​

  • $data (mixed)

Returns ​

mixed

setEndDate() ​

View source

Arguments ​

  • $date

setOrderStatuses() ​

Since
4.2.0

Set order statuses to limit stat query. Accepts array of OrderStatus models, handle strings or uid strings.

View source

Arguments ​

Returns ​

void

setStartDate() ​

View source

Arguments ​

  • $date

Protected Methods ​

MethodDescription
_createChartQuery()
_createStatQuery()Generate base stat query

_createChartQuery() ​

View source

Arguments ​

Returns ​

array, null

Throws ​

_createStatQuery() ​

Generate base stat query

View source