• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/transferprovidercompatibility.php
  • Класс: BitrixSaleInternalsTransferProviderCompatibility
  • Вызов: TransferProviderCompatibility::isNeedShip
public function isNeedShip(array $products)
{
	MainLoader::includeModule('catalog');
	$result = new SaleResult();

	$resultNeedShipList = array();
	$needShipmentItemList = array();

	$shipmentItemList = static::getShipmentItemListFromProducts($products);
	if (!empty($shipmentItemList))
	{
		/** @var SaleShipmentItem $shipmentItem */
		foreach ($shipmentItemList as $shipmentItem)
		{
			/** @var SaleShipmentItemCollection $shipmentItemCollection */
			$shipmentItemCollection = $shipmentItem->getCollection();
			if (!$shipmentItemCollection)
			{
				throw new MainObjectNotFoundException('Entity "ShipmentItemCollection" not found');
			}

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

			$basketItem = $shipmentItem->getBasketItem();

			$provider = $basketItem->getProviderEntity();

			if ($provider instanceof CatalogProductCatalogProvider)
			{
				continue;
			}

			$needShipmentItemList[$shipmentItem->getInternalIndex()] = $shipmentItem;
		}
	}

	if (!empty($needShipmentItemList))
	{
		$r = SaleProvider::isNeedShip($needShipmentItemList);
		if (!$r->isSuccess())
		{
			$result->addErrors($r->getErrors());
		}

		$data = $r->getData();
		if (!empty($data) && is_array($data))
		{
			$needShipmentItemList = $data;
		}

	}

	if (!empty($needShipmentItemList))
	{
		$result->setData(
			array(
				'IS_NEED_SHIP' => $needShipmentItemList
			)
		);
	}

	return $result;
}