// Похожие товары
if ($Shop_Controller_Show->item)
{
$group_related = $Shop_Controller_Show->group;
$item_related = $Shop_Controller_Show->item;
$oShop = $Shop_Controller_Show->getEntity();
// XML-сущность, к которй будут добавляться производители
$oRelatedXmlEntity = Core::factory('Core_Xml_Entity')->name('related');
// Добавляем XML-сущность контроллеру показа
$Shop_Controller_Show->addEntity($oRelatedXmlEntity);
$Shop_Controller_Show_Related = new Shop_Controller_Show(
Core_Entity::factory('Shop', 1)
);
$Shop_Controller_Show_Related
->group($group_related);
$Shop_Controller_Show_Related
->shopItems()
->queryBuilder()
->where('shop_items.id', '!=', $item_related)
->clearOrderBy()
->orderBy('RAND()');
$Shop_Controller_Show_Related
/*->xsl(
Core_Entity::factory('Xsl')->getByName('КаталогТоваровМагазин')
)*/
->limit(6)
/*->show()*/;
foreach ($Shop_Controller_Show_Related as $oShop_Controller_Show_Related)
{
$oShop_Item = Core_Entity::factory('Shop_Item')->find($oShop_Controller_Show_Related->shop_item_id);
if (!is_null($oShop_Item->id))
{
$this->itemsProperties && $oShop_Item->showXmlProperties($this->itemsProperties);
$oRelatedXmlEntity->addEntity($oShop_Item->clearEntities());
}
}
//$oRelatedXmlEntity->addEntity($Shop_Controller_Show_Related->clearEntities());
}