Skip to content

Commit 4e9f916

Browse files
author
Alex Bomko
committed
MAGETWO-44704: Swatches attributes: empty value is missing, although "Values Required" = No
1 parent 9541444 commit 4e9f916

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
6+
echo "swatchjs";
77
// @codingStandardsIgnoreFile
88

99
?>
@@ -265,7 +265,7 @@ require([
265265
setRowVisibility('is_unique', false);
266266
setRowVisibility('frontend_class', false);
267267
break;
268-
<?php $hiddenFields = $block->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() ?>
268+
<?php $hiddenFields = $this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() ?>
269269
<?php foreach ($hiddenFields as $type => $fields): ?>
270270
<?php if (in_array($type, array('swatch_visual', 'swatch_text'))) continue ?>
271271
case '<?php echo $block->escapeHtml($type); ?>':

app/code/Magento/Swatches/view/adminhtml/web/js/text.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,8 @@ define([
4444
data: data
4545
});
4646

47-
if (isNewOption) {
48-
visibleRadio = $$('#swatch-text-options-panel [name="defaulttext[]"]').findAll(function (el) {
49-
return el.up().up().visible();
50-
});
51-
52-
if (visibleRadio.length === 1) {
53-
visibleRadio[0].checked = true;
54-
}
55-
56-
if (!this.isReadOnly) {
57-
this.enableNewOptionDeleteButton(data.id);
58-
}
47+
if (isNewOption &&!this.isReadOnly) {
48+
this.enableNewOptionDeleteButton(data.id);
5949
}
6050
this.itemCount++;
6151
this.totalItems++;

app/code/Magento/Swatches/view/adminhtml/web/js/visual.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,8 @@ define([
4646
data: data
4747
});
4848

49-
if (isNewOption) {
50-
visibleRadio = $$('#swatch-visual-options-panel [name="defaultvisual[]"]').findAll(
51-
function (el) {
52-
return el.up().up().visible();
53-
}
54-
);
55-
56-
if (visibleRadio.length === 1) {
57-
visibleRadio[0].checked = true;
58-
}
59-
60-
if (!this.isReadOnly) {
61-
this.enableNewOptionDeleteButton(data.id);
62-
}
49+
if (isNewOption && !this.isReadOnly) {
50+
this.enableNewOptionDeleteButton(data.id);
6351
}
6452
this.itemCount++;
6553
this.totalItems++;

0 commit comments

Comments
 (0)