<?php
$oShop = Core_Entity::factory('Shop', 1);
$Shop_Controller_Show = new Shop_Controller_Show(
$oShop
);
$Shop_Controller_Show
->xsl(
Core_Entity::factory('Xsl')->getByName('МагазинКаталогТоваров')
)
->limit(5)
->groupsMode('none');
$oShop_Groups = $oShop->Shop_Groups;
// Объединение с нужной таблицей свойств
$oShop_Groups
->queryBuilder()
->select('shop_groups.*')
->leftJoin('shop_group_properties', 'shop_groups.shop_id', '=', 'shop_group_properties.shop_id')
->leftJoin('property_value_ints', 'shop_groups.id', '=', 'property_value_ints.entity_id',
array(
array('AND' => array('shop_group_properties.property_id', '=', Core_QueryBuilder::expression('`property_value_ints`.`property_id`')))
)
)
// Идентификатор дополнительного свойства
->where('shop_group_properties.property_id', '=', 6162)
// Значание дополнительного свойства
->where('property_value_ints.value', '=', 123)
->groupBy('shop_groups.id')
// Количество свойств
->having(Core_Querybuilder::expression('COUNT(DISTINCT `shop_group_properties`.`property_id`)'), '=', 1);
$aShop_Groups = $oShop_Groups->findAll();
foreach($aShop_Groups as $oShop_Group)
{
// Добавляем потомком XML-сущности
$Shop_Controller_Show->addEntity(
$oShop_Group->clearEntities()
);
}
$Shop_Controller_Show->show();
?>