Reputation: 1
So I am pretty new to Sitecore, and I seem to have gotten myself into an issue that I cant solve or google ;)
So I have an item, this Item has a treelist, and that treelist has a datasource "Products". Now this works fine, the issue is that I only want the items (products) displayed in my treelist, where the Product Category is "Shoes".
The Product template has a Multilist named "Categories", so i would like a query, that evaluated if one of the Categories is "Shoes" if so, include the Product in my Treelist, if not exclude it.
Can it be done with a query or do I need to do some actual code to get that result?
Any help would be much appriciated.
Upvotes: 0
Views: 1041
Reputation: 1879
You can use Sitecore's fast query in source field of template field as below:
Using contains:
fast:/sitecore/content/Home/Products//*[contains(@Categories = 'IdOfShoesItem')]
Using like:
fast:/sitecore/content/Home/Products//*[@Categories = '%IdOfShoesItem%']
On older sitecore version fast query does not work, in those cases replace "fast" with "query" like below:
query:/sitecore/content/Home/Products//*[@Categories = '%IdOfShoesItem%']
Upvotes: 0