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


PHP CSaleLocation::AddCity方法代码示例

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


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

示例1: 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

示例2: saleLocationImport


//.........这里部分代码省略.........
                                    $LLL = $arRegionList["ID"];
                                    $CurRegionID = IntVal($arRegionList["REGION_ID"]);
                                }
                            }
                            if (IntVal($CurRegionID) <= 0) {
                                $CurRegionID = CSaleLocation::AddRegion($arArrayTmp);
                                $CurRegionID = IntVal($CurRegionID);
                                if ($CurRegionID > 0) {
                                    $numRegiones++;
                                    if (IntVal($LLL) <= 0) {
                                        $LLL = CSaleLocation::AddLocation(array("COUNTRY_ID" => $CurCountryID, "REGION_ID" => $CurRegionID));
                                        if (IntVal($LLL) > 0) {
                                            $numLocations++;
                                        }
                                    }
                                }
                            }
                        } elseif ($type == "T" && IntVal($CurCountryID) > 0) {
                            $city_id = 0;
                            $LLL = 0;
                            $arCityList = array();
                            if ($bSync) {
                                $arFilter = array("COUNTRY_ID" => $CurCountryID, "CITY_NAME" => $arArrayTmp["NAME"], "LID" => $DefLang);
                                if (IntVal($CurRegionID) > 0) {
                                    $arFilter["REGION_ID"] = $CurRegionID;
                                }
                                $db_cityList = CSaleLocation::GetList(array(), $arFilter);
                                if ($arCityList = $db_cityList->Fetch()) {
                                    $LLL = $arCityList["ID"];
                                    $city_id = IntVal($arCityList["CITY_ID"]);
                                }
                            }
                            if ($city_id <= 0) {
                                $city_id = CSaleLocation::AddCity($arArrayTmp);
                                $city_id = IntVal($city_id);
                                if ($city_id > 0) {
                                    $numCities++;
                                }
                            }
                            if ($city_id > 0) {
                                if (IntVal($LLL) <= 0) {
                                    $LLL = CSaleLocation::AddLocation(array("COUNTRY_ID" => $CurCountryID, "REGION_ID" => $CurRegionID, "CITY_ID" => $city_id));
                                    if (intval($LLL) > 0) {
                                        $numLocations++;
                                    }
                                }
                            }
                        }
                    }
                    if ($tt == 10) {
                        $tt = 0;
                        $cur_time = time();
                        if ($cur_time >= $finish_time) {
                            $cur_step = $csvFile->GetPos();
                            $amount = $csvFile->iFileLength;
                            $_SESSION["LOC_POS"] = $cur_step;
                            $_SESSION["CUR_COUNTRY_ID"] = $CurCountryID;
                            $_SESSION["CUR_REGION_ID"] = $CurRegionID;
                            $_SESSION["NUM_COUNTRIES"] = $numCountries;
                            $_SESSION["NUM_REGIONES"] = $numRegiones;
                            $_SESSION["NUM_CITIES"] = $numCities;
                            $_SESSION["NUM_LOCATIONS"] = $numLocations;
                            $bFinish = false;
                            //echo "<script>Import(1, {AMOUNT:".CUtil::JSEscape($amount).",POS:".CUtil::JSEscape($cur_step)."})</script>";
                            $arReturn['STEP'] = 1;
                            $arReturn['AMOUNT'] = $amount;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:location_import.php

示例3: GetMessage

								"NAME" => GetMessage("WIZ_COUNTRY")
							);
					}
					$CurCountryID = CSaleLocation::AddCountry($arArrayTmp);
				}

				$arArrayTmp = Array();
				$arArrayTmp["NAME"] = $shopLocation;
				foreach($arLanguages as $langID)
				{
					$arArrayTmp[$langID] = array(
							"LID" => $langID,
							"NAME" => $shopLocation
						);
				}
				$city_id = CSaleLocation::AddCity($arArrayTmp);

				$location = CSaleLocation::AddLocation(
					array(
						"COUNTRY_ID" => $CurCountryID,
						"CITY_ID" => $city_id
					));
				if($bRus)
					CSaleLocation::AddLocationZIP($location, "101000");

				WizardServices::IncludeServiceLang("step1.php", $lang);
			}
			COption::SetOptionString('sale', 'location', $location);
	}
	//Order Prop Group
	if ($fizExist)
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:step1.php

示例4: 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


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