Sitecore 7 - 具有搜索相对路径的多列表

时间:2015-10-02 13:20:20

标签: sitecore sitecore7

给出以下结构

Home
    Storage
        Article1
        Article2
        Article3
    Products
        Product

product有一个Multilist with search字段,其中的目标是storage项。如何设置 StartSearchLocation 相对于产品?

我尝试了以下

StartSearchLocation=query:[parent::item[@@templatename=Home]]/Storage

1 个答案:

答案 0 :(得分:2)

您可以将以下内容添加到模板的Source字段中;

query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*

这将寻找祖先(或者自己)的模板是Home,然后寻找具有存储模板的家庭的孩子。然后它将选择存储下的所有项目。

您甚至可以更进一步,确保它只选择存储下的文章项目;

query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*[@@templatename = 'articles']

虽然我不建议使用templatename,而是使用Templateid;

query:ancestor-or-self:: *[@@templateid = '{96563B8C-A000-488C-B7E2-96008C24F3D3}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']

别忘了用你的Guids替换

相关问题