- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/internals/transferprovidercompatibility.php
- Класс: BitrixSaleInternalsTransferProviderCompatibility
- Вызов: TransferProviderCompatibility::viewProduct
public function viewProduct(array $products)
{
global $USER;
MainLoader::includeModule('catalog');
$result = new SaleResult();
$resultList = array();
$productOrderList = CatalogProductCatalogProvider::createOrderListFromProducts($products);
foreach ($products as $productId => $productData)
{
$productParamsList = array();
if (!empty($productOrderList[$productId]))
{
/** @var SaleOrder $order */
foreach ($productOrderList[$productId] as $order)
{
$hash = $order->getUserId()."|".$order->getSiteId();
if (!isset($productParamsList[$hash]))
{
$productParamsList[$hash] = array(
'PRODUCT_ID' => $productId,
'USER_ID' => $order->getUserId(),
'SITE_ID' => $order->getSiteId(),
);
}
}
}
else
{
$hash = $USER->getId() . "|" .SITE_ID;
if (!isset($productParamsList[$hash]))
{
$productParamsList[$hash] = array(
'PRODUCT_ID' => $productId,
'USER_ID' => $USER->getId(),
'SITE_ID' => SITE_ID,
);
}
}
foreach ($productParamsList as $productParams)
{
$r = SaleProvider::getViewProduct($this->getProviderClass(), $productParams);
if ($r->isSuccess())
{
$resultData = $r->getData();
if (array_key_exists($productId, $resultData))
{
$resultList[$productId] = $resultData[$productId];
}
}
}
}
if (!empty($resultList))
{
$result->setData(
array(
'VIEW_PRODUCTS_LIST' => $resultList
)
);
}
return $result;
}