/** * Return count of items with params * * @param array $params * @return int */ public function getItemsCount($params = []) { $selectOptions = $this->parseOptions($params); $selectOptions['distinct'] = \Ecommerce\Item::index(); $counts = Ecommerce\Item::getCount($selectOptions); if (is_array($counts)) { $sum = 0; foreach ($counts as $count) { $sum += $count['count']; } return $sum; } return $counts; }
return ['widget' => function () { ?> <div class="panel panel-default"> <div class="panel-heading">Онлайн-магазин</div> <div class="panel-body"> <div class="row"> <div class="col-lg-6"> <p>Всего товаров/отображаемых: <?php echo Ecommerce\Item::getCount(); ?> / <?php echo \App::$cur->ecommerce->getItemsCount(); ?> </p> <p>Новых товаров/отображаемых сегодня: <?php echo Ecommerce\Item::getCount(['where' => ['date_create', date('Y-m-d 00:00:00'), '>']]); ?> / <?php echo \App::$cur->ecommerce->getItemsCount(['where' => ['date_create', date('Y-m-d 00:00:00'), '>']]); ?> </p> </div> <div class="col-lg-6"> <p>Всего Корзин/Заказов: <?php echo Ecommerce\Cart::getCount(); ?> / <?php echo Ecommerce\Cart::getCount(['where' => ['cart_status_id', 1, '>']]); ?> </p> <p>Новых Корзин/Заказов сегодня: <?php