Skip to content

Commit ee309fc

Browse files
author
Joan He
committed
Merge remote-tracking branch 'honey/MC-15094' into pr
2 parents e46319b + 4a44ec9 commit ee309fc

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,30 @@
1313
<element name="attributeSetFilterResult" type="input" selector="div[data-index='attribute_set_id'] .action-menu-item._last" timeout="30"/>
1414
<element name="attributeSetFilterResultByName" type="text" selector="//label/span[text() = '{{var}}']" timeout="30" parameterized="true"/>
1515
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
16+
<element name="productNameDisabled" type="input" selector=".admin__field[data-index=name] input[disabled=true]"/>
1617
<element name="RequiredNameIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
1718
<element name="RequiredSkuIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=sku]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
1819
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
20+
<element name="productSkuDisabled" type="input" selector=".admin__field[data-index=sku] input[disabled=true]"/>
1921
<element name="enableProductAttributeLabel" type="text" selector="//span[text()='Enable Product']/parent::label"/>
2022
<element name="enableProductAttributeLabelWrapper" type="text" selector="//span[text()='Enable Product']/parent::label/parent::div"/>
2123
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
24+
<element name="productStatusDisabled" type="checkbox" selector="input[name='product[status]'][disabled]"/>
2225
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
2326
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
2427
<element name="productNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
2528
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
29+
<element name="productPriceDisabled" type="input" selector=".admin__field[data-index=price] input[disabled=true]"/>
30+
<element name="productPriceUseDefault" type="checkbox" selector=".admin__field[data-index=price] [name='use_default[price]']"/>
2631
<element name="productTaxClass" type="select" selector="//*[@name='product[tax_class_id]']"/>
32+
<element name="productTaxClassDisabled" type="select" selector="select[name='product[tax_class_id]'][disabled=true]"/>
2733
<element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/>
2834
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']" timeout="30"/>
2935
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
3036
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
3137
<element name="advancedInventoryLink" type="button" selector="//button[contains(@data-index, 'advanced_inventory_button')]" timeout="30"/>
3238
<element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']"/>
39+
<element name="productStockStatusDisabled" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]'][disabled=true]"/>
3340
<element name="stockStatus" type="select" selector="[data-index='product-details'] select[name='product[quantity_and_stock_status][is_in_stock]']"/>
3441
<element name="productWeight" type="input" selector=".admin__field[data-index=weight] input"/>
3542
<element name="productWeightSelect" type="select" selector="select[name='product[product_has_weight]']"/>
@@ -47,6 +54,7 @@
4754
<element name="productFormTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]" parameterized="true"/>
4855
<element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/>
4956
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
57+
<element name="visibilityDisabled" type="select" selector="select[name='product[visibility]'][disabled=true]"/>
5058
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
5159
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
5260
<element name="setProductAsNewFrom" type="input" selector="input[name='product[news_from_date]']"/>

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/price-configurable.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ define([
1111

1212
return Abstract.extend({
1313
defaults: {
14-
listens: {
15-
isConfigurable: 'handlePriceValue'
16-
},
1714
imports: {
1815
isConfigurable: '!ns = ${ $.ns }, index = configurable-matrix:isEmpty'
1916
},
@@ -22,12 +19,15 @@ define([
2219
}
2320
},
2421

25-
/**
26-
* Invokes initialize method of parent class,
27-
* contains initialization logic
28-
*/
22+
/** @inheritdoc */
2923
initialize: function () {
3024
this._super();
25+
// resolve initial disable state
26+
this.handlePriceValue(this.isConfigurable);
27+
// add listener to track "configurable" type
28+
this.setListeners({
29+
isConfigurable: 'handlePriceValue'
30+
});
3131

3232
return this;
3333
},
@@ -50,11 +50,10 @@ define([
5050
* @param {String} isConfigurable
5151
*/
5252
handlePriceValue: function (isConfigurable) {
53+
this.disabled(!!this.isUseDefault() || isConfigurable);
54+
5355
if (isConfigurable) {
54-
this.disable();
5556
this.clear();
56-
} else {
57-
this.enable();
5857
}
5958
}
6059
});

0 commit comments

Comments
 (0)