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
GetStockIdForCurrentWebsite.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryCatalog\Model
;
9
10
use
Magento\InventorySalesApi\Api\Data\SalesChannelInterface
;
11
use
Magento\InventorySalesApi\Api\StockResolverInterface
;
12
use
Magento\Store\Model\StoreManagerInterface
;
13
17
class
GetStockIdForCurrentWebsite
18
{
22
private
$storeManager;
23
27
private
$stockResolver;
28
33
public
function
__construct
(
34
StoreManagerInterface
$storeManager,
35
StockResolverInterface
$stockResolver
36
) {
37
$this->storeManager =
$storeManager
;
38
$this->stockResolver = $stockResolver;
39
}
40
44
public
function
execute
(): int
45
{
46
$websiteCode
= $this->storeManager->getWebsite()->getCode();
47
48
$stock
= $this->stockResolver->execute(
SalesChannelInterface::TYPE_WEBSITE
,
$websiteCode
);
49
$stockId = (int)
$stock
->getStockId();
50
51
return
$stockId;
52
}
53
}
Magento\InventorySalesApi\Api\StockResolverInterface
Definition:
StockResolverInterface.php:15
$storeManager
$storeManager
Definition:
paypal_quote.php:14
Magento\InventoryCatalog\Model\GetStockIdForCurrentWebsite\__construct
__construct(StoreManagerInterface $storeManager, StockResolverInterface $stockResolver)
Definition:
GetStockIdForCurrentWebsite.php:33
Magento\InventorySalesApi\Api\Data\SalesChannelInterface\TYPE_WEBSITE
const TYPE_WEBSITE
Definition:
SalesChannelInterface.php:29
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
Magento\InventoryCatalog\Model\GetStockIdForCurrentWebsite\execute
execute()
Definition:
GetStockIdForCurrentWebsite.php:44
Magento\InventorySalesApi\Api\Data\SalesChannelInterface
Definition:
SalesChannelInterface.php:17
Magento\InventoryCatalog\Model\GetStockIdForCurrentWebsite
Definition:
GetStockIdForCurrentWebsite.php:17
Magento\InventoryCatalog\Model
Definition:
BulkInventoryTransfer.php:8
$stock
$stock
Definition:
product_alert.php:22
$websiteCode
if(!isset($_GET['website_code'])) $websiteCode
Definition:
website.php:11