Close

Modify the UI model

reencafesa
6 years ago
#13604 Quote
Avatar
  • 4
Hello everyone, I want to filter this way:
[Specification_1] [Specification_2] ... [Specification_N]
Or so that [Categories] or [Manufacturers] have the option of everything available and this is always by default, I need to filter without categories or manufacturers.

Thanks
hristian.dimov
6 years ago
#13606 Quote
Avatar
  • Moderator
  • 386
reencafesa wrote:
Hello everyone, I want to filter this way:
[Specification_1] [Specification_2] ... [Specification_N]
Or so that [Categories] or [Manufacturers] have the option of everything available and this is always by default, I need to filter without categories or manufacturers.

Thanks


Hi,

unfortunately, this is not possible. It is mandatory to have a category or manufacturer for the first drop-down. Since there is no page where you can see all products from all categories/all manufacturers having an "All available" option is not possible as well.

Hope this helps!
Regards,
Hristian Dimov
Nop-Templates.com
reencafesa
6 years ago
#13619 Quote
Avatar
  • 4
Can I put a default category or manufacturer in the filter?
hristian.dimov
6 years ago
#13625 Quote
Avatar
  • Moderator
  • 386
reencafesa wrote:
Can I put a default category or manufacturer in the filter?


Yes, you can. All you have to do is to modify the "\Plugins\SevenSpikes.Nop.Plugins.AjaxFilters.Pro\Views\AjaxFiltersPro\NopFiltersPro.cshtml" by adding this code at the bottom of the file:

<script type="text/javascript">
    $(document).ready(function() {
        var dropdownlist = $("#categories").data("kendoDropDownList");

        dropdownlist.value("1");
        dropdownlist.trigger("change");

        $(document).on('nopAjaxFiltersProInitialLoadEvent', function () {
            $('.home-page-filter-selector:first input').trigger('change');
        });
    });
</script>

where $("#categories") is the categories dropdown and .value("1"); is the "id" of the category that you want to pre-select by default.

P.S. if you want to pre-select the manufacturer dropdown instead of categories, change it like this - $("#manufacturers").

P.S 2 - you might wanna change the default value of the specification inputs to "-1" because if you left it with value 0, this will trigger a chain reaction and it will load all of the dropdowns.

from this: <input type="hidden" id="specification_@(spec.Id)" name="specificationOptions" value="0" class="ajaxFiltersProSpecificationItem"

to this: <input type="hidden" id="specification_@(spec.Id)" name="specificationOptions" value="-1" class="ajaxFiltersProSpecificationItem"

Hope this helps!
Regards,
Hristian Dimov
Nop-Templates.com
reencafesa
6 years ago
#13629 Quote
Avatar
  • 4
hristian.dimov wrote:
Can I put a default category or manufacturer in the filter?

Yes, you can. All you have to do is to modify the "\Plugins\SevenSpikes.Nop.Plugins.AjaxFilters.Pro\Views\AjaxFiltersPro\NopFiltersPro.cshtml" by adding this code at the bottom of the file:

<script type="text/javascript">
    $(document).ready(function() {
        var dropdownlist = $("#categories").data("kendoDropDownList");

        dropdownlist.value("1");
        dropdownlist.trigger("change");

        $(document).on('nopAjaxFiltersProInitialLoadEvent', function () {
            $('.home-page-filter-selector:first input').trigger('change');
        });
    });
</script>

where $("#categories") is the categories dropdown and .value("1"); is the "id" of the category that you want to pre-select by default.

P.S. if you want to pre-select the manufacturer dropdown instead of categories, change it like this - $("#manufacturers").

P.S 2 - you might wanna change the default value of the specification inputs to "-1" because if you left it with value 0, this will trigger a chain reaction and it will load all of the dropdowns.

from this: <input type="hidden" id="specification_@(spec.Id)" name="specificationOptions" value="0" class="ajaxFiltersProSpecificationItem"

to this: <input type="hidden" id="specification_@(spec.Id)" name="specificationOptions" value="-1" class="ajaxFiltersProSpecificationItem"

Hope this helps!


Excellent, thank you very much now I only have one thing missing. Is it possible to have multiple filter instances? I need in my home, multiple UI modes with different attribute specifications?
reencafesa
6 years ago
#13636 Quote
Avatar
  • 4
Excellent, thank you very much now I only have one thing missing. Is it possible to have multiple filter instances? I need in my home, multiple UI modes with different attribute specifications?