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)
Main Page
Related Pages
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
c
d
e
f
g
h
i
m
p
r
s
t
u
+
Functions
_
c
d
e
f
g
h
i
m
p
r
s
t
u
Variables
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
(
_
a
b
c
d
e
f
g
h
i
j
m
n
o
p
q
r
s
t
u
v
w
+
Functions
_
c
d
e
f
g
m
o
r
s
t
v
+
Variables
$
(
_
a
b
c
d
e
f
g
h
i
j
m
n
o
p
q
r
s
t
u
v
w
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
vendor
magento
module-inventory-catalog
Model
ResourceModel
BulkZeroLegacyStockItem.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryCatalog\Model\ResourceModel
;
9
10
use
Magento\CatalogInventory\Api\Data\StockItemInterface
;
11
use
Magento\Framework\App\ResourceConnection
;
12
use
Magento\InventoryCatalogApi\Model\GetProductIdsBySkusInterface
;
13
17
class
BulkZeroLegacyStockItem
18
{
22
private
$resourceConnection;
23
27
private
$getProductIdsBySkus;
28
33
public
function
__construct
(
34
ResourceConnection
$resourceConnection,
35
GetProductIdsBySkusInterface
$getProductIdsBySkus
36
) {
37
$this->resourceConnection =
$resourceConnection
;
38
$this->getProductIdsBySkus = $getProductIdsBySkus;
39
}
40
46
public
function
execute
(array
$skus
)
47
{
48
$productIds
= array_values($this->getProductIdsBySkus->execute(
$skus
));
49
50
$connection
= $this->resourceConnection->getConnection();
51
$connection
->update(
52
$this->resourceConnection->getTableName(
'cataloginventory_stock_item'
),
53
[
54
StockItemInterface::QTY
=> 0,
55
StockItemInterface::IS_IN_STOCK
=> 0,
56
],
57
[
58
StockItemInterface::PRODUCT_ID
.
' IN (?)'
=>
$productIds
,
59
'website_id = ?'
=> 0,
60
]
61
);
62
}
63
}
Magento\CatalogInventory\Api\Data\StockItemInterface\PRODUCT_ID
const PRODUCT_ID
Definition:
StockItemInterface.php:24
Magento\CatalogInventory\Api\Data\StockItemInterface
Definition:
StockItemInterface.php:19
Magento\CatalogInventory\Api\Data\StockItemInterface\QTY
const QTY
Definition:
StockItemInterface.php:26
Magento\InventoryCatalog\Model\ResourceModel\BulkZeroLegacyStockItem\__construct
__construct(ResourceConnection $resourceConnection, GetProductIdsBySkusInterface $getProductIdsBySkus)
Definition:
BulkZeroLegacyStockItem.php:33
Magento\InventoryCatalog\Model\ResourceModel\BulkZeroLegacyStockItem
Definition:
BulkZeroLegacyStockItem.php:17
Magento\CatalogInventory\Api\Data\StockItemInterface\IS_IN_STOCK
const IS_IN_STOCK
Definition:
StockItemInterface.php:54
$skus
foreach($websiteCodes as $websiteCode) $skus
Definition:
assign_products_to_websites.php:23
Magento\InventoryCatalogApi\Model\GetProductIdsBySkusInterface
Definition:
GetProductIdsBySkusInterface.php:16
Magento\InventoryCatalog\Model\ResourceModel\BulkZeroLegacyStockItem\execute
execute(array $skus)
Definition:
BulkZeroLegacyStockItem.php:46
Magento\InventoryCatalog\Model\ResourceModel
Definition:
AddIsInStockFieldToCollection.php:8
$resourceConnection
$resourceConnection
Definition:
website_attribute_sync.php:32
Magento\Framework\App\ResourceConnection
Definition:
ResourceConnection.php:18
$connection
$connection
Definition:
bulk.php:13
$productIds
$productIds
Definition:
product_with_multiple_options.php:11
Magento\Framework\App\ResourceConnection