Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

_FilterManufacturerBox.cshtml

@model ManufacturerFilterModel

<div class="product-filter product-manufacturer-filter">
    <h2 class="filter-title">
        @T("Filtering.ManufacturerFilter")
    </h2>
    <div class="filter-content">
        <ul class="group product-manufacturer-group">
            @foreach (var manufacturer in Model.Manufacturers)
            {
                <li class="item">
                    <input id="attribute-manufacturer-@manufacturer.Value" type="checkbox" data-manufacturer-id="@manufacturer.Value" checked="@manufacturer.Selected" />
                    <label for="attribute-manufacturer-@manufacturer.Value">
                        @manufacturer.Text
                    </label>
                </li>
            }
        </ul>
    </div>
</div>
<script asp-location="Footer">
    $(function() {
        var $msEls = $('[data-manufacturer-id]');
        $msEls.on('change', function () {
            CatalogProducts.getProducts();
        });

        $(CatalogProducts).on('before', function (e) {
            var selectedMs = $.map($msEls, function (el) {
                var $mEl = $(el);
                if ($mEl.is(':checked')) return $mEl.data('manufacturer-id')
                return null;
            });

            if (selectedMs && selectedMs.length > 0) {
                e.payload.urlBuilder
                    .addParameter('ms', selectedMs.join(','));
            }
        });
    });
</script>