Skip to content

Commit

Permalink
Merge pull request #10 from magento-troll/MDEE-40-STORY-fix-stock-id
Browse files Browse the repository at this point in the history
Fix stock_id issue
  • Loading branch information
mslabko authored Oct 25, 2021
2 parents b6ac3a3 + b1ca0c7 commit 110ae7d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions InventoryDataExporter/Model/Query/InventoryStockQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private function getTable(string $tableName): string
public function getQuery(array $skus): Select
{
$connection = $this->resourceConnection->getConnection();
$selects = [];
foreach ($this->getStocks() as $stockId) {
$stockId = (int)$stockId;
if ($this->defaultStockProvider->getId() === $stockId) {
Expand Down
24 changes: 18 additions & 6 deletions InventoryDataExporter/etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="inventory_data_exporter_stock_status" resource="default" engine="innodb" comment="Inventory Stock Status Feed Storage">
<column xsi:type="varchar"
name="id"
padding="10"
nullable="false"
length="64"
comment="ID"
/>
<column xsi:type="int"
name="id"
padding="10"
unsigned="true"
nullable="false"
comment="ID"
onCreate="migrateDataFromJSON(JSON_EXTRACT(feed_data, '$.id'))"
name="stock_id"
padding="10"
unsigned="true"
nullable="false"
comment="Stock ID"
/>
<column xsi:type="varchar"
name="sku"
nullable="false"
length="64"
comment="Product SKU"
/>
<column
xsi:type="mediumtext"
Expand Down
3 changes: 1 addition & 2 deletions InventoryDataExporter/etc/db_schema_whitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
},
"column": {
"id": true,
"sku": true,
"item_id": true,
"stock_id": true,
"sku": true,
"feed_data": true,
"modified_at": true,
"is_deleted": true
Expand Down
2 changes: 2 additions & 0 deletions InventoryDataExporter/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<arguments>
<argument name="mapping" xsi:type="array">
<item name="id" xsi:type="string">id</item>
<item name="stock_id" xsi:type="string">stockId</item>
<item name="sku" xsi:type="string">sku</item>
</argument>
</arguments>
</virtualType>
Expand Down

0 comments on commit 110ae7d

Please sign in to comment.