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-inventory
Observer
AddInventoryDataObserver.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\CatalogInventory\Observer
;
8
9
use
Magento\Framework\Event\ObserverInterface
;
10
use
Magento\Framework\Event\Observer
as
EventObserver
;
11
12
class
AddInventoryDataObserver
implements
ObserverInterface
13
{
17
protected
$stockHelper
;
18
22
public
function
__construct
(\
Magento
\CatalogInventory\Helper\Stock
$stockHelper
)
23
{
24
$this->stockHelper =
$stockHelper
;
25
}
26
33
public
function
execute
(
EventObserver
$observer
)
34
{
35
$product
=
$observer
->getEvent()->getProduct();
36
if
(
$product
instanceof \
Magento
\Catalog\Model\
Product
) {
37
$this->stockHelper->assignStatusToProduct(
$product
);
38
}
39
}
40
}
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
Magento\CatalogInventory\Observer\AddInventoryDataObserver\__construct
__construct(\Magento\CatalogInventory\Helper\Stock $stockHelper)
Definition:
AddInventoryDataObserver.php:22
Magento\CatalogInventory\Observer\AddInventoryDataObserver
Definition:
AddInventoryDataObserver.php:12
Magento\CatalogInventory\Observer\AddInventoryDataObserver\execute
execute(EventObserver $observer)
Definition:
AddInventoryDataObserver.php:33
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento\CatalogInventory\Observer\AddInventoryDataObserver\$stockHelper
$stockHelper
Definition:
AddInventoryDataObserver.php:17
Magento\Catalog\Model\Product
Definition:
Product.php:42
Magento\Framework\Event\Observer
Definition:
Collection.php:12
Magento
Magento\CatalogInventory\Observer
Definition:
AddStockItemsObserverTest.php:7
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22