Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mage 674 #1370

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 12 additions & 10 deletions view/frontend/web/instantsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,16 +639,18 @@ define(
var isStarted = false;

// Capture active redirect URL with IS facet params for add to cart from PLP
search.on('render', () => {
const cartForms = document.querySelectorAll('[data-role="tocart-form"]');
cartForms.forEach((form, i) => {
const ts = Date.now();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts constant is not actually being used anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - thanks! We'll be sure to remove this.

form.addEventListener('submit', e => {
const url = `${algoliaConfig.request.url}${window.location.search}`;
e.target.elements[algoliaConfig.instant.addToCartParams.redirectUrlParam].value = AlgoliaBase64.mageEncode(url);
})
});
});
if (algoliaConfig.instant.isAddToCartEnabled) {
search.on('render', () => {
const cartForms = document.querySelectorAll('[data-role="tocart-form"]');
cartForms.forEach((form, i) => {
const ts = Date.now();
form.addEventListener('submit', e => {
const url = `${algoliaConfig.request.url}${window.location.search}`;
e.target.elements[algoliaConfig.instant.addToCartParams.redirectUrlParam].value = AlgoliaBase64.mageEncode(url);
})
});
});
}

function startInstantSearch() {
if (isStarted === true) {
Expand Down