Skip to content

Commit f231724

Browse files
committed
MAGETWO-52309: Configurable Product. Price should not be sent to server while saving.
2 parents d21edaf + 7c0f589 commit f231724

File tree

2 files changed

+63
-6
lines changed

2 files changed

+63
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ public function modifyMeta(array $meta)
6161
'arguments' => [
6262
'data' => [
6363
'config' => [
64-
'imports' => [
65-
'disabled' => '!ns = ${ $.ns }, index = '
66-
. ConfigurablePanel::CONFIGURABLE_MATRIX . ':isEmpty',
67-
],
64+
'component' => 'Magento_ConfigurableProduct/js/' .
65+
'components/price-configurable'
6866
],
6967
],
7068
],
@@ -79,8 +77,6 @@ public function modifyMeta(array $meta)
7977
? ['visible' => 0, 'disabled' => 1]
8078
: [
8179
'imports' => [
82-
'disabled' => '!ns = ${ $.ns }, index = '
83-
. ConfigurablePanel::CONFIGURABLE_MATRIX . ':isEmpty',
8480
'visible' => 'ns = ${ $.ns }, index = '
8581
. ConfigurablePanel::CONFIGURABLE_MATRIX . ':isEmpty',
8682
]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Copyright © 2016 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
define([
6+
'underscore',
7+
'uiRegistry',
8+
'Magento_Ui/js/form/element/abstract'
9+
], function (_, registry, Abstract) {
10+
'use strict';
11+
12+
return Abstract.extend({
13+
defaults: {
14+
listens: {
15+
isConfigurable: 'handlePriceValue'
16+
},
17+
imports: {
18+
isConfigurable: '!ns = ${ $.ns }, index = configurable-matrix:isEmpty'
19+
},
20+
modules: {
21+
createConfigurableButton: '${$.createConfigurableButton}'
22+
}
23+
},
24+
25+
/**
26+
* Invokes initialize method of parent class,
27+
* contains initialization logic
28+
*/
29+
initialize: function () {
30+
this._super();
31+
32+
return this;
33+
},
34+
35+
/**
36+
* Calls 'initObservable' of parent
37+
*
38+
* @returns {Object} Chainable.
39+
*/
40+
initObservable: function () {
41+
this._super()
42+
.observe(['content']);
43+
44+
return this;
45+
},
46+
47+
/**
48+
* Disable and clear price if product type changed to configurable
49+
*
50+
* @param {String} isConfigurable
51+
*/
52+
handlePriceValue: function (isConfigurable) {
53+
if (isConfigurable) {
54+
this.disable();
55+
this.clear();
56+
} else {
57+
this.enable();
58+
}
59+
}
60+
});
61+
});

0 commit comments

Comments
 (0)