function GetRealValue($propertyID, $propertyCode, $propertyType, $value, $lang = false) { $propertyID = IntVal($propertyID); $propertyCode = Trim($propertyCode); $propertyType = Trim($propertyType); if ($lang === false) $lang = LANGUAGE_ID; $arResult = array(); $curKey = ((strlen($propertyCode) > 0) ? $propertyCode : $propertyID); if ($propertyType == "SELECT" || $propertyType == "RADIO") { $arValue = CSaleOrderPropsVariant::GetByValue($propertyID, $value); $arResult[$curKey] = $arValue["NAME"]; } elseif ($propertyType == "MULTISELECT") { $curValue = ""; if (!is_array($value)) $value = explode(",", $value); for ($i = 0, $max = count($value); $i < $max; $i++) { if ($arValue1 = CSaleOrderPropsVariant::GetByValue($propertyID, $value[$i])) { if ($i > 0) $curValue .= ","; $curValue .= $arValue1["NAME"]; } } $arResult[$curKey] = $curValue; } elseif ($propertyType == "LOCATION") { if(CSaleLocation::isLocationProMigrated()) { $curValue = ''; if(strlen($value)) { // now we got CODE here $locationId = CSaleLocation::getLocationIdByCODE($value); if(intval($locationId)) { try { $locationStreetPropertyValue = ''; $res = \Bitrix\Sale\Location\LocationTable::getPathToNode($locationId, array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID))); $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached(); $path = array(); while($item = $res->fetch()) { // copy street to STREET property if($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') $locationStreetPropertyValue = $item['LNAME']; $path[] = $item['LNAME']; } $curValue = implode(' - ', $path); if(strlen($locationStreetPropertyValue)) $arResult[$curKey."_STREET"] = $locationStreetPropertyValue; } catch(\Bitrix\Main\SystemException $e) { } } } } else { $arValue = CSaleLocation::GetByID($value, $lang); $curValue = $arValue["COUNTRY_NAME"].((strlen($arValue["COUNTRY_NAME"])<=0 || strlen($arValue["REGION_NAME"])<=0) ? "" : " - ").$arValue["REGION_NAME"].((strlen($arValue["COUNTRY_NAME"])<=0 || strlen($arValue["CITY_NAME"])<=0) ? "" : " - ").$arValue["CITY_NAME"]; } $arResult[$curKey] = $curValue; $arResult[$curKey."_COUNTRY"] = $arValue["COUNTRY_NAME"]; $arResult[$curKey."_REGION"] = $arValue["REGION_NAME"]; $arResult[$curKey."_CITY"] = $arValue["CITY_NAME"]; } else { $arResult[$curKey] = $value; } return $arResult; }