Multiple facets and list all products from start (example project)
Hi,
I tested your Bobo Facets Package on a Umbraco 7.7.3 installation with the default starter kit. I got it working (kind of) following your example project (DesignAgency.BoboFacets.Example).
I have a couple of questions though that maybe you could help me with.
In your example whenever I visit the products page, only 1 product is listed by default. I have to choose from one of the filters to see more products. Is it possible to list all products by default?
Is it possible to build the query to handle multiple facets by using checkboxes instead (se picture)? So the query string becomes something like: products/?fsize=L&XL&fcolor=Black&Red
Glad you managed to get it up and running in the end, if you have any suggestions on how to improve the setup then let me know.
With regards to your queries:
This is just because it's using the ExternalIndex by default which indexes lots of other pages. So the first 10 results without a query only include's one "Product". You can change this by overriding the "BuildBaseQuery" method in your browser and specify you only want products at this level (See example below)
public override ISearchCriteria BuildBaseQuery(List<KeyValuePair<string, string>> querystring)
{
return ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("product").Compile();
}
For this, you will need to override and implement the "CreateBrowseRequest" yourself and then split the query string key accordingly. This is something that could probably be improved to make it easier to extend this.
Thank you so much for your help, I really appreciate it! Your solution worked fine but led to a couple more questions :).
I added the override for the "BuildBaseQuery" and the other products got listed just like you said, but if I understand you correctly and add more than 10 products, only the first 10 will show up? Can I override this number in the ExamineSettings or something to be like 30 instead?
Got it. Something for me too look into a little later on, I'm still a novice and trying to get a grip on this whole Examine thing. Trying to find some suitable tutorials :).
Is it possible to change the sort order of the products listed from options in a select list (see picture)?
There is another method you can override in your broswer called
"DetermineSort" which gets passed the querystring so you can then determine and return your required sort. If you take a look at the "IFacetBrowser" interface it should give you an idea of the methods that are available to you.
Unfortunately I could not get neither the custom page size or the sort to work.
This is the browseRequest I use (the one from your example) in my ProductsController, and I tried to set the "itemsPerPage" parameter to 30 but could not get it to work.
var browserRequest = browser.CreateBrowseRequest(Request.QueryString.AllKeys.SelectMany(Request.QueryString.GetValues, (k, v) => new KeyValuePair<string, string>(k, v)).ToList());
Multiple facets and list all products from start (example project)
Hi,
I tested your Bobo Facets Package on a Umbraco 7.7.3 installation with the default starter kit. I got it working (kind of) following your example project (DesignAgency.BoboFacets.Example).
I have a couple of questions though that maybe you could help me with.
Thanks in advance!
/Marcus
Hi Marcus,
Glad you managed to get it up and running in the end, if you have any suggestions on how to improve the setup then let me know.
With regards to your queries:
Hope this helps.
Thanks, Tom
Hi Tom,
Thank you so much for your help, I really appreciate it! Your solution worked fine but led to a couple more questions :).
I added the override for the "BuildBaseQuery" and the other products got listed just like you said, but if I understand you correctly and add more than 10 products, only the first 10 will show up? Can I override this number in the ExamineSettings or something to be like 30 instead?
Got it. Something for me too look into a little later on, I'm still a novice and trying to get a grip on this whole Examine thing. Trying to find some suitable tutorials :).
Is it possible to change the sort order of the products listed from options in a select list (see picture)?
Many thanks, Marcus
Hi Marcus,
That's okay no worries.
Thanks, Tom
Hi Marcus,
How did you get on with your implementation? If it's all sorted, would you mind marking this as solved?
Cheers, Tom
Hi Tom,
Unfortunately I could not get neither the custom page size or the sort to work.
This is the browseRequest I use (the one from your example) in my ProductsController, and I tried to set the "itemsPerPage" parameter to 30 but could not get it to work.
/Marcus
is working on a reply...