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
Model
ResourceModel
AddIsInStockFieldToCollection.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\Catalog\Model\ResourceModel\Product\Collection
;
11
use
Magento\InventoryIndexer\Indexer\IndexStructure
;
12
use
Magento\InventoryIndexer\Model\StockIndexTableNameResolverInterface
;
13
17
class
AddIsInStockFieldToCollection
18
{
22
private
$stockIndexTableProvider;
23
27
public
function
__construct
(
28
StockIndexTableNameResolverInterface
$stockIndexTableProvider
29
) {
30
$this->stockIndexTableProvider = $stockIndexTableProvider;
31
}
32
38
public
function
execute
(
$collection
,
int
$stockId)
39
{
40
$tableName
= $this->stockIndexTableProvider->execute($stockId);
41
42
$collection
->getSelect()->join(
43
[
'inventory_in_stock'
=>
$tableName
],
44
'e.sku = inventory_in_stock.sku'
,
45
[]
46
)->where(
'inventory_in_stock.'
.
IndexStructure::IS_SALABLE
.
' = ?'
, 1);
47
}
48
}
Magento\InventoryCatalog\Model\ResourceModel\AddIsInStockFieldToCollection\__construct
__construct(StockIndexTableNameResolverInterface $stockIndexTableProvider)
Definition:
AddIsInStockFieldToCollection.php:27
Magento\InventoryIndexer\Model\StockIndexTableNameResolverInterface
Definition:
StockIndexTableNameResolverInterface.php:15
Magento\Catalog\Model\ResourceModel\Product\Collection
Definition:
ProductLimitation.php:6
$tableName
$tableName
Definition:
trigger.php:13
Magento\InventoryIndexer\Indexer\IndexStructure\IS_SALABLE
const IS_SALABLE
Definition:
IndexStructure.php:27
Magento\InventoryCatalog\Model\ResourceModel\AddIsInStockFieldToCollection\execute
execute($collection, int $stockId)
Definition:
AddIsInStockFieldToCollection.php:38
Magento\InventoryIndexer\Indexer\IndexStructure
Definition:
IndexStructure.php:20
Magento\InventoryCatalog\Model\ResourceModel
Definition:
AddIsInStockFieldToCollection.php:8
Magento\InventoryCatalog\Model\ResourceModel\AddIsInStockFieldToCollection
Definition:
AddIsInStockFieldToCollection.php:17
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17