当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleLocation::GetRegionList方法代码示例

本文整理汇总了PHP中CSaleLocation::GetRegionList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::GetRegionList方法的具体用法?PHP CSaleLocation::GetRegionList怎么用?PHP CSaleLocation::GetRegionList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleLocation的用法示例。


在下文中一共展示了CSaleLocation::GetRegionList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRegionsList

 /**
  * getRegionsList
  * @return array regions (locations) list
  */
 public static function getRegionsList($countryId = 0, $bFlip = false)
 {
     static $arRegions = array();
     $flipIndex = intval($bFlip);
     if (isset($arRegions[$countryId][$flipIndex])) {
         return $arRegions[$countryId][$flipIndex];
     }
     if (CSaleLocation::isLocationProMigrated()) {
         $types = array();
         $res = \Bitrix\Sale\Location\TypeTable::getList(array('select' => array('ID', 'CODE')));
         while ($item = $res->fetch()) {
             $types[$item['CODE']] = $item['ID'];
         }
         $filter = array(array('LOGIC' => 'OR', array('=TYPE_ID' => $types['CITY'], '=NAME.LANGUAGE_ID' => LANGUAGE_ID, array('LOGIC' => 'OR', array('=PARENT.TYPE_ID' => $types['COUNTRY']), array('=PARENT.TYPE_ID' => $types['COUNTRY_DISTRICT']), array('=PARENT_ID' => '0'))), array('=TYPE_ID' => $types['REGION'])));
         if (intval($countryId)) {
             $filter['=PARENTS.TYPE_ID'] = $types['COUNTRY'];
             $filter['=PARENTS.ID'] = $countryId;
         }
         $dbRegionList = \Bitrix\Sale\Location\LocationTable::getList(array('filter' => $filter, 'select' => array('ID', 'CODE', 'NAME_LANG' => 'NAME.NAME'), 'order' => array('NAME.NAME' => 'asc')));
     } else {
         $arFilterRegion = array();
         if (intval($countryId) > 0) {
             $arFilterRegion["COUNTRY_ID"] = $countryId;
         }
         $dbRegionList = CSaleLocation::GetRegionList(array("NAME_LANG" => "ASC"), $arFilterRegion, LANGUAGE_ID);
     }
     $key = 'ID';
     while ($arRegionList = $dbRegionList->Fetch()) {
         if ($key == 'ID' && isset($arRegionList['CODE'])) {
             $key = 'CODE';
         }
         if ($key == 'CODE' && strlen($arRegionList['CODE']) <= 0) {
             continue;
         }
         $arRegions[$countryId][0][$arRegionList[$key]] = $arRegionList["NAME_LANG"];
         // $bFlip == false
         $arRegions[$countryId][1][$arRegionList["NAME_LANG"]] = $arRegionList[$key];
         // $bFlip == true
     }
     return isset($arRegions[$countryId][$flipIndex]) ? $arRegions[$countryId][$flipIndex] : array();
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:45,代码来源:delivery_helper.php

示例2: getAllRegions

 /**
  * @param string $lang - language Id
  * @return array - list of all regions
  */
 public static function getAllRegions($lang)
 {
     static $result = null;
     if ($result === null) {
         $result = array();
         $dbRegionList = \CSaleLocation::GetRegionList(array(), array(), $lang);
         while ($arRegion = $dbRegionList->GetNext()) {
             $result[$arRegion["ID"]] = $arRegion["NAME_LANG"];
         }
     }
     return $result;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:16,代码来源:saleszone.php

示例3: getRegionsNames

 public static function getRegionsNames($countryID = false)
 {
     $arFilterRegion = array();
     if ($countryID && intval($countryID) > 0) {
         $arFilterRegion["COUNTRY_ID"] = $countryID;
     }
     $arRNames = array();
     $dbRegList = CSaleLocation::GetRegionList(array("NAME" => "ASC"), $arFilterRegion, LANGUAGE_ID);
     while ($arRegion = $dbRegList->Fetch()) {
         $arRNames[$arRegion["ID"]] = $arRegion["NAME_ORIG"] . " [" . $arRegion["NAME_LANG"] . "]";
     }
     return $arRNames;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:crm_locations.php

示例4: getRegionsList

 /**
  * getRegionsList
  * @return array regions (locations) list
  */
 public static function getRegionsList($countryId = 0, $bFlip = false)
 {
     static $arRegions = array();
     $flipIndex = intval($bFlip);
     if (isset($arRegions[$countryId][$flipIndex])) {
         return $arRegions[$countryId][$flipIndex];
     }
     $arFilterRegion = array();
     if (intval($countryId) > 0) {
         $arFilterRegion["COUNTRY_ID"] = $countryId;
     }
     $dbRegionList = CSaleLocation::GetRegionList(array("NAME_LANG" => "ASC"), $arFilterRegion, LANGUAGE_ID);
     while ($arRegionList = $dbRegionList->Fetch()) {
         $arRegions[$countryId][0][$arRegionList['ID']] = $arRegionList["NAME_LANG"];
         // $bFlip == false
         $arRegions[$countryId][1][$arRegionList["NAME_LANG"]] = $arRegionList['ID'];
         // $bFlip == true
     }
     return isset($arRegions[$countryId][$flipIndex]) ? $arRegions[$countryId][$flipIndex] : array();
 }
开发者ID:rasuldev,项目名称:torino,代码行数:24,代码来源:delivery_helper.php

示例5: getRegionsList

 private static function getRegionsList()
 {
     $arResult = array(0 => GetMessage('SPFPCT_CHOOSE_REGION'));
     $dbReg = CSaleLocation::GetRegionList();
     while ($arReg = $dbReg->Fetch()) {
         $arResult[$arReg["ID"]] = $arReg["NAME"];
     }
     return $arResult;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:9,代码来源:tarif.php

示例6: Update


//.........这里部分代码省略.........
  * @return int <p>Возвращается код измененного местоположения или <i>false</i> у
  * случае ошибки.</p> <a name="examples"></a>
  *
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * $arFields = array(
  *    "SORT" =&gt; 100,
  *    "COUNTRY_ID" =&gt; 8,
  *    "WITHOUT_CITY" =&gt; "N"
  * );
  * 
  * $arCity = array(
  *    "NAME" =&gt; "Kaliningrad",
  *    "SHORT_NAME" =&gt; "Kaliningrad",
  *    "ru" =&gt; array(
  *       "LID" =&gt; "ru",
  *       "NAME" =&gt; "Калининград",
  *       "SHORT_NAME" =&gt; "Калининград"
  *       ),
  *    "en" =&gt; array(
  *       "LID" =&gt; "en",
  *       "NAME" =&gt; "Kaliningrad",
  *       "SHORT_NAME" =&gt; "Kaliningrad"
  *       )
  * );
  * 
  * $arFields["CITY"] = $arCity;
  * 
  * if (!CSaleLocation::Update(6, $arFields))
  *    echo "Ошибка изменения местоположения";
  * ?&gt;
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalelocation/csalelocation__update.a6601f1c.php
  * @author Bitrix
  */
 public static function Update($ID, $arFields)
 {
     global $DB;
     if (!CSaleLocation::CheckFields("UPDATE", $arFields)) {
         return false;
     }
     if (!($arLocRes = CSaleLocation::GetByID($ID, LANGUAGE_ID))) {
         return false;
     }
     if ((!is_set($arFields, "COUNTRY_ID") || IntVal($arFields["COUNTRY_ID"]) <= 0) && $arFields["COUNTRY_ID"] != "") {
         $arFields["COUNTRY_ID"] = CSaleLocation::AddCountry($arFields["COUNTRY"]);
         if (IntVal($arFields["COUNTRY_ID"]) <= 0) {
             return false;
         }
         unset($arFields["CITY_ID"]);
         unset($arFields["REGION_ID"]);
         CSaleLocation::AddLocation($arFields);
     } elseif ($arFields["CHANGE_COUNTRY"] == "Y" || $arFields["COUNTRY_ID"] == "") {
         CSaleLocation::UpdateCountry($arFields["COUNTRY_ID"], $arFields["COUNTRY"]);
     }
     //city
     if ($arFields["WITHOUT_CITY"] != "Y") {
         if (IntVal($arLocRes["CITY_ID"]) > 0) {
             CSaleLocation::UpdateCity(IntVal($arLocRes["CITY_ID"]), $arFields["CITY"]);
         } else {
             $arFields["CITY_ID"] = CSaleLocation::AddCity($arFields["CITY"]);
             if (IntVal($arFields["CITY_ID"]) <= 0) {
                 return false;
             }
         }
     } else {
         CSaleLocation::DeleteCity($arLocRes["CITY_ID"]);
         $arFields["CITY_ID"] = false;
     }
     //region
     if (IntVal($arFields["REGION_ID"]) > 0) {
         CSaleLocation::UpdateRegion(IntVal($arLocRes["REGION_ID"]), $arFields["REGION"]);
     } elseif ($arFields["REGION_ID"] == 0 && $arFields["REGION_ID"] != '') {
         $db_res = CSaleLocation::GetRegionList(array("ID" => "DESC"), array("NAME" => $arFields["REGION"][LANGUAGE_ID]["NAME"]));
         $arRegion = $db_res->Fetch();
         if (count($arRegion) > 1) {
             $arFields["REGION_ID"] = $arRegion["ID"];
         } else {
             $arFields["REGION_ID"] = CSaleLocation::AddRegion($arFields["REGION"]);
             if (IntVal($arFields["REGION_ID"]) <= 0) {
                 return false;
             }
             $arFieldsTmp = $arFields;
             unset($arFieldsTmp["CITY_ID"]);
             CSaleLocation::AddLocation($arFieldsTmp);
         }
     } elseif ($arFields["REGION_ID"] == '') {
         //CSaleLocation::DeleteRegion($arLocRes["REGION_ID"]);
         $arFields["REGION_ID"] = 0;
     } else {
         unset($arFields["REGION_ID"]);
     }
     CSaleLocation::UpdateLocation($ID, $arFields);
     return $ID;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:location.php

示例7: array

if (count($arResult["COUNTRY_LIST"]) <= 0) {
    $arResult["COUNTRY_LIST"] = array();
} elseif (count($arResult["COUNTRY_LIST"]) == 1) {
    $arParams["COUNTRY"] = $arResult["COUNTRY_LIST"][0]["ID"];
}
//select region
$arResult["REGION_LIST"] = array();
if (($arParams["COUNTRY"] > 0 || count($arResult["COUNTRY_LIST"]) <= 0) && (strlen($arParams["REGION_INPUT_NAME"]) > 0 || $arParams["ZIPCODE"] > 0)) {
    $arRegionFilter = array("LID" => LANGUAGE_ID, "!REGION_ID" => "NULL", "!REGION_ID" => "0");
    if ($arParams["COUNTRY"] > 0) {
        $arRegionFilter["COUNTRY_ID"] = IntVal($arParams["COUNTRY"]);
    }
    if ($arResult["EMPTY_CITY"] == "Y") {
        $rsRegionList = CSaleLocation::GetList(array("SORT" => "ASC", "NAME_LANG" => "ASC"), $arRegionFilter, false, false, array("ID", "REGION_ID", "REGION_NAME_LANG", "SORT"));
    } else {
        $rsRegionList = CSaleLocation::GetRegionList(array("SORT" => "ASC", "NAME_LANG" => "ASC"), $arRegionFilter);
    }
    $regionSortIndex = array();
    while ($arRegion = $rsRegionList->GetNext()) {
        if (!SalesZone::checkRegionId($arRegion["ID"], $arParams["SITE_ID"])) {
            continue;
        }
        if ($arResult["EMPTY_CITY"] == "Y") {
            $arRegion["NAME_LANG"] = $arRegion["REGION_NAME_LANG"];
        }
        $arResult["REGION_LIST"][$arRegion['ID']] = $arRegion;
        $regionSortIndex[$arRegion['SORT']][$arRegion['NAME_LANG']] = $arRegion['ID'];
        if ($arRegion["ID"] == $arParams["REGION"] && strlen($arRegion["NAME_LANG"]) > 0) {
            $locationString = $arRegion["NAME_LANG"] . ", " . $locationString;
        }
    }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例8: GetMessage

</option>
				<option value="" <?php 
if (isset($REGION_ID) && $REGION_ID == "" || $str_REGION_ID == "" || $str_REGION_ID == "0") {
    echo " selected";
}
?>
 ><?php 
echo GetMessage("WITHOUT_REGION");
?>
</option>
				<?php 
$arFilterRegion = array();
if (isset($str_COUNTRY_ID) && $str_COUNTRY_ID > 0) {
    $arFilterRegion["COUNTRY_ID"] = $str_COUNTRY_ID;
}
$dbRegionList = CSaleLocation::GetRegionList(array("NAME" => "ASC"), $arFilterRegion, LANG);
while ($arRegionList = $dbRegionList->Fetch()) {
    ?>
<option value="<?php 
    echo $arRegionList["ID"];
    ?>
"<?php 
    if (IntVal($arRegionList["ID"]) == IntVal($str_REGION_ID)) {
        echo " selected";
    }
    ?>
><?php 
    echo htmlspecialcharsEx($arRegionList["NAME_ORIG"]);
    ?>
</option><?php 
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:location_edit.php

示例9: Update

	function Update($ID, $arFields)
	{
		global $DB;

		if (!CSaleLocation::CheckFields("UPDATE", $arFields)) return false;

		if (!($arLocRes = CSaleLocation::GetByID($ID, LANGUAGE_ID))) return false;

		if(self::isLocationProMigrated())
		{
			try
			{
				// only partial support: name update functionality

				if(($arFields["CHANGE_COUNTRY"]=="Y" || intval($arFields["COUNTRY_ID"])) && is_array($arFields["COUNTRY"]))
					CSaleLocation::UpdateCountry($arFields["COUNTRY_ID"], $arFields["COUNTRY"]);

				if(intval($arFields["REGION_ID"]) && is_array($arFields["REGION"]))
					CSaleLocation::UpdateRegion($arFields["REGION_ID"], $arFields["REGION"]);

				if(intval($arFields["CITY_ID"]) && is_array($arFields["CITY"]))
					CSaleLocation::UpdateCity($arFields["CITY_ID"], $arFields["CITY"]);
			}
			catch(Exception $e)
			{
				return false;
			}
		}
		else
		{
			if ((!is_set($arFields, "COUNTRY_ID") || IntVal($arFields["COUNTRY_ID"])<=0) && $arFields["COUNTRY_ID"] != "")
			{
				$arFields["COUNTRY_ID"] = CSaleLocation::AddCountry($arFields["COUNTRY"]);
				if (IntVal($arFields["COUNTRY_ID"])<=0) return false;

				UnSet($arFields["CITY_ID"]);
				UnSet($arFields["REGION_ID"]);
				CSaleLocation::AddLocation($arFields);
			}
			elseif ($arFields["CHANGE_COUNTRY"]=="Y" || $arFields["COUNTRY_ID"] == "")
			{
				CSaleLocation::UpdateCountry($arFields["COUNTRY_ID"], $arFields["COUNTRY"]);
			}

			//city
			if ($arFields["WITHOUT_CITY"]!="Y")
			{
				if (IntVal($arLocRes["CITY_ID"])>0)
				{
					CSaleLocation::UpdateCity(IntVal($arLocRes["CITY_ID"]), $arFields["CITY"]);
				}
				else
				{
					$arFields["CITY_ID"] = CSaleLocation::AddCity($arFields["CITY"]);
					if (IntVal($arFields["CITY_ID"])<=0) return false;
				}
			}
			else
			{
				CSaleLocation::DeleteCity($arLocRes["CITY_ID"]);
				$arFields["CITY_ID"] = false;
			}

			//region
			if (IntVal($arFields["REGION_ID"])>0)
			{
				CSaleLocation::UpdateRegion(IntVal($arLocRes["REGION_ID"]), $arFields["REGION"]);
			}
			elseif ($arFields["REGION_ID"] == 0 && $arFields["REGION_ID"] != '')
			{
				$db_res = CSaleLocation::GetRegionList(array("ID" => "DESC"), array("NAME" => $arFields["REGION"][LANGUAGE_ID]["NAME"]));
				$arRegion = $db_res->Fetch();

				if (count($arRegion) > 1)
					$arFields["REGION_ID"] = $arRegion["ID"];
				else
				{
					$arFields["REGION_ID"] = CSaleLocation::AddRegion($arFields["REGION"]);
					if (IntVal($arFields["REGION_ID"])<=0)
						return false;

					$arFieldsTmp = $arFields;
					UnSet($arFieldsTmp["CITY_ID"]);
					CSaleLocation::AddLocation($arFieldsTmp);
				}
			}
			elseif ($arFields["REGION_ID"] == '')
			{
				//CSaleLocation::DeleteRegion($arLocRes["REGION_ID"]);
				$arFields["REGION_ID"] = 0;
			}
			else
			{
				UnSet($arFields["REGION_ID"]);
			}

			CSaleLocation::UpdateLocation($ID, $arFields);

			return $ID;
		}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:location.php

示例10: BeginNote

</form>
<?php 
$tabControl->EndTab();
$tabControl->End();
echo BeginNote();
echo GetMessage("LOCA_LOCATIONS_STATS") . ': <ul style="font-size: 100%">';
$rsLocations = CSaleLocation::GetList(array(), array(), array("COUNTRY_ID", "COUNT" => "CITY_ID"));
$numLocations = 0;
$numCountries = 0;
$numCities = 0;
$numRegion = 0;
while ($arStat = $rsLocations->Fetch()) {
    $numCountries++;
    $numCities += $arStat["CITY_ID"];
    $numLocations += $arStat['CNT'];
}
$rsRegion = CSaleLocation::GetRegionList(array(), array(), LANG);
$numRegion = $rsRegion->SelectedRowsCount();
echo '<li>' . GetMessage('LOCA_LOCATIONS_COUNTRY_STATS') . ': ' . $numCountries . '</li>';
echo '<li>' . GetMessage('LOCA_LOCATIONS_REGION_STATS') . ': ' . $numRegion . '</li>';
echo '<li>' . GetMessage('LOCA_LOCATIONS_CITY_STATS') . ': ' . $numCities . '</li>';
echo '<li>' . GetMessage('LOCA_LOCATIONS_LOC_STATS') . ': ' . $numLocations . '</li>';
$rsLocationGroups = CSaleLocationGroup::GetList();
$numGroups = 0;
while ($arGroup = $rsLocationGroups->Fetch()) {
    $numGroups++;
}
echo '<li>' . GetMessage('LOCA_LOCATIONS_GROUP_STATS') . ': ' . $numGroups . '</li>';
echo '</ul>';
echo EndNote();
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:location_import_old.php


注:本文中的CSaleLocation::GetRegionList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。