1
0
mirror of synced 2024-11-24 06:16:29 +03:00
bitrix-module/intaro.retailcrm/classes/general/services/BitrixOrderService.php

66 lines
1.7 KiB
PHP
Raw Normal View History

<?php
/**
* @category RetailCRM
* @package RetailCRM\Service
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
use Bitrix\Sale\Order;
use Bitrix\Main\Context;
use Bitrix\Catalog\StoreTable;
/**
* Class BitrixOrderService
*
* @category RetailCRM
* @package RetailCRM\Service
*/
class BitrixOrderService
{
public static function getCountryList()
{
$server = Context::getCurrent()->getServer()->getDocumentRoot();
$countryList = [];
if (file_exists($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml')) {
$countryFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
foreach ($countryFile->country as $country) {
$countryList[RCrmActions::fromJSON((string) $country->name)] = (string) $country->alpha;
}
}
return $countryList;
}
public static function getPickupPointAddress($arOrder)
{
$address = '';
$orderInfo = Order::load($arOrder['ID']);
foreach ($orderInfo->getShipmentCollection() as $store) {
$storeId = $store->getStoreId();
if ($storeId) {
$arStore = StoreTable::getRow([
'filter' => [
'ID' => $storeId,
]
]);
if (!empty($arStore['ADDRESS'])) {
$address = GetMessage('PICKUP_POINT') . $arStore['ADDRESS'];
break;
}
}
}
return $address;
}
}