Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Counter.php
Go to the documentation of this file.
1 <?php
7 
15 
16 class Counter
17 {
21  protected $productManagement;
22 
27 
32 
37 
41  protected $websiteManagement;
42 
46  protected $storeManagement;
47 
58  public function __construct(
65  ) {
66  $this->productManagement = $productManagement;
67  $this->configurableManagement = $configurableManagement;
68  $this->categoryManagement = $categoryManagement;
69  $this->customerManagement = $customerManagement;
70  $this->websiteManagement = $websiteManagement;
71  $this->storeManagement = $storeManagement;
72  }
73 
79  public function getAllProductsCount()
80  {
81  $count = $this->productManagement->getCount();
82  return (int)$count;
83  }
84 
90  public function getConfigurableCount()
91  {
92  $count = $this->configurableManagement->getCount();
93  return (int)$count;
94  }
95 
101  public function getActiveCatalogSize()
102  {
103  $count = $this->productManagement->getCount(Status::STATUS_ENABLED);
104  return (int)$count;
105  }
106 
112  public function getCategoryCount()
113  {
114  $count = $this->categoryManagement->getCount();
115  return (int)$count;
116  }
117 
123  public function getCustomerCount()
124  {
125  $count = $this->customerManagement->getCount();
126  return (int)$count;
127  }
128 
134  public function getWebsiteCount()
135  {
136  $count = $this->websiteManagement->getCount();
137  return (int)$count;
138  }
139 
145  public function getStoreViewsCount()
146  {
147  $count = $this->storeManagement->getCount();
148  return (int)$count;
149  }
150 }
$count
Definition: recent.phtml:13
__construct(ProductManagementInterface $productManagement, ConfigurableProductManagementInterface $configurableManagement, CategoryManagementInterface $categoryManagement, CustomerManagementInterface $customerManagement, WebsiteManagementInterface $websiteManagement, StoreManagementInterface $storeManagement)
Definition: Counter.php:58