Make it possible to select only one Option for a specific Property in Shopware 6 filter - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Friday, May 26, 2023

Make it possible to select only one Option for a specific Property in Shopware 6 filter

Does someone know, how to make it possible to select only one Option for a specific Property in Shopware 6 filter?

document.addEventListener('DOMContentLoaded', function() {
  document.querySelector('.filter-multi-select-properties').onchange = changeEventHandler;
}, false);

function changeEventHandler(e) {
  var checkboxsel = document.querySelectorAll('.filter-property-select-checkbox');
  checkboxsel.forEach(function(checkbox) {
    if (checkbox != e.target)
      checkbox.checked = false;
  });
}

With this code I'm able to uncheck previously selected option. But a (only one) previous option still remains in 'filter-active'



source https://stackoverflow.com/questions/76323814/make-it-possible-to-select-only-one-option-for-a-specific-property-in-shopware-6

No comments:

Post a Comment