Order::loadShopValues

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Order
  4. loadShopValues
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/bizproc/document/valuecollection/order.php
  • Класс: Bitrix\Crm\Integration\BizProc\Document\ValueCollection\Order
  • Вызов: Order::loadShopValues
protected function loadShopValues(): void
{
	$order = $this->getOrder();
	if (!$order)
	{
		return;
	}

	$collection = $order->getTradeBindingCollection();

	/** @var Crm\Order\TradeBindingEntity $entity */
	foreach ($collection as $entity)
	{
		$platform = $entity->getTradePlatform();
		if ($platform === null)
		{
			continue;
		}

		$data = $platform->getInfo();
		$this->document['SHOP_TITLE'] = $data['TITLE'] ?? '';
		$this->document['SHOP_PUBLIC_URL'] = $data['PUBLIC_URL'] ?? '';
		break;
	}

	if (empty($this->document['SHOP_TITLE']))
	{
		$siteData = Main\SiteTable::getList([
			'select' => ['LID', 'NAME', 'SITE_NAME'],
			'filter' => ['LID' => $order->getSiteId()],
		])->fetch();

		if ($siteData)
		{
			if ($siteData['SITE_NAME'])
			{
				$this->document['SHOP_TITLE'] = $siteData['SITE_NAME'];
			}
			else
			{
				$this->document['SHOP_TITLE'] = $siteData['NAME'];
			}
		}
	}
}

Добавить комментарий