本文整理汇总了PHP中CSaleLocation::GetById方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::GetById方法的具体用法?PHP CSaleLocation::GetById怎么用?PHP CSaleLocation::GetById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleLocation
的用法示例。
在下文中一共展示了CSaleLocation::GetById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCityNameFromLocationId
public static function getCityNameFromLocationId($locationId)
{
$loc = \CSaleLocation::GetById($locationId);
return isset($loc["CITY_NAME_LANG"]) ? $loc["CITY_NAME_LANG"] : false;
}
示例2: array
$locationFound = false;
$dbVariants = CSaleLocation::GetList(array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"), array("LID" => LANGUAGE_ID), false, false, array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG"));
while ($arVariants = $dbVariants->GetNext()) {
if (intval($arVariants["ID"]) == intval($curVal) || !isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) {
$locationFound = true;
$arVariants["SELECTED"] = "Y";
$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"] . (strlen($arVariants["CITY_NAME"]) > 0 ? " - " : "") . $arVariants["CITY_NAME"];
$arProperties["VALUE"] = $arVariants["ID"];
}
$arVariants["NAME"] = $arVariants["COUNTRY_NAME"] . (strlen($arVariants["CITY_NAME"]) > 0 ? " - " : "") . $arVariants["CITY_NAME"];
$arProperties["VARIANTS"][] = $arVariants;
}
// this is not a COUNTRY, REGION or CITY, but must appear in $arProperties["VARIANTS"]
if (CSaleLocation::isLocationProMigrated() && !$locationFound && IntVal($curVal)) {
// CSaleLocation::GetById() is enought intelligent to accept modern (not-country-or-region-or-city) ID or CODE
$item = CSaleLocation::GetById($curVal);
if ($item) {
$item['NAME'] = $item["COUNTRY_NAME"] . (strlen($item["CITY_NAME"]) > 0 ? " - " : "") . $item["CITY_NAME"];
$item['SELECTED'] = 'Y';
$arProperties["VARIANTS"][] = $item;
}
}
if (count($arProperties["VARIANTS"]) == 1) {
$arProperties["VALUE"] = $arProperties["VARIANTS"][0]["ID"];
}
} elseif ($arProperties["TYPE"] == "RADIO") {
$arProperties["VARIANTS"] = array();
$dbVariants = CSaleOrderPropsVariant::GetList(array("SORT" => "ASC"), array("ORDER_PROPS_ID" => $arProperties["ID"]), false, false, array("*"));
while ($arVariants = $dbVariants->GetNext()) {
if ($arVariants["VALUE"] == $curVal || !isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"]) {
$arVariants["CHECKED"] = "Y";
示例3: DoProcessOrder
static function DoProcessOrder(&$arOrder, $arOrderPropsValues, &$arErrors, &$arWarnings, $paysystemId = 0, $deliveryId = "", $arOptions = array())
{
if (!is_array($arOrderPropsValues)) {
$arOrderPropsValues = array();
}
$arUser = null;
$arFilter = array("PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "ACTIVE" => "Y");
if ($paysystemId != 0) {
$arFilter["RELATED"]["PAYSYSTEM_ID"] = $paysystemId;
$arFilter["RELATED"]["TYPE"] = "WITH_NOT_RELATED";
}
if (strlen($deliveryId) > 0) {
$arFilter["RELATED"]["DELIVERY_ID"] = $deliveryId;
$arFilter["RELATED"]["TYPE"] = "WITH_NOT_RELATED";
}
$dbOrderProps = CSaleOrderProps::GetList(array("SORT" => "ASC"), $arFilter, false, false, array("ID", "NAME", "TYPE", "IS_LOCATION", "IS_LOCATION4TAX", "IS_PROFILE_NAME", "IS_PAYER", "IS_EMAIL", "REQUIED", "SORT", "IS_ZIP", "CODE", "DEFAULT_VALUE"));
while ($arOrderProp = $dbOrderProps->Fetch()) {
if (!array_key_exists($arOrderProp["ID"], $arOrderPropsValues)) {
$curVal = $arOrderProp["DEFAULT_VALUE"];
if (strlen($curVal) <= 0) {
if ($arOrderProp["IS_EMAIL"] == "Y" || $arOrderProp["IS_PAYER"] == "Y") {
if ($arUser == null) {
$dbUser = CUser::GetList($by = "ID", $order = "desc", array("ID_EQUAL_EXACT" => $arOrder["USER_ID"]));
$arUser = $dbUser->Fetch();
}
if ($arOrderProp["IS_EMAIL"] == "Y") {
$curVal = is_array($arUser) ? $arUser["EMAIL"] : "";
} elseif ($arOrderProp["IS_PAYER"] == "Y") {
$curVal = is_array($arUser) ? $arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"] : "";
}
}
}
} else {
$curVal = $arOrderPropsValues[$arOrderProp["ID"]];
}
if (!is_array($curVal) && strlen($curVal) > 0 || is_array($curVal) && count($curVal) > 0) {
//if ($arOrderProp["TYPE"] == "SELECT" || $arOrderProp["TYPE"] == "MULTISELECT" || $arOrderProp["TYPE"] == "RADIO")
if ($arOrderProp["TYPE"] == "SELECT" || $arOrderProp["TYPE"] == "RADIO") {
$arVariants = array();
$dbVariants = CSaleOrderPropsVariant::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ORDER_PROPS_ID" => $arOrderProp["ID"]), false, false, array("*"));
while ($arVariant = $dbVariants->Fetch()) {
$arVariants[] = $arVariant["VALUE"];
}
if (!is_array($curVal)) {
$curVal = array($curVal);
}
$arKeys = array_keys($curVal);
foreach ($arKeys as $k) {
if (!in_array($curVal[$k], $arVariants)) {
unset($curVal[$k]);
}
}
if ($arOrderProp["TYPE"] == "SELECT" || $arOrderProp["TYPE"] == "RADIO") {
$curVal = array_shift($curVal);
}
} elseif ($arOrderProp["TYPE"] == "LOCATION") {
if (is_array($curVal)) {
$curVal = array_shift($curVal);
}
if (CSaleLocation::isLocationProMigrated()) {
// if we came from places like CRM, we got location in CODEs, because CRM knows nothing about location IDs.
// so, CRM sends LOCATION_IN_CODES in options array. In the other case, we assume we got locations as IDs
$res = CSaleLocation::GetById($curVal);
if (intval($res['ID'])) {
$curVal = $res['ID'];
$locId = $res['ID'];
} else {
$curVal = null;
$locId = false;
}
} else {
$dbVariants = CSaleLocation::GetList(array(), array("ID" => $curVal), false, false, array("ID"));
if ($arVariant = $dbVariants->Fetch()) {
$curVal = intval($arVariant["ID"]);
} else {
$curVal = null;
}
}
}
}
if ($arOrderProp["TYPE"] == "LOCATION" && ($arOrderProp["IS_LOCATION"] == "Y" || $arOrderProp["IS_LOCATION4TAX"] == "Y")) {
if ($arOrderProp["IS_LOCATION"] == "Y") {
$arOrder["DELIVERY_LOCATION"] = $locId;
}
if ($arOrderProp["IS_LOCATION4TAX"] == "Y") {
$arOrder["TAX_LOCATION"] = $locId;
}
if (!$locId) {
$bErrorField = true;
}
} elseif ($arOrderProp["IS_PROFILE_NAME"] == "Y" || $arOrderProp["IS_PAYER"] == "Y" || $arOrderProp["IS_EMAIL"] == "Y" || $arOrderProp["IS_ZIP"] == "Y") {
$curVal = trim($curVal);
if ($arOrderProp["IS_PROFILE_NAME"] == "Y") {
$arOrder["PROFILE_NAME"] = $curVal;
}
if ($arOrderProp["IS_PAYER"] == "Y") {
$arOrder["PAYER_NAME"] = $curVal;
}
if ($arOrderProp["IS_ZIP"] == "Y") {
$arOrder["DELIVERY_LOCATION_ZIP"] = $curVal;
//.........这里部分代码省略.........
示例4: getOrderPropFormated
//.........这里部分代码省略.........
false,
array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG", "CITY_ID")
);
while ($arVariants = $dbVariants->GetNext())
{
if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
{
// set formatted value
$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
// location found, set it as DELIVERY_LOCATION and TAX_LOCATION
$arUserResult["DELIVERY_LOCATION"] = $arVariants['ID'];
if($arProperties["IS_LOCATION4TAX"]=="Y")
$arUserResult["TAX_LOCATION"] = $arVariants['ID'];
$locationFound = $arVariants;
$arVariants["SELECTED"] = "Y";
if ($isProfileChanged || $isEmptyUserResult)
{
$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arVariants['ID'];
}
}
$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
// save to variants
$arProperties["VARIANTS"][] = $arVariants;
}
// this is not a COUNTRY, REGION or CITY, but must appear in $arProperties["VARIANTS"]
if(!$locationFound && IntVal($curVal))
{
$item = CSaleLocation::GetById($curVal);
if($item)
{
// set formatted value
$arProperties["VALUE_FORMATED"] = $item["COUNTRY_NAME"].((strlen($item["CITY_NAME"]) > 0) ? " - " : "").$item["CITY_NAME"];
// location found, set it as DELIVERY_LOCATION and TAX_LOCATION
$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
if($arProperties["IS_LOCATION4TAX"]=="Y")
$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];
if ($isProfileChanged || $isEmptyUserResult)
{
$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arProperties["VALUE"];
}
$locationFound = $item;
$item['SELECTED'] = 'Y';
$item['NAME'] = $item["COUNTRY_NAME"].((strlen($item["CITY_NAME"]) > 0) ? " - " : "").$item["CITY_NAME"];
// save to variants
$arProperties["VARIANTS"][] = $item;
}
}
if($locationFound)
{
// enable location town text
if(isset($arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'])) // its an ajax-hit and sale.location.selector.steps is used
{
if(intval($arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'][$arProperties["ID"]])) // user MANUALLY selected "Other location" in the selector
{
// Manually chosen, decide...
示例5: getOrderPropFormated
//.........这里部分代码省略.........
#######################
#######################
# here we sacrifice perfromance for the sake of compatibility
$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
if($arProperties["IS_LOCATION4TAX"]=="Y")
$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];
// variants
$locationFound = false;
$dbVariants = CSaleLocation::GetList(
array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"),
array("LID" => LANGUAGE_ID),
false,
false,
array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG")
);
while ($arVariants = $dbVariants->GetNext())
{
if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
{
$locationFound = true;
$arVariants["SELECTED"] = "Y";
$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
}
$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
$arProperties["VARIANTS"][] = $arVariants;
}
// this is not a COUNTRY, REGION or CITY, but must appear in $arProperties["VARIANTS"]
if(!$locationFound && IntVal($curVal))
{
$item = CSaleLocation::GetById($curVal);
if($item)
{
$item['NAME'] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
$item['SELECTED'] = 'Y';
$arProperties["VARIANTS"][] = $item;
}
}
}
else
{
//enable location town text
if ($_REQUEST["is_ajax_post"] == "Y" && $arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0 && isset($_REQUEST["ORDER_PROP_".$arProperties["ID"]]))
{
$rsLocationsList = CSaleLocation::GetList(
array(),
array("ID" => $curVal),
false,
false,
array("ID", "CITY_ID")
);
$arCity = $rsLocationsList->GetNext();
if (intval($arCity["CITY_ID"]) <= 0)
unset($arDeleteFieldLocation[$arProperties["ID"]]);
else
$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
}
elseif ($arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0)
{
$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
}