Search code examples
filterprestashop

Make filters sidebar disappear


I would like to give users the ability to hide the filters sidebar so that it appears and disappears at the push of a button. Is this possible?

Thanks.


Solution

  • By default, this feature is not included in the PrestaShop, but you can create it.

    Add the new button for example to the themes/classic/templates/catalog/_partials/category-header.tpl

    <button class="btn" id="show_hide_filter">Show/hide filters</button>
    

    and with manipulate the DOM with jQuery

      document.addEventListener("DOMContentLoaded", function() {
        $('#show_hide_filter').click(function () {
          if($("#left-column").is(":visible")){
            $("#left-column").hide();
            $('#content-wrapper').addClass('col-lg-12');
          }else{
            $("#left-column").show();
            $('#content-wrapper').removeClass('col-lg-12');
          }
        })
      });