3namespace Bitrix\Sale\Location;
5use Bitrix\Main\Service\GeoIp\Data;
6use Bitrix\Main\Service\GeoIp\Result;
7use Bitrix\Main\Service\GeoIp\Manager;
8use Bitrix\Sale\Location\Normalizer\Builder;
80 if(!$geoIpData->isSuccess())
85 $geoData = $geoIpData->getGeoData();
87 if($geoData->cityName ==
null)
92 $res = LocationTable::getList([
94 '=NAME.NAME_UPPER' => mb_strtoupper($geoData->cityName),
95 '=NAME.LANGUAGE_ID' =>
$lang
97 'select' => [
'ID',
'CODE',
'LEFT_MARGIN',
'RIGHT_MARGIN']
102 while($loc =
$res->fetch())
104 $locations[$loc[
'ID']] = $loc;
108 $locationsCount =
count($locations);
110 if($locationsCount == 1)
114 elseif($locationsCount > 1)
124 return empty($geoData->countryName) && empty($geoData->subRegionName) && empty($geoData->regionName);
129 if(empty($locations))
134 if(self::isParentsEmpty($geoData))
137 return current($locations);
140 $marginConditions = [
146 $marginConditions[] = [
148 '<LEFT_MARGIN' =>
$location[
'LEFT_MARGIN'],
149 '>RIGHT_MARGIN' =>
$location[
'RIGHT_MARGIN']
156 'NAME.LANGUAGE_ID' =>
$lang,
159 'ID',
'LEFT_MARGIN',
'RIGHT_MARGIN',
160 'LOCATION_NAME_UPPER' =>
'NAME.NAME_UPPER'
164 $res = \Bitrix\Sale\Location\LocationTable::getList(
$params);
168 $country = $normalizer->normalize($geoData->countryName);
169 $region = $normalizer->normalize($geoData->regionName);
170 $subRegion = $normalizer->normalize($geoData->subRegionName);
172 while($loc =
$res->fetch())
175 $normalizer->normalize($loc[
'LOCATION_NAME_UPPER']),
185 foreach($locationIds as $locationId)
187 if(!isset($locationId))
189 $weight[$locationId] = 0;
192 $weight[$locationId]++;
203 if(isset($locations[$id]))
216 foreach($locations as $locationId =>
$location)
218 if(
$location[
'LEFT_MARGIN'] >= $leftMargin &&
$location[
'RIGHT_MARGIN'] <= $rightMargin)
244 static $normalizer =
null;
246 if($normalizer ===
null)
253 return $normalizer->normalize($geoData->countryName) ==
$name
254 || $normalizer->normalize($geoData->regionName) ==
$name
255 || $normalizer->normalize($geoData->subRegionName) ==
$name;
294 if((!$checked || !
$result) && $subregion !==
'')
static getDataResult($ip='', $lang='', array $required=[])
static getLocationFields(Result $geoIpData, $lang=LANGUAGE_ID)
static isNameMatched(Data $geoData, $name, $lang)
static getNameNormalizer($lang)
static specifyLocationByParents(Data $geoData, array $locations, $lang)
static getData($ip, $lang)
static isParentsEmpty(Data $geoData)
static isNormalizedNamesMatched($name, $country, $region, $subregion)
static getLocationIdsByMargins(array $locations, $leftMargin, $rightMargin)
static getLocationCode($ip='', $lang=LANGUAGE_ID)
static getLocationId($ip='', $lang=LANGUAGE_ID)
static getZipCode($ip, $lang=LANGUAGE_ID)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!defined('SITE_ID')) $lang
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</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."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']