Skip to content

Commit c777f39

Browse files
committed
Merge remote-tracking branch 'github-magento/MC-16333' into EPAM-PR-77
2 parents b07719d + de69cd9 commit c777f39

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAssertDisabledQtyActionGroup">
12+
<annotations>
13+
<description>Goes to the 'Quantity' field and assert disabled attribute.</description>
14+
</annotations>
15+
16+
<seeElement selector="{{AdminProductFormSection.productQuantity}}" stepKey="assertProductQty"/>
17+
<assertElementContainsAttribute selector="{{AdminProductFormSection.productQuantity}}" attribute="disabled" expectedValue="true" stepKey="checkIfQtyIsDisabled" />
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
2-
3-
declare(strict_types=1);
4-
52
/**
63
* Copyright © Magento, Inc. All rights reserved.
74
* See COPYING.txt for license details.
85
*/
6+
declare(strict_types=1);
7+
98
namespace Magento\CatalogInventory\Ui\DataProvider\Product\Form\Modifier;
109

1110
use Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter;
@@ -238,7 +237,7 @@ private function prepareMeta()
238237
$this->meta = $this->arrayManager->merge(
239238
$fieldsetPath . '/children',
240239
$this->meta,
241-
['container_quantity_and_stock_status_qty' => $container]
240+
['quantity_and_stock_status_qty' => $container]
242241
);
243242
}
244243
}

app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier;
79

810
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
11+
use Magento\Catalog\Model\Locator\LocatorInterface;
912

1013
/**
1114
* Data provider for quantity in the Configurable products
@@ -16,21 +19,37 @@ class ConfigurableQty extends AbstractModifier
1619
const CODE_QTY_CONTAINER = 'quantity_and_stock_status_qty';
1720

1821
/**
19-
* {@inheritdoc}
22+
* @var LocatorInterface
23+
*/
24+
private $locator;
25+
26+
/**
27+
* ConfigurableQty constructor
28+
*
29+
* @param LocatorInterface $locator
30+
*/
31+
public function __construct(LocatorInterface $locator)
32+
{
33+
$this->locator = $locator;
34+
}
35+
36+
/**
37+
* @inheritdoc
2038
*/
2139
public function modifyData(array $data)
2240
{
2341
return $data;
2442
}
2543

2644
/**
27-
* {@inheritdoc}
45+
* @inheritdoc
2846
*/
2947
public function modifyMeta(array $meta)
3048
{
3149
if ($groupCode = $this->getGroupCodeByField($meta, self::CODE_QTY_CONTAINER)) {
3250
$parentChildren = &$meta[$groupCode]['children'];
33-
if (!empty($parentChildren[self::CODE_QTY_CONTAINER])) {
51+
$isConfigurable = $this->locator->getProduct()->getTypeId() === 'configurable';
52+
if (!empty($parentChildren[self::CODE_QTY_CONTAINER]) && $isConfigurable) {
3453
$parentChildren[self::CODE_QTY_CONTAINER] = array_replace_recursive(
3554
$parentChildren[self::CODE_QTY_CONTAINER],
3655
[

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</category_ids>
3232
<quantity_and_stock_status composite="1">
3333
<qty>
34-
<selector>fieldset[data-index="container_quantity_and_stock_status_qty"] [name="product[quantity_and_stock_status][qty]"]</selector>
34+
<selector>fieldset[data-index="quantity_and_stock_status_qty"] [name="product[quantity_and_stock_status][qty]"]</selector>
3535
</qty>
3636
<is_in_stock>
3737
<selector>[data-index="quantity_and_stock_status"] [name="product[quantity_and_stock_status][is_in_stock]"]</selector>

0 commit comments

Comments
 (0)