- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/discountbase.php
- Класс: BitrixSaleDiscountBase
- Вызов: DiscountBase::fillEmptyOrderData
protected function fillEmptyOrderData()
{
/** @var BasketBase $basket*/
$basket = $this->getBasket();
$siteId = $this->getSiteId();
$this->orderData = [
'ID' => 0,
'USER_ID' => $this->context->getUserId(),
'USER_GROUPS' => $this->context->getUserGroups(),
'SITE_ID' => $siteId,
'LID' => $siteId, // compatibility only
'ORDER_PRICE' => $basket->getBasePrice(),
'ORDER_WEIGHT' => $basket->getWeight(),
'CURRENCY' => $this->getCurrency(),
'PERSON_TYPE_ID' => 0,
'RECURRING_ID' => null,
'BASKET_ITEMS' => [],
'ORDER_PROP' => []
];
if ($this->isOrderExists())
{
$order = $this->getOrder();
$this->orderData['ID'] = $order->getId();
$this->orderData['USER_ID'] = $order->getUserId();
$this->orderData['ORDER_PRICE'] = $order->getBasePrice();
$this->orderData['PERSON_TYPE_ID'] = $order->getPersonTypeId();
$this->orderData['RECURRING_ID'] = $order->getField('RECURRING_ID');
/** @var BitrixSalePropertyValueCollection $propertyCollection */
$propertyCollection = $order->getPropertyCollection();
/** @var BitrixSalePropertyValue $orderProperty */
foreach ($propertyCollection as $orderProperty)
$this->orderData['ORDER_PROP'][$orderProperty->getPropertyId()] = $orderProperty->getValue();
unset($orderProperty);
foreach ($this->getOrderPropertyCodes() as $propertyCode => $attribute)
{
$this->orderData[$propertyCode] = '';
$orderProperty = $propertyCollection->getAttribute($attribute);
if ($orderProperty instanceof PropertyValue)
$this->orderData[$propertyCode] = $orderProperty->getValue();
unset($orderProperty);
}
unset($propertyCode, $attribute);
unset($propertyCollection);
unset($order);
}
unset($siteId);
unset($basket);
}