I'm working on a project, where we will allow the user to filter content. The filter tags are hierarchical, which is why we chose to use uTaxonomy.
Setting the filter tags for the content in a partial view works fine, but we also would like to show all the possible filter tags in a filter module.
Is there a way to access all uTaxonomy values and present them to the user?
Sorry for being vague here, I've just started using Umbraco and Razor templates.
That only seems to work if you have added the taxonomy to the particular partial view. What we would like to do is get all the available options, regardless of whether they have been selected or not, and present them to the user in a different partial view.
I have a "Content" partial view, where the editor/admin can select (and sometimes manipulate) a taxonomy hierarchy (for example Country - State - City).
Then there is another "Filter" partial view, where we would like the user to see all the available taxonomy content, regardless of whether it has been selected for the content or not, i.e. all countries, all states and all cities.
The solution you suggested doesn't seem to work for me. :/
It's working now! I took a second look and realized that I had been confused with the Datatype name and the title of it on the partial view.
Thanks a lot! :)
Get all uTaxonomy options on one page
Hi,
I'm working on a project, where we will allow the user to filter content. The filter tags are hierarchical, which is why we chose to use uTaxonomy. Setting the filter tags for the content in a partial view works fine, but we also would like to show all the possible filter tags in a filter module. Is there a way to access all uTaxonomy values and present them to the user? Sorry for being vague here, I've just started using Umbraco and Razor templates.
Thanks! /Fredrik
Hi Fredrik,
Yes you can get all items if you know datatype name.
You can find more information here
In my opinion, you need to use
or
First code returns hierarchical structure, the second code returns flatten list.
I hope I helped you!
Thanks
That only seems to work if you have added the taxonomy to the particular partial view. What we would like to do is get all the available options, regardless of whether they have been selected or not, and present them to the user in a different partial view.
I have a "Content" partial view, where the editor/admin can select (and sometimes manipulate) a taxonomy hierarchy (for example Country - State - City).
Then there is another "Filter" partial view, where we would like the user to see all the available taxonomy content, regardless of whether it has been selected for the content or not, i.e. all countries, all states and all cities.
The solution you suggested doesn't seem to work for me. :/
Not exactly!
When you add new Taxonomy, you add it in Data Types section.
It means that this Taxonomy not bound with concrete Document type!
In turn, this means that the code, which I gave you as an example gets all the items from the Taxonomy by Datatype name.
Thanks, Vitaly
It's working now! I took a second look and realized that I had been confused with the Datatype name and the title of it on the partial view. Thanks a lot! :)
Your are welcome!
is working on a reply...