Skip to content

Commit fa73824

Browse files
authored
Merge branch 'develop' into update/MAGE-780
2 parents d4b4f1d + 0247b4c commit fa73824

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Helper/InsightsHelper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class InsightsHelper
2323
/** @var PersonalizationHelper */
2424
private $personalizationHelper;
2525

26+
/** @var SessionManagerInterface */
27+
private $sessionManager;
28+
2629
/** @var CookieManagerInterface */
2730
private $cookieManager;
2831

view/frontend/web/instantsearch.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,21 @@ define(
660660
}
661661
});
662662

663-
var isStarted = false;
663+
// Capture active redirect URL with IS facet params for add to cart from PLP
664+
if (algoliaConfig.instant.isAddToCartEnabled) {
665+
search.on('render', () => {
666+
const cartForms = document.querySelectorAll('[data-role="tocart-form"]');
667+
cartForms.forEach((form, i) => {
668+
const ts = Date.now();
669+
form.addEventListener('submit', e => {
670+
const url = `${algoliaConfig.request.url}${window.location.search}`;
671+
e.target.elements[algoliaConfig.instant.addToCartParams.redirectUrlParam].value = AlgoliaBase64.mageEncode(url);
672+
})
673+
});
674+
});
675+
}
676+
677+
var isStarted = false;
664678

665679
function startInstantSearch() {
666680
if (isStarted === true) {

0 commit comments

Comments
 (0)