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
Public Properties ​
Property | Description |
---|---|
cache | boolean |
cacheDuration | integer – How long to cache the data, in seconds. |
dateRange | string, null |
storeId | integer, null – Store ID |
weekStartDay | integer |
Protected Properties ​
Property | Description |
---|---|
_handle | string |
Public Methods ​
Method | Description |
---|---|
__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.
Arguments ​
$dateRange
(string, null)$startDate
(DateTime, boolean, null)$endDate
(DateTime, boolean, null)$storeId
Throws ​
get()
​
Returns ​
mixed
Throws ​
getChartQueryOptionsByInterval()
​
Arguments ​
$interval
getDateRangeInterval()
​
getDateRangeWording()
​
getEndDate()
​
Returns ​
mixed
getHandle()
​
getOrderStatuses()
​
- Since
- 4.2.0
Returns ​
Throws ​
getStartDate()
​
Returns ​
mixed
prepareData()
​
Arguments ​
$data
(mixed
)
Returns ​
mixed
setEndDate()
​
Arguments ​
$date
setOrderStatuses()
​
- Since
- 4.2.0
Set order statuses to limit stat query. Accepts array of OrderStatus
models, handle strings or uid strings.
Arguments ​
$orderStatuses
(craft\commerce\models\OrderStatus[], string[], null)
Returns ​
void
setStartDate()
​
Arguments ​
$date
Protected Methods ​
Method | Description |
---|---|
_createChartQuery() | |
_createStatQuery() | Generate base stat query |
_createChartQuery()
​
Arguments ​
$select
(array)$resultsDefaults
(array)$query
(null, craft\db\Query)
Returns ​
Throws ​
_createStatQuery()
​
Generate base stat query