admin home stats
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Model\Base\CustomerQuery as BaseCustomerQuery;
|
||||
|
||||
|
||||
@@ -21,4 +22,20 @@ class CustomerQuery extends BaseCustomerQuery {
|
||||
{
|
||||
return self::create()->findOneByEmail($email);
|
||||
}
|
||||
|
||||
public static function getNewCustomersStats($month, $year)
|
||||
{
|
||||
$numberOfDay = cal_days_in_month(CAL_GREGORIAN, $month, $year);
|
||||
|
||||
$stats = array();
|
||||
for($day=1; $day<=$numberOfDay; $day++) {
|
||||
$dayCustomers = self::create()
|
||||
->filterByCreatedAt(sprintf("%s-%s-%s 00:00:00", $year, $month, $day), Criteria::GREATER_EQUAL)
|
||||
->filterByCreatedAt(sprintf("%s-%s-%s 23:59:59", $year, $month, $day), Criteria::LESS_EQUAL)
|
||||
->count();
|
||||
$stats[] = array($day-1, $dayCustomers);
|
||||
}
|
||||
|
||||
return $stats;
|
||||
}
|
||||
} // CustomerQuery
|
||||
|
||||
Reference in New Issue
Block a user