本文整理汇总了PHP中Thelia\Model\OrderQuery::getMonthlySaleStats方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderQuery::getMonthlySaleStats方法的具体用法?PHP OrderQuery::getMonthlySaleStats怎么用?PHP OrderQuery::getMonthlySaleStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Model\OrderQuery
的用法示例。
在下文中一共展示了OrderQuery::getMonthlySaleStats方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStatus
/**
* @param int $month
* @param int $year
* @return \stdClass
*/
protected function getStatus($month, $year)
{
$data = new \stdClass();
$data->title = $this->getTranslator()->trans("Stats on %month/%year", ['%month' => $month, '%year' => $year], HookAdminHome::DOMAIN_NAME);
$data->series = [];
/* sales */
$data->series[] = $saleSeries = new \stdClass();
$saleSeries->color = self::testHexColor('sales_color', '#adadad');
$saleSeries->data = OrderQuery::getMonthlySaleStats($month, $year);
$saleSeries->valueFormat = "%1.2f " . Currency::getDefaultCurrency()->getSymbol();
/* new customers */
$data->series[] = $newCustomerSeries = new \stdClass();
$newCustomerSeries->color = self::testHexColor('customers_color', '#f39922');
$newCustomerSeries->data = CustomerQuery::getMonthlyNewCustomersStats($month, $year);
$newCustomerSeries->valueFormat = "%d";
/* orders */
$data->series[] = $orderSeries = new \stdClass();
$orderSeries->color = self::testHexColor('orders_color', '#5cb85c');
$orderSeries->data = OrderQuery::getMonthlyOrdersStats($month, $year);
$orderSeries->valueFormat = "%d";
/* first order */
$data->series[] = $firstOrderSeries = new \stdClass();
$firstOrderSeries->color = self::testHexColor('first_orders_color', '#5bc0de');
$firstOrderSeries->data = OrderQuery::getFirstOrdersStats($month, $year);
$firstOrderSeries->valueFormat = "%d";
/* cancelled orders */
$data->series[] = $cancelledOrderSeries = new \stdClass();
$cancelledOrderSeries->color = self::testHexColor('cancelled_orders_color', '#d9534f');
$cancelledOrderSeries->data = OrderQuery::getMonthlyOrdersStats($month, $year, array(5));
$cancelledOrderSeries->valueFormat = "%d";
return $data;
}
示例2: loadStatsAjaxAction
public function loadStatsAjaxAction()
{
if (null !== ($response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW))) {
return $response;
}
$data = new \stdClass();
$data->title = $this->getTranslator()->trans("Stats on %month/%year", array('%month' => $this->getRequest()->query->get('month', date('m')), '%year' => $this->getRequest()->query->get('year', date('Y'))));
/* sales */
$saleSeries = new \stdClass();
$saleSeries->color = $this->getRequest()->query->get('sales_color', '#adadad');
$saleSeries->data = OrderQuery::getMonthlySaleStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
/* new customers */
$newCustomerSeries = new \stdClass();
$newCustomerSeries->color = $this->getRequest()->query->get('customers_color', '#f39922');
$newCustomerSeries->data = CustomerQuery::getMonthlyNewCustomersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
/* orders */
$orderSeries = new \stdClass();
$orderSeries->color = $this->getRequest()->query->get('orders_color', '#5cb85c');
$orderSeries->data = OrderQuery::getMonthlyOrdersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
/* first order */
$firstOrderSeries = new \stdClass();
$firstOrderSeries->color = $this->getRequest()->query->get('first_orders_color', '#5bc0de');
$firstOrderSeries->data = OrderQuery::getFirstOrdersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
/* cancelled orders */
$cancelledOrderSeries = new \stdClass();
$cancelledOrderSeries->color = $this->getRequest()->query->get('cancelled_orders_color', '#d9534f');
$cancelledOrderSeries->data = OrderQuery::getMonthlyOrdersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')), array(5));
$data->series = array($saleSeries, $newCustomerSeries, $orderSeries, $firstOrderSeries, $cancelledOrderSeries);
$json = json_encode($data);
return $this->jsonResponse($json);
}
示例3: loadStatsAjaxAction
public function loadStatsAjaxAction()
{
if (null !== ($response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW))) {
return $response;
}
$cacheExpire = ConfigQuery::getAdminCacheHomeStatsTTL();
$cacheContent = false;
$month = (int) $this->getRequest()->query->get('month', date('m'));
$year = (int) $this->getRequest()->query->get('year', date('Y'));
if ($cacheExpire) {
$context = "_" . $month . "_" . $year;
$cacheKey = self::STATS_CACHE_KEY . $context;
$cacheDriver = new FilesystemCache($this->getCacheDir());
if (!$this->getRequest()->query->get('flush', "0")) {
$cacheContent = $cacheDriver->fetch($cacheKey);
} else {
$cacheDriver->delete($cacheKey);
}
}
if ($cacheContent === false) {
$data = new \stdClass();
$data->title = $this->getTranslator()->trans("Stats on %month/%year", ['%month' => $month, '%year' => $year]);
/* sales */
$saleSeries = new \stdClass();
$saleSeries->color = self::testHexColor('sales_color', '#adadad');
$saleSeries->data = OrderQuery::getMonthlySaleStats($month, $year);
/* new customers */
$newCustomerSeries = new \stdClass();
$newCustomerSeries->color = self::testHexColor('customers_color', '#f39922');
$newCustomerSeries->data = CustomerQuery::getMonthlyNewCustomersStats($month, $year);
/* orders */
$orderSeries = new \stdClass();
$orderSeries->color = self::testHexColor('orders_color', '#5cb85c');
$orderSeries->data = OrderQuery::getMonthlyOrdersStats($month, $year);
/* first order */
$firstOrderSeries = new \stdClass();
$firstOrderSeries->color = self::testHexColor('first_orders_color', '#5bc0de');
$firstOrderSeries->data = OrderQuery::getFirstOrdersStats($month, $year);
/* cancelled orders */
$cancelledOrderSeries = new \stdClass();
$cancelledOrderSeries->color = self::testHexColor('cancelled_orders_color', '#d9534f');
$cancelledOrderSeries->data = OrderQuery::getMonthlyOrdersStats($month, $year, array(5));
$data->series = array($saleSeries, $newCustomerSeries, $orderSeries, $firstOrderSeries, $cancelledOrderSeries);
$cacheContent = json_encode($data);
if ($cacheExpire) {
$cacheDriver->save($cacheKey, $cacheContent, $cacheExpire);
}
}
return $this->jsonResponse($cacheContent);
}