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-inventory-catalog
Plugin
CatalogInventory
Model
ResourceModel
Stock
Status
AdaptAddStockDataToCollectionPlugin.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status
;
9
10
use
Magento\Catalog\Model\ResourceModel\Product\Collection
;
11
use
Magento\CatalogInventory\Model\ResourceModel\Stock\Status
;
12
use
Magento\InventoryCatalog\Model\GetStockIdForCurrentWebsite
;
13
use
Magento\InventoryCatalog\Model\ResourceModel\AddStockDataToCollection
;
14
18
class
AdaptAddStockDataToCollectionPlugin
19
{
23
private
$getStockIdForCurrentWebsite;
24
28
private
$addStockDataToCollection;
29
34
public
function
__construct
(
35
GetStockIdForCurrentWebsite
$getStockIdForCurrentWebsite,
36
AddStockDataToCollection
$addStockDataToCollection
37
) {
38
$this->getStockIdForCurrentWebsite = $getStockIdForCurrentWebsite;
39
$this->addStockDataToCollection = $addStockDataToCollection;
40
}
41
51
public
function
aroundAddStockDataToCollection
(
52
Status
$stockStatus,
53
callable $proceed,
54
$collection
,
55
$isFilterInStock
56
) {
57
$stockId = $this->getStockIdForCurrentWebsite->execute();
58
$this->addStockDataToCollection->execute(
$collection
, (
bool
)$isFilterInStock, $stockId);
59
60
return
$collection
;
61
}
62
}
Magento\CatalogInventory\Model\ResourceModel\Stock\Status
Definition:
Collection.php:7
Magento\Catalog\Model\ResourceModel\Product\Collection
Definition:
ProductLimitation.php:6
Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status\AdaptAddStockDataToCollectionPlugin\__construct
__construct(GetStockIdForCurrentWebsite $getStockIdForCurrentWebsite, AddStockDataToCollection $addStockDataToCollection)
Definition:
AdaptAddStockDataToCollectionPlugin.php:34
Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status
Definition:
AdaptAddIsInStockFilterToCollectionPlugin.php:8
Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status\AdaptAddStockDataToCollectionPlugin\aroundAddStockDataToCollection
aroundAddStockDataToCollection(Status $stockStatus, callable $proceed, $collection, $isFilterInStock)
Definition:
AdaptAddStockDataToCollectionPlugin.php:51
Magento\CatalogInventory\Model\ResourceModel\Stock\Status
Definition:
Status.php:21
Magento\InventoryCatalog\Model\GetStockIdForCurrentWebsite
Definition:
GetStockIdForCurrentWebsite.php:17
Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status\AdaptAddStockDataToCollectionPlugin
Definition:
AdaptAddStockDataToCollectionPlugin.php:18
Magento\InventoryCatalog\Model\ResourceModel\AddStockDataToCollection
Definition:
AddStockDataToCollection.php:17
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17