• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/product/catalogprovider.php
  • Класс: BitrixCatalogProductCatalogProvider
  • Вызов: CatalogProvider::createOrderListFromProducts
static function createOrderListFromProducts(array $products)
	{
		$productOrderList = array();
		foreach ($products as $productId => $productData)
		{
			if (!empty($productData['SHIPMENT_ITEM_LIST']))
			{
				/**
				 * @var $shipmentItemIndex
				 * @var SaleShipmentItem $shipmentItem
				 */
				foreach ($productData['SHIPMENT_ITEM_LIST'] as $shipmentItem)
				{
					$shipmentItemCollection = $shipmentItem->getCollection();
					if (!$shipmentItemCollection)
					{
						throw new MainObjectNotFoundException('Entity "ShipmentItemCollection" not found');
					}

					$shipment = $shipmentItemCollection->getShipment();
					if (!$shipment)
					{
						throw new MainObjectNotFoundException('Entity "Shipment" not found');
					}

					/** @var SaleShipmentCollection $shipmentCollection */
					$shipmentCollection = $shipment->getCollection();
					if (!$shipmentCollection)
					{
						throw new MainObjectNotFoundException('Entity "ShipmentCollection" not found');
					}

					$order = $shipmentCollection->getOrder();
					if (!$order)
					{
						throw new MainObjectNotFoundException('Entity "Order" not found');
					}

					if (empty($productOrderList[$productId][$order->getId()]))
					{
						$productOrderList[$productId][$order->getId()] = $order;
					}
				}
			}
		}

		return $productOrderList;
	}