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-low-quantity-notification
Model
ResourceModel
Rss
NotifyStock
ApplyBaseJoins.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryLowQuantityNotification\Model\ResourceModel\Rss\NotifyStock
;
9
10
use
Magento\Catalog\Api\Data\ProductInterface
;
11
use
Magento\CatalogInventory\Api\Data\StockItemInterface
;
12
use
Magento\Framework\App\ResourceConnection
;
13
use
Magento\Framework\DB\Select
;
14
use
Magento\Inventory\Model\ResourceModel\Source
;
15
use
Magento\Inventory\Model\ResourceModel\SourceItem
;
16
use
Magento\InventoryApi\Api\Data\SourceInterface
;
17
use
Magento\InventoryApi\Api\Data\SourceItemInterface
;
18
use
Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface
;
19
20
class
ApplyBaseJoins
21
{
25
private
$resourceConnection;
26
30
public
function
__construct
(
31
ResourceConnection
$resourceConnection
32
) {
33
$this->resourceConnection =
$resourceConnection
;
34
}
35
41
public
function
execute
(
Select
$select
)
42
{
43
$configurationJoinCondition =
44
'source_item_config.'
.
SourceItemConfigurationInterface::SKU
.
' = product.'
.
ProductInterface::SKU
.
' '
45
.
Select::SQL_AND
46
.
' source_item_config.'
.
SourceItemConfigurationInterface::SOURCE_CODE
47
.
' = main_table.'
.
SourceItemInterface::SOURCE_CODE
;
48
49
$select
->join(
50
[
'source'
=> $this->resourceConnection->getTableName(
Source::TABLE_NAME_SOURCE
)],
51
'source.'
.
SourceInterface::SOURCE_CODE
.
' = main_table.'
.
SourceItemInterface::SOURCE_CODE
,
52
[
'source_name'
=>
'source.'
.
SourceInterface::NAME
]
53
)->join(
54
[
'product'
=> $this->resourceConnection->getTableName(
'catalog_product_entity'
)],
55
'main_table.'
.
SourceItemInterface::SKU
.
' = product.'
.
ProductInterface::SKU
,
56
[
'*'
]
57
)->join(
58
[
59
'source_item_config'
=> $this->resourceConnection->getTableName(
60
'inventory_low_stock_notification_configuration'
61
)
62
],
63
$configurationJoinCondition,
64
[
'source_item_config.'
.
SourceItemConfigurationInterface::INVENTORY_NOTIFY_QTY
]
65
)->join(
66
[
'legacy_stock_item'
=> $this->resourceConnection->getTableName(
'cataloginventory_stock_item'
)],
67
'legacy_stock_item.product_id = product.entity_id'
,
68
[
69
'legacy_stock_item.'
.
StockItemInterface::LOW_STOCK_DATE
,
70
'use_config'
=>
'legacy_stock_item.'
.
StockItemInterface::USE_CONFIG_NOTIFY_STOCK_QTY
71
]
72
)->group(
'main_table.'
.
SourceItem::ID_FIELD_NAME
);
73
}
74
}
Magento\Framework\DB\Select
Definition:
Select.php:33
Magento\Inventory\Model\ResourceModel\Source
Definition:
Collection.php:8
Magento\CatalogInventory\Api\Data\StockItemInterface
Definition:
StockItemInterface.php:19
Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface\INVENTORY_NOTIFY_QTY
const INVENTORY_NOTIFY_QTY
Definition:
SourceItemConfigurationInterface.php:24
Magento\CatalogInventory\Api\Data\StockItemInterface\LOW_STOCK_DATE
const LOW_STOCK_DATE
Definition:
StockItemInterface.php:55
Magento\InventoryApi\Api\Data\SourceInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
SourceInterface.php:22
Magento\InventoryApi\Api\Data\SourceItemInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
SourceItemInterface.php:26
Magento\CatalogInventory\Api\Data\StockItemInterface\USE_CONFIG_NOTIFY_STOCK_QTY
const USE_CONFIG_NOTIFY_STOCK_QTY
Definition:
StockItemInterface.php:42
Magento\Catalog\Api\Data\ProductInterface\SKU
const SKU
Definition:
ProductInterface.php:19
Magento\InventoryApi\Api\Data\SourceItemInterface
Definition:
SourceItemInterface.php:20
Magento\InventoryLowQuantityNotification\Model\ResourceModel\Rss\NotifyStock\ApplyBaseJoins
Definition:
ApplyBaseJoins.php:20
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
Zend_Db_Select\SQL_AND
const SQL_AND
Definition:
Select.php:77
Magento\InventoryApi\Api\Data\SourceItemInterface\SKU
const SKU
Definition:
SourceItemInterface.php:25
Magento\InventoryApi\Api\Data\SourceInterface
Definition:
SourceInterface.php:17
Magento\InventoryLowQuantityNotification\Model\ResourceModel\Rss\NotifyStock\ApplyBaseJoins\execute
execute(Select $select)
Definition:
ApplyBaseJoins.php:41
Magento\InventoryLowQuantityNotification\Model\ResourceModel\Rss\NotifyStock\ApplyBaseJoins\__construct
__construct(ResourceConnection $resourceConnection)
Definition:
ApplyBaseJoins.php:30
Magento\Inventory\Model\ResourceModel\SourceItem
Definition:
Collection.php:8
Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface
Definition:
SourceItemConfigurationInterface.php:17
Magento\Inventory\Model\ResourceModel\Source\TABLE_NAME_SOURCE
const TABLE_NAME_SOURCE
Definition:
Source.php:31
Magento\Inventory\Model\ResourceModel\SourceItem\ID_FIELD_NAME
const ID_FIELD_NAME
Definition:
SourceItem.php:21
$resourceConnection
$resourceConnection
Definition:
website_attribute_sync.php:32
Magento\Framework\App\ResourceConnection
Definition:
ResourceConnection.php:18
Magento\InventoryApi\Api\Data\SourceInterface\NAME
const NAME
Definition:
SourceInterface.php:23
Magento\Framework\DB\Select
Definition:
ColumnsRenderer.php:6
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14
Magento\Framework\App\ResourceConnection
Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface\SKU
const SKU
Definition:
SourceItemConfigurationInterface.php:23
Magento\InventoryLowQuantityNotification\Model\ResourceModel\Rss\NotifyStock
Definition:
ApplyBaseJoins.php:8
Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
SourceItemConfigurationInterface.php:22