How can i change the layered navigation for each category?
-
How can I change the layered navigation for each category?
-
Hi,
To do such you must look into this blade file in**shop/resources/product/list/layered-navigation.blade.php**.
In this blade file you can place down the conditions for your
attributes belonging to respective category loaded, which is
identifiable by slug.And you must find the products belonging to that category and
attributes of those product that have used in layered navigation
property. -
Hi!
In
shop/resources/product/list/layered-navigation.blade.php
all the attributes are fetched, regardless of a category...
data: () => ({
attributes: @json($attributeRepository->getFilterAttributes()),
appliedFilters: {}
}),The getFilterAttribues could accept a category slug, and if there is an attribute_family with that slug, their attributes could be returned.
BTW I would like to show only those attributes for filtering which the products have in the current category.
-
Hi,
To achieve your requirements, you need write your own code in this method & it could be done like.
- pass category in getFilterAttribues function.
- get product belongs to that category.
- retrieve attributes of those product.
Thanks
Rahul Shukla