Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-catalog
Model
ProductManagement.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Model
;
7
8
use
Magento\Catalog\Api\ProductManagementInterface
;
9
use
Magento\Catalog\Model\Product\Attribute\Source\Status
;
10
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
11
12
class
ProductManagement
implements
ProductManagementInterface
13
{
17
protected
$productsFactory
;
18
22
public
function
__construct
(CollectionFactory
$productsFactory
)
23
{
24
$this->productsFactory =
$productsFactory
;
25
}
26
30
public
function
getCount
(
$status
=
null
)
31
{
32
$products
= $this->productsFactory->create();
34
switch
(
$status
) {
35
case
Status::STATUS_ENABLED
:
36
$products
->addAttributeToFilter(
'status'
,
Status::STATUS_ENABLED
);
37
break
;
38
case
Status::STATUS_DISABLED
:
39
$products
->addAttributeToFilter(
'status'
,
Status::STATUS_DISABLED
);
40
break
;
41
}
42
return
$products
->getSize();
43
}
44
}
Magento\Catalog\Model\Product\Attribute\Source\Status\STATUS_DISABLED
const STATUS_DISABLED
Definition:
Status.php:25
Magento\Catalog\Model\Product\Attribute\Source\Status
Definition:
Status.php:18
$products
$products
Definition:
products_for_search.php:14
Magento\Catalog\Model\ProductManagement\__construct
__construct(CollectionFactory $productsFactory)
Definition:
ProductManagement.php:22
Magento\Catalog\Api\ProductManagementInterface\getCount
getCount($status=null)
Magento\Catalog\Model\ProductManagement\$productsFactory
$productsFactory
Definition:
ProductManagement.php:17
$status
$status
Definition:
order_status.php:8
Magento\Catalog\Model\Product\Attribute\Source\Status\STATUS_ENABLED
const STATUS_ENABLED
Definition:
Status.php:23
Magento\Catalog\Model\ProductManagement
Definition:
ProductManagement.php:12
Magento\Catalog\Api\ProductManagementInterface
Definition:
ProductManagementInterface.php:12
Magento\Catalog\Model