28
28
use Magento \InventorySalesApi \Api \IsProductSalableInterface ;
29
29
use Magento \InventorySalesApi \Model \StockByWebsiteIdResolverInterface ;
30
30
use Meta \BusinessExtension \Model \System \Config as SystemConfig ;
31
+ use Meta \BusinessExtension \Helper \FBEHelper ;
31
32
32
33
class MultiSourceInventory extends InventoryRequirements implements InventoryInterface
33
34
{
@@ -81,6 +82,11 @@ class MultiSourceInventory extends InventoryRequirements implements InventoryInt
81
82
*/
82
83
private $ stockItemCriteriaInterfaceFactory ;
83
84
85
+ /**
86
+ * @var FBEHelper
87
+ */
88
+ private FBEHelper $ fbeHelper ;
89
+
84
90
/**
85
91
* @param IsProductSalableInterface $isProductSalableInterface
86
92
* @param GetProductSalableQtyInterface $getProductSalableQtyInterface
@@ -89,6 +95,7 @@ class MultiSourceInventory extends InventoryRequirements implements InventoryInt
89
95
* @param GetStockItemConfigurationInterface $getStockItemConfiguration
90
96
* @param StockItemRepositoryInterface $stockItemRepository
91
97
* @param StockItemCriteriaInterfaceFactory $stockItemCriteriaInterfaceFactory
98
+ * @param FBEHelper $fbeHelper
92
99
*/
93
100
public function __construct (
94
101
IsProductSalableInterface $ isProductSalableInterface ,
@@ -97,7 +104,8 @@ public function __construct(
97
104
StockByWebsiteIdResolverInterface $ stockByWebsiteIdResolver ,
98
105
GetStockItemConfigurationInterface $ getStockItemConfiguration ,
99
106
StockItemRepositoryInterface $ stockItemRepository ,
100
- StockItemCriteriaInterfaceFactory $ stockItemCriteriaInterfaceFactory
107
+ StockItemCriteriaInterfaceFactory $ stockItemCriteriaInterfaceFactory ,
108
+ FBEHelper $ fbeHelper
101
109
) {
102
110
$ this ->isProductSalableInterface = $ isProductSalableInterface ;
103
111
$ this ->getProductSalableQtyInterface = $ getProductSalableQtyInterface ;
@@ -106,6 +114,7 @@ public function __construct(
106
114
$ this ->getStockItemConfiguration = $ getStockItemConfiguration ;
107
115
$ this ->stockItemRepository = $ stockItemRepository ;
108
116
$ this ->stockItemCriteriaInterfaceFactory = $ stockItemCriteriaInterfaceFactory ;
117
+ $ this ->fbeHelper = $ fbeHelper ;
109
118
}
110
119
111
120
/**
@@ -159,7 +168,16 @@ public function isStockManagedForProduct(): bool
159
168
$ stockItemConfiguration = $ this ->getStockItemConfiguration ->execute ($ this ->product ->getSku (), $ stockId );
160
169
return $ stockItemConfiguration ->isManageStock ();
161
170
} catch (\Throwable $ e ) {
171
+ $ this ->fbeHelper ->logExceptionImmediatelytoMeta (
172
+ $ e ,
173
+ [
174
+ 'store_id ' => $ this ->product ->getStoreId (),
175
+ 'event ' => 'catalog_sync ' ,
176
+ 'event_type ' => 'multi_source_inventory_sync_error '
177
+ ]
178
+ );
162
179
try {
180
+
163
181
// fallback to single inventory mechanism in case of error
164
182
$ criteria = $ this ->stockItemCriteriaInterfaceFactory ->create ();
165
183
$ criteria ->setProductsFilter ($ this ->product ->getId ());
0 commit comments