16 "inn" => $arConfig[
"INN"][
"VALUE"],
17 "city" => static::getFilialAndCity($arConfig[
"CITY_DELIVERY"][
"VALUE"]),
18 "title" => $arConfig[
"NAME"][
"VALUE"],
19 "phone" => $arConfig[
"PHONE"][
"VALUE"],
28 if(isset($extraParams[
"location"]))
29 $city = $extraParams[
"location"];
33 while ($arOrderProps = $dbOrderProps->Fetch())
35 if($arOrderProps[
"CODE"] ==
"COMPANY" || $arOrderProps[
"CODE"] ==
"FIO")
36 $title = $arOrderProps[
"VALUE"];
38 if($arOrderProps[
"CODE"] ==
"INN")
39 $inn = $arOrderProps[
"VALUE"];
41 if($arOrderProps[
"CODE"] ==
"PHONE")
42 $phone = $arOrderProps[
"VALUE"];
44 if($arOrderProps[
"CODE"] ==
"LOCATION")
48 $city = static::getFilialAndCity(key($locDelivery));
51 if($arOrderProps[
"CODE"] ==
"ADDRESS")
52 $address = $arOrderProps[
"VALUE"];
65 "positionsCount" =>
count($arPackagesParams),
66 "decription" =>
GetMessage(
"SALE_DH_PECOM_DESCRIPTION_GOODS"),
67 "orderNumber" => $arOrder[
"ACCOUNT_NUMBER"],
68 "paymentForm" => $arConfig[
"PAYMENT_FORM"][
"VALUE"],
69 "accompanyingDocuments" =>
false
76 "addressStock" => $address
80 "transporting" =>
array(
86 "hardPacking" =>
array(
94 "palletTransporting" =>
array(
101 "insurance" =>
array(
106 "cost" => intval($arOrder[
"PRICE"])
116 "strapping" =>
array(
120 "documentsReturning" =>
array(
139 if($locationId ==
'')
146 '=CODE' => $locationId,
149 '=PARENTS.TYPE.CODE' =>
'CITY',
153 'PID' =>
'PARENTS.ID',
157 if($loc =
$res->fetch())
165 if(intval($internalLocationId) <=0)
170 if(!isset(
$result[$internalLocationId]))
178 if($externalId ==
'')
184 if($externalId <>
'')
187 $externalId => !empty($internalLocation[
"CITY_NAME_LANG"]) ? $internalLocation[
"CITY_NAME_LANG"] :
""
192 return $result[$internalLocationId];
201 public static function mapLocation($locationId, $cleanCache =
false)
206 $cityName = static::getCityNameFromLocationId($locationId);
212 $cacheId =
"SaleDeliveryPecomMapLocations".$locationId;
219 $cacheManager->clean($cacheId);
222 if($cacheManager->read($ttl, $cacheId))
224 $data = $cacheManager->get($cacheId);
229 $pecCities = static::getAllPecomCities();
232 foreach($pecCities as
$key => $cities)
234 foreach($cities as $smallCityKey => $smallCityName)
236 $pos = mb_strpos($smallCityName, $cityName);
239 mb_strlen($cityName) == mb_strlen($smallCityName)
241 mb_substr($smallCityName, $pos + mb_strlen($cityName), 1) ==
" "
244 || mb_substr($smallCityName, $pos - 1, 1) ==
" "
250 $data[$smallCityKey] = $smallCityName;
255 $cacheManager->set($cacheId,
$data);
266 $cacheId =
"SaleDeliveryPecomCities";
272 $cacheManager->clean($cacheId);
275 if($cacheManager->read($ttl, $cacheId))
277 $data = $cacheManager->get($cacheId);
282 $http = new \Bitrix\Main\Web\HttpClient(
array(
284 "socketTimeout" => 30,
285 "streamTimeout" => 30,
288 "disableSslVerification" =>
true
291 $jsnData = $http->get(
"https://www.pecom.ru/ru/calc/towns.php");
294 if (!$jsnData && !empty(
$errors))
298 foreach(
$errors as $errorCode => $errMes)
302 "SEVERITY" =>
"ERROR",
303 "AUDIT_TYPE_ID" =>
"SALE_DELIVERY",
304 "MODULE_ID" =>
"sale",
305 "ITEM_ID" =>
"PECOM_GET_TOWNS",
310 $data = json_decode($jsnData,
true);
315 $cacheManager->set($cacheId,
$data);
323 $loc = \CSaleLocation::GetById($locationId);
324 return isset($loc[
"CITY_NAME_LANG"]) ? $loc[
"CITY_NAME_LANG"] :
false;
331 $cacheId =
"SaleDeliveryPecomFilialAndCity".$cityId;
336 if($cacheManager->read($ttl, $cacheId))
338 $result = $cacheManager->get($cacheId);
342 $locations = static::getAllPecomCities();
343 foreach($locations as $filial => $cities)
345 foreach($cities as $cId => $city)
353 $arCity = explode(
" ", $city);
362 $cacheManager->set($cacheId,
$result);
373 if(is_array($arCargoCodes) && !empty($arCargoCodes) && (
$email <> '' || $phone <>
''))
375 $arData[
"cargoCodes"] = $arCargoCodes;
378 $arData[
"email"] =
$email;
381 $arData[
"phone"] = $phone;
static getExternalId($locationId)
static prepareSubscribeReqData($arCargoCodes, $email="", $phone="")
static preparePreregistrationReqData($arOrder, $profileId, $arConfig)
static getCityNameFromLocationId($locationId)
static mapLocation($locationId, $cleanCache=false)
static getUpperCityId($locationId)
static getAllPecomCities($cleanCache=false)
static mapLocation2($internalLocationId)
static getFilialAndCity($cityId)
static GetOrderProps($ORDER_ID)
static getConfValue(&$arConfig, $key)
static isConfCheckedVal(&$arConfig, $key)
static getRequiredPacks(&$arItems, $arPacks, $maxWeight, $reservedSpace=0.15)
static getBoxesFromConfig($profile, &$arConfig)
static getLocationByIdHitCached($id)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
GetMessage($name, $aReplace=null)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"