Skip to content

Commit 880edc7

Browse files
committed
MAGETWO-36828: Api service should not return custom attribute for catalog inventory
-- move to catalog inventory module
1 parent 0dd3eb7 commit 880edc7

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

app/code/Magento/Catalog/etc/di.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@
4646
<type name="Magento\Customer\Model\ResourceModel\Visitor">
4747
<plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" />
4848
</type>
49-
<type name="Magento\Catalog\Model\Product\Attribute\Repository">
50-
<plugin name="filterCustomAttribute" type="Magento\Catalog\Model\Plugin\FilterCustomAttribute" />
51-
</type>
52-
<type name="Magento\Catalog\Model\Plugin\FilterCustomAttribute">
53-
<arguments>
54-
<argument name="blackList" xsi:type="array">
55-
<item name="quantity_and_stock_status" xsi:type="string">quantity_and_stock_status</item>
56-
</argument>
57-
</arguments>
58-
</type>
5949
<type name="Magento\Indexer\Model\Indexer\State">
6050
<plugin name="setStatusForIndexer" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\IndexerState" />
6151
</type>

app/code/Magento/Catalog/Model/Plugin/FilterCustomAttribute.php renamed to app/code/Magento/CatalogInventory/Model/Plugin/FilterCustomAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright © 2015 Magento. All rights reserved.
66
* See COPYING.txt for license details.
77
*/
8-
namespace Magento\Catalog\Model\Plugin;
8+
namespace Magento\CatalogInventory\Model\Plugin;
99

1010
use Magento\Catalog\Model\Product\Attribute\Repository;
1111

app/code/Magento/CatalogInventory/etc/di.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@
3232
<preference for="Magento\CatalogInventory\Model\Spi\StockStateProviderInterface" type="Magento\CatalogInventory\Model\StockStateProvider" />
3333

3434
<preference for="Magento\CatalogInventory\Model\ResourceModel\QtyCounterInterface" type="\Magento\CatalogInventory\Model\ResourceModel\Stock" />
35-
35+
<type name="Magento\Catalog\Model\Product\Attribute\Repository">
36+
<plugin name="filterCustomAttribute" type="Magento\CatalogInventory\Model\Plugin\FilterCustomAttribute" />
37+
</type>
38+
<type name="Magento\CatalogInventory\Model\Plugin\FilterCustomAttribute">
39+
<arguments>
40+
<argument name="blackList" xsi:type="array">
41+
<item name="quantity_and_stock_status" xsi:type="string">quantity_and_stock_status</item>
42+
</argument>
43+
</arguments>
44+
</type>
3645
<type name="Magento\CatalogInventory\Observer\UpdateItemsStockUponConfigChangeObserver">
3746
<arguments>
3847
<argument name="resourceStock" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Proxy</argument>

dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/ProductRepositoryInterfaceTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,7 @@ protected function findCustomAttributeQty($customAttributes)
204204
{
205205
$qty = false;
206206
$qtyAndStockStatus = [];
207-
foreach ($customAttributes as $customAttribute) {
208-
if ($customAttribute[self::KEY_ATTRIBUTE_CODE] == self::CODE_QUANTITY_AND_STOCK_STATUS) {
209-
$qtyAndStockStatus = $customAttribute['value'];
210-
break;
211-
}
212-
}
207+
213208
if (!empty($qtyAndStockStatus) && is_array($qtyAndStockStatus)) {
214209

215210
if (array_key_exists('any_type', $qtyAndStockStatus)) {

0 commit comments

Comments
 (0)