In sitecore get all the child and child items with a quick request

At sitecore, I want to get all the children and grandchildren who inherited the Industrial Product Template form.

The following is a quick request, but its error Error: end of line expected at position 5.

Quick inquiry:

_masterdb.SelectItems("query:/sitecore/content/Product Catalog/Industrial/Products/*[@@templatename='Industrial Product']")

+4
source share
4 answers

This is not a quick request, you are using a regular request. Please use something like:

Sitecore.Data.Items.Item[] items = 
 database.SelectItems("fast:/sitecore/content/Product Catalog/Industrial/Products//*[@@templateid='yourTemplateId']"); 

Also use @@ templateid not @@ templatename, I did some tests and faster using @@ templateid.

Also see here about using FastQuery.

+6
source

, , :

_masterdb.SelectItems("fast:/sitecore/content/Product Catalog/Industrial/Products//*[@@templatename='Industrial Product']");

:

  • query fast. , "" Sitecore Query, Sitecore. , .
  • *[@@templatename='Industrial Product'], //. , . .

, @@templateid @@templatename, sitecore climber , , , . , :

fast:/sitecore/content/Product Catalog/Industrial/Products//*[@@templateid='{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}']

. . .

+6

,

_masterdb.SelectItems( "query:/sitecore/content/# #/Industrial/Products//* [@@templatename = 'Industrial Product']" )

+2

_masterdb.SelectItems("fast:/sitecore/content/#Product Catalog#/Industrial/Products//*[@@templatename='Industrial Product']")

_masterdb.SelectItems("fast:/sitecore/content/#Product Catalog#/Industrial/Products//*[@@templatename='Industrial Product']")

, , @# #.

0

Source: https://habr.com/ru/post/1529123/


All Articles