• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/product/catalogprovider.php
  • Класс: BitrixCatalogProductCatalogProvider
  • Вызов: CatalogProvider::calculateQuantityFromShipments
static function calculateQuantityFromShipments(array $list): ?array
	{
		$result = [];
		$found = false;
		foreach ($list as $basketItemShipments)
		{
			if (
				empty($basketItemShipments)
				|| !is_array($basketItemShipments)
			)
			{
				continue;
			}
			foreach ($basketItemShipments as $basketItemStores)
			{
				foreach ($basketItemStores as $storeId => $quantity)
				{
					if (!isset($result[$storeId]))
					{
						$result[$storeId] = 0;
					}
					$result[$storeId] += (float)$quantity;
					$found = true;
				}
			}
		}

		return ($found ? $result : null);
	}