• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/basketitem.php
  • Класс: BitrixSaleBasketItem
  • Вызов: BasketItem::loadBundleCollectionFromProvider
protected function loadBundleCollectionFromProvider()
{
	global $USER;

	$bundleChildList = [];

	/** @var BasketItemCollection $basket */
	if (!$basket = $this->getCollection())
	{
		throw new MainObjectNotFoundException('Entity "Basket" not found');
	}

	/** @var Order $order */
	$order = $basket->getOrder();
	if ($order)
	{
		$context = [
			'SITE_ID' => $order->getSiteId(),
			'USER_ID' => $order->getUserId(),
			'CURRENCY' => $order->getCurrency(),
		];
	}
	else
	{
		$context = [
			'SITE_ID' => SITE_ID,
			'USER_ID' => $USER && $USER->GetID() > 0 ? $USER->GetID() : 0,
			'CURRENCY' => CurrencyManager::getBaseCurrency(),
		];
	}

	$creator = InternalsProviderCreator::create($context);
	$creator->addBasketItem($this);
	$r = $creator->getBundleItems();
	if ($r->isSuccess())
	{
		$resultProductListData = $r->getData();
		if (!empty($resultProductListData['BUNDLE_LIST']))
		{
			$bundleChildList = $resultProductListData['BUNDLE_LIST'];
		}
	}

	if (empty($bundleChildList))
	{
		return null;
	}

	$this->bundleCollection = $this->setItemsAfterGetBundle($bundleChildList);
	return $this->bundleCollection;
}