• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/transferprovidercompatibility.php
  • Класс: BitrixSaleInternalsTransferProviderCompatibility
  • Вызов: TransferProviderCompatibility::getProductListStores
public function getProductListStores(array $products)
{
	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->getSiteId();

				if (!isset($productParamsList[$hash]))
				{
					$productParamsList[$hash] = array(
						'PRODUCT_ID' => $productId,
						'SITE_ID' => $order->getSiteId(),
					);
				}

			}
		}
		else
		{
			$hash = SITE_ID;
			if (!isset($productParamsList[$hash]))
			{
				$productParamsList[$hash] = array(
					'PRODUCT_ID' => $productId,
					'SITE_ID' => SITE_ID,
				);
			}
		}

		foreach ($productParamsList as $productParams)
		{
			$r = SaleProvider::getStores($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(
				'PRODUCT_STORES_LIST' => $resultList
			)
		);
	}

	return $result;
}