Skip to content

Commit e01f26c

Browse files
committed
MAGETWO-77744: [Magento Cloud] - Error message when uploading unsupported file format
1 parent e283830 commit e01f26c

File tree

5 files changed

+42
-13
lines changed

5 files changed

+42
-13
lines changed

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ define([
4949
});
5050
},
5151

52+
/**
53+
* @private
54+
*/
55+
_redirect: function (url) {
56+
var urlParts, locationParts, forceReload;
57+
58+
urlParts = url.split('#');
59+
locationParts = window.location.href.split('#');
60+
forceReload = urlParts[0] === locationParts[0];
61+
62+
window.location.assign(url);
63+
64+
if (forceReload) {
65+
window.location.reload();
66+
}
67+
},
68+
5269
/**
5370
* @return {Boolean}
5471
*/
@@ -119,12 +136,8 @@ define([
119136
parameters.push(eventData.redirectParameters.join('&'));
120137
res.backUrl = parameters.join('#');
121138
}
122-
window.location.href = res.backUrl;
123139

124-
// page does not reload when anchor (#) is added
125-
if (res.backUrl.indexOf('#') !== -1) {
126-
window.location.reload();
127-
}
140+
self._redirect(res.backUrl);
128141

129142
return;
130143
}

app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ $_attributes = $block->decorateArray($block->getAllowAttributes());
2222
<div class="control">
2323
<select name="super_attribute[<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>]"
2424
data-selector="super_attribute[<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>]"
25-
data-attribute-code="<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>"
2625
data-validate="{required:true}"
2726
id="attribute<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>"
2827
class="super-attribute-select">

app/code/Magento/ConfigurableProduct/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ require([
99

1010
$('body').on('catalogCategoryAddToCartRedirect', function (event, data) {
1111
$(data.form).find('select[name*="super"]').each(function (index, item) {
12-
var $item = $(item);
13-
14-
data.redirectParameters.push($item.attr('data-attribute-code') + '=' + $item.val());
12+
data.redirectParameters.push(item.config.id + '=' + $(item).val());
1513
});
1614
});
1715
});

app/code/Magento/Swatches/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ require([
99

1010
$('body').on('catalogCategoryAddToCartRedirect', function (event, data) {
1111
$(data.form).find('[name*="super"]').each(function (index, item) {
12-
var $item = $(item);
12+
var $item = $(item),
13+
attr;
14+
15+
if ($item.attr('data-attr-name')) {
16+
attr = $item.attr('data-attr-name');
17+
} else {
18+
attr = $item.parent().attr('attribute-code');
19+
}
20+
data.redirectParameters.push(attr + '=' + $item.val());
1321

14-
data.redirectParameters.push($item.attr('data-attr-name') + '=' + $item.val());
1522
});
1623
});
1724
});

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,8 +1214,20 @@ define([
12141214
*/
12151215
_EmulateSelected: function (selectedAttributes) {
12161216
$.each(selectedAttributes, $.proxy(function (attributeCode, optionId) {
1217-
this.element.find('.' + this.options.classes.attributeClass +
1218-
'[attribute-code="' + attributeCode + '"] [option-id="' + optionId + '"]').trigger('click');
1217+
var elem = this.element.find('.' + this.options.classes.attributeClass +
1218+
'[attribute-code="' + attributeCode + '"] [option-id="' + optionId + '"]'),
1219+
parentInput = elem.parent();
1220+
1221+
if (elem.hasClass('selected')) {
1222+
return;
1223+
}
1224+
1225+
if (parentInput.hasClass(this.options.classes.selectClass)) {
1226+
parentInput.val(optionId);
1227+
parentInput.trigger('change');
1228+
} else {
1229+
elem.trigger('click');
1230+
}
12191231
}, this));
12201232
},
12211233

0 commit comments

Comments
 (0)