А как вывести случайные элементы из определенных групп ИС заменяю Shop на Informationsystem.
Все отдельно (без условий) работает, а с условиями не хочет.
<?php
$Structure_Controller_Show = new Structure_Controller_Show(
Core_Entity::factory('Site', CURRENT_SITE));
$structure_parent_id_array[] = $structure_parent_id = CURRENT_STRUCTURE_ID;
while ($structure_parent_id != 0)
{
$oStructure = Core_Entity::factory('Structure', $structure_parent_id);
$structure_parent_id = $oStructure->parent_id;
$structure_parent_id_array[] = $structure_parent_id;
}
?>
<div class="publicR publ_h1"><h1><a href="/press-center/information_materials/">ИНФОРМАЦИОННЫЕ МАТЕРИАЛЫ</a></h1></div>
<?php
if (Core::moduleIsActive('informationsystem'

)
{
$oShop = Core_Entity::factory('informationsystem', 87);
// Выбрать всех потомков
function getChildren($oParentInformationsystemGroup, $aGroups = array())
{
$aGroups[] = $oParentInformationsystemGroup->id;
$aChildren = $oParentInformationsystemGroup->Informationsystem_Groups->getAllByActive(1);
foreach ($aChildren as $oChildrenGroup)
{
$aGroups = getChildren($oChildrenGroup, $aGroups);
}
return $aGroups;
}
$aGroups1 = getChildren(Core_Entity::factory('Informationsystem_Group', 670));
$aGroups2 = getChildren(Core_Entity::factory('Informationsystem_Group', 668));
$aGroupsRes = array_merge((array)$aGroups1, (array)$aGroups2);
$Informationsystem_Controller_Show = new Informationsystem_Controller_Show(
$oShop
);
$Informationsystem_Controller_Show
->informationsystemItems()
->queryBuilder()
->clearOrderBy()
->orderBy('RAND()'

->where('informationsystem_items.informationsystem_group_id', 'IN', $aGroupsRes);
$Informationsystem_Controller_Show
->xsl(
Core_Entity::factory('Xsl'

->getByName('СписокЭлементовPUBL_second'

)
->groupsMode('tree'

->group(FALSE)
->limit(3)
->itemsProperties(TRUE)
->itemsPropertiesList(FALSE);
if (CURRENT_STRUCTURE_ID != 580) {
$oCore_QueryBuilder_Select2 = Core_QueryBuilder::select('properties.id'

->from('properties'

->where('properties.tag_name', 'LIKE', 'listIdStructure'

;
$Informationsystem_Controller_Show
->informationsystemItems()
->queryBuilder()
->leftJoin('property_value_strings', 'informationsystem_items.id', '=', 'property_value_strings.entity_id'

->where('property_value_strings.property_id', 'IN', $oCore_QueryBuilder_Select2)
->open();
foreach ($structure_parent_id_array as $v) {
$Informationsystem_Controller_Show
->informationsystemItems()
->queryBuilder()
->where('property_value_strings.value', 'LIKE', '%,'.$v.',%'

->setOr();
//echo Core_DataBase::instance()->getLastQuery();
}
}
if (CURRENT_STRUCTURE_ID == 580) {
$Informationsystem_Controller_Show->show();
}
else {
$Informationsystem_Controller_Show
->informationsystemItems()
->queryBuilder()
->close()
->clearOrderBy()
->orderBy('RAND()'

->where('property_value_strings.value', '=', ''

;
}
$Informationsystem_Controller_Show->show();
}
?>