Skip to content

Commit 4e76dd9

Browse files
authored
Merge pull request #1437 from algolia/bugfix/MAGE-795
MAGE-795 Fixes clear refinements button from not showing
2 parents f8d81d1 + a8b4dd5 commit 4e76dd9

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

view/frontend/web/instantsearch.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -301,35 +301,6 @@ define(
301301
});
302302
},
303303

304-
/*
305-
* clearRefinements
306-
* Widget displays a button that lets the user clean every refinement applied to the search. You can control which attributes are impacted by the button with the options.
307-
* Docs: https://www.algolia.com/doc/api-reference/widgets/clear-refinements/js/
308-
**/
309-
clearRefinements: {
310-
container : '#clear-refinements',
311-
templates : {
312-
resetLabel: algoliaConfig.translations.clearAll,
313-
},
314-
includedAttributes: attributes.map(function (attribute) {
315-
if (!(algoliaConfig.isCategoryPage && attribute.name.indexOf('categories') > -1)) {
316-
return attribute.name;
317-
}
318-
}),
319-
cssClasses : {
320-
button: ['action', 'primary']
321-
},
322-
transformItems : function (items) {
323-
return items.map(function (item) {
324-
var attribute = attributes.filter(function (_attribute) {
325-
return item.attribute === _attribute.name
326-
})[0];
327-
if (!attribute) return item;
328-
item.label = attribute.label;
329-
return item;
330-
})
331-
}
332-
},
333304
/*
334305
* queryRuleCustomData
335306
* The queryRuleCustomData widget displays custom data from Query Rules.
@@ -341,6 +312,36 @@ define(
341312
default: '{{#items}} {{#banner}} {{{banner}}} {{/banner}} {{/items}}',
342313
}
343314
}
315+
},
316+
317+
/*
318+
* clearRefinements
319+
* Widget displays a button that lets the user clean every refinement applied to the search. You can control which attributes are impacted by the button with the options.
320+
* Docs: https://www.algolia.com/doc/api-reference/widgets/clear-refinements/js/
321+
**/
322+
clearRefinements: {
323+
container : '#clear-refinements',
324+
templates : {
325+
resetLabel: algoliaConfig.translations.clearAll,
326+
},
327+
includedAttributes: attributes.map(function (attribute) {
328+
if (!(algoliaConfig.isCategoryPage && attribute.name.indexOf('categories') > -1)) {
329+
return attribute.name;
330+
}
331+
}),
332+
cssClasses : {
333+
button: ['action', 'primary']
334+
},
335+
transformItems : function (items) {
336+
return items.map(function (item) {
337+
var attribute = attributes.filter(function (_attribute) {
338+
return item.attribute === _attribute.name
339+
})[0];
340+
if (!attribute) return item;
341+
item.label = attribute.label;
342+
return item;
343+
})
344+
}
344345
}
345346
};
346347

@@ -727,4 +728,4 @@ define(
727728
return options;
728729
}
729730
}
730-
);
731+
);

0 commit comments

Comments
 (0)