This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,29 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require([
'jquery'
], function ($) {
'use strict';
/**
* Add selected swatch attributes to redirect url
*
* @see Magento_Catalog/js/catalog-add-to-cart
*/
$('body').on('catalogCategoryAddToCartRedirect', function (event, data) {
$(data.form).find('[name*="super"]').each(function (index, item) {
var $item = $(item),
attr;
if ($item.attr('data-attr-name')) {
attr = $item.attr('data-attr-name');
} else {
attr = $item.parent().attr('attribute-code');
}
data.redirectParameters.push(attr + '=' + $item.val());
});
});
});
@@ -0,0 +1,28 @@
require([
'jquery',
'Magento_ConfigurableProduct/js/options-updater'
], function ($, Updater) {
'use strict';
var selectors = {
formSelector: '#product_addtocart_form',
swatchSelector: '.swatch-opt'
},
swatchWidgetName = 'mage-SwatchRenderer',
widgetInitEvent = 'swatch.initialized',
/**
* Sets all configurable swatch attribute's selected values
*/
updateSwatchOptions = function () {
var swatchWidget = $(selectors.swatchSelector).data(swatchWidgetName);
if (!swatchWidget || !swatchWidget._EmulateSelectedByAttributeId) {
return;
}
swatchWidget._EmulateSelectedByAttributeId(this.productOptions);
},
updater = new Updater(widgetInitEvent, updateSwatchOptions);
updater.listen();
});
File diff suppressed because it is too large Load Diff