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-shipping-admin-ui
Block
Adminhtml
Shipment
Inventory.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment
;
9
10
use
Magento\Backend\Block\Template
;
11
use
Magento\Backend\Block\Template\Context
;
12
use
Magento\Framework\Registry
;
13
use
Magento\InventoryApi\Api\SourceRepositoryInterface
;
14
use
Magento\Sales\Model\Order\Shipment
;
15
21
class
Inventory
extends
Template
22
{
26
private
$registry;
27
31
private
$sourceRepository;
32
40
public
function
__construct
(
41
Context
$context,
42
Registry
$registry,
43
SourceRepositoryInterface
$sourceRepository,
44
array
$data
= []
45
) {
46
parent::__construct($context,
$data
);
47
$this->registry =
$registry
;
48
$this->sourceRepository =
$sourceRepository
;
49
}
50
56
public
function
getShipment
()
57
{
58
return
$this->registry->registry(
'current_shipment'
);
59
}
60
66
public
function
getSourceCode
()
67
{
68
$shipment
= $this->
getShipment
();
69
$extensionAttributes
=
$shipment
->getExtensionAttributes();
70
if
(
$sourceCode
=
$extensionAttributes
->getSourceCode()) {
71
return
$sourceCode
;
72
}
73
return
null
;
74
}
75
83
public
function
getSourceName
(
string
$sourceCode
): string
84
{
85
return
$this->sourceRepository->get(
$sourceCode
)->getName();
86
}
87
}
Magento\Backend\Block\Template\Context
Definition:
Context.php:23
Magento\Backend\Block\Template
Definition:
Template.php:33
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory
Definition:
Inventory.php:21
$registry
$registry
Definition:
bundle_product_with_not_visible_children_rollback.php:16
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory\__construct
__construct(Context $context, Registry $registry, SourceRepositoryInterface $sourceRepository, array $data=[])
Definition:
Inventory.php:40
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory\getSourceName
getSourceName(string $sourceCode)
Definition:
Inventory.php:83
$sourceCode
$sourceCode
Definition:
inventory.phtml:11
$extensionAttributes
$extensionAttributes
Definition:
payment.php:22
Magento\Sales\Model\Order\Shipment
Magento\InventoryApi\Api\SourceRepositoryInterface
Definition:
SourceRepositoryInterface.php:29
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment
Definition:
Inventory.php:8
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory\getSourceCode
getSourceCode()
Definition:
Inventory.php:66
Magento\Framework\Registry
Definition:
Registry.php:18
$sourceRepository
$sourceRepository
Definition:
source.php:20
$shipment
foreach($order->getItems() as $orderItem) $shipment
Definition:
order_with_shipping_and_invoice.php:46
Magento\Backend\Block\Template
Definition:
Context.php:6
Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory\getShipment
getShipment()
Definition:
Inventory.php:56