Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi All, I am looking to build a filter function for the collections for a store I have wedding dress store. The design has a filter at the top.
I do not need much, once I have the right pointers I can handle the rest. It would be much appreciated - Thank You.
I had to work this out myself, little to know documentation and the notes on the intellisense are pretty vague.
First you need to get the filters:
var theFilterGroups = merchelloHelper.Filters.Product.GetAll()
This will give you the filter groups that have been created. You can then loop through these.
@foreach (var item in theFilterGroups){}
To then get all the filter themselves for each group:
var itemsFilters = item.Filters.ToList();
And then you can loop through them:
@foreach (var itemFilter in itemsFilters){}
Example of a solution:
@{ var theFilterGroups = merchelloHelper.Filters.Product.GetAll(); } @foreach (var item in theFilterGroups){ <h5>@item.Name.ToString()</h5> @var itemsFilters = item.Filters.ToList(); <div class="the-filters"> @foreach (var itemFilter in itemsFilters){ <span>@itemFilter.Name.ToString()</span> } </div> }
Hi Liam
Just thought I'd add a note here regarding filtering products - I was having a similar problem and wrote a post here:
https://our.umbraco.com/packages/collaboration/merchello/merchello/94099-filters#comment-297596
Andrew
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Display product filters
Hi All, I am looking to build a filter function for the collections for a store I have wedding dress store. The design has a filter at the top.
I do not need much, once I have the right pointers I can handle the rest. It would be much appreciated - Thank You.
I had to work this out myself, little to know documentation and the notes on the intellisense are pretty vague.
First you need to get the filters:
This will give you the filter groups that have been created. You can then loop through these.
To then get all the filter themselves for each group:
And then you can loop through them:
Example of a solution:
Hi Liam
Just thought I'd add a note here regarding filtering products - I was having a similar problem and wrote a post here:
https://our.umbraco.com/packages/collaboration/merchello/merchello/94099-filters#comment-297596
Andrew
is working on a reply...