本文整理汇总了PHP中CSaleLocation::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::GetList方法的具体用法?PHP CSaleLocation::GetList怎么用?PHP CSaleLocation::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleLocation
的用法示例。
在下文中一共展示了CSaleLocation::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadDataToCache
/**
* Loads data from base
*/
private function loadDataToCache()
{
$cityNames = array();
$dbLocations = CSaleLocation::GetList(array(), array(), false, false, array("ID", "CITY_NAME_LANG"));
while ($arLocation = $dbLocations->Fetch()) {
if (isset($arLocation["CITY_NAME_LANG"]) && strlen($arLocation["CITY_NAME_LANG"]) > 0) {
$cityNames[$arLocation["ID"]] = ToLower($arLocation["CITY_NAME_LANG"]);
}
}
return $cityNames;
}
示例2: isLocationsCreated
public static function isLocationsCreated()
{
if (CSaleLocation::isLocationProMigrated()) {
$res = Location\LocationTable::getList(array('select' => array('CNT')))->fetch();
return $res['CNT'] > 0;
}
$dbResultList = CSaleLocation::GetList();
if ($dbResultList->Fetch()) {
return true;
}
return false;
}
示例3: getLocation
public function getLocation()
{
if (!$this->getLocationId()) {
throw new \Exception('Не указано место доставки ' . __METHOD__);
}
$retval = false;
$res = \CSaleLocation::GetList(array(), array('LID' => LANGUAGE_ID, 'ID' => $this->getLocationId()));
while ($city = $res->GetNext()) {
if (!\Bitrix\Sale\SalesZone::checkCityId($city['CITY_ID'], SITE_ID)) {
continue;
}
if (empty($city['CITY_NAME'])) {
continue;
}
$retval = $city;
}
return $retval;
}
示例4: GetConfig
function GetConfig() {
// $locations = array();
// $locationRes = CSaleLocation::GetList();
// while ($locationAr = $locationRes->Fetch()) {
// if ($locationAr["CITY_NAME"]) {
// $locations[$locationAr["ID"]] = $locationAr["CITY_NAME"];
// }
// }
$moduleID = 'getparcel.gpwidget';
if (CModule::IncludeModule($moduleID)) {
$default = COption::GetOptionString($moduleID, 'default_location');
}
$location_list = array();
$location_res = CSaleLocation::GetList(
array("SORT" => "ASC", "CITY_NAME" => "ASC"), array("LID" => LANGUAGE_ID, ">CITY_ID" => ""),
false, false, array("ID", "CITY_NAME")
);
while ($location_ar = $location_res->Fetch()) {
$location_list[$location_ar['ID']] = $location_ar['CITY_NAME'];
}
$arConfig = array(
"CONFIG_GROUPS" => array(
"all" => GetMessage("CONFIG_GROUPS_ALL"),
),
"CONFIG" => array(
"LOCATION_ID" => array(
"TYPE" => "DROPDOWN",
"DEFAULT" => intVal($default) > 0 ? $default : "",
"TITLE" => GetMessage("CONFIG_LOCATION_ID_TITLE"),
"GROUP" => "all",
"VALUES" => $location_list,
),
"URLES" => array(
"SYSTEM_STATUS_URL" => "api/shop-company/v1/system_status",
"TOKEN_URL" => "api/widget/v1/auth_token.json",
"POST_URL" => "api/shop-company/v1/orders.json",
"PATCH_URL" => "api/shop-company/v1/orders/#ID#.json",
"DELIVERY_URL" => "api/shop-company/v1/orders/delivery_price",
)
),
);
return $arConfig;
}
示例5: LocalRedirect
$arZipList = $_REQUEST["ZIP"];
CSaleLocation::SetLocationZIP($ID, $arZipList);
}
}
if (strlen($strError) > 0) {
$bInitVars = True;
} else {
if (strlen($save) > 0) {
LocalRedirect("sale_location_admin.php?lang=" . LANG . GetFilterParams("filter_", false));
} else {
LocalRedirect("sale_location_edit.php?lang=" . LANG . "&ID=" . $ID . GetFilterParams("filter_", false));
}
}
}
if ($ID > 0) {
$db_location = CSaleLocation::GetList(array("SORT" => "ASC"), array("ID" => $ID), LANG);
if (!$db_location->ExtractFields("str_")) {
$ID = 0;
}
$arZipList = array();
$rsZipList = CSaleLocation::GetLocationZIP($ID);
while ($arZip = $rsZipList->Fetch()) {
$arZipList[] = $arZip;
}
}
if ($bInitVars) {
$DB->InitTableVarsForEdit("b_sale_location", "", "str_");
if (is_array($_REQUEST['ZIP'])) {
$arZipList = array();
foreach ($_REQUEST['ZIP'] as $zip) {
$arZipList[] = array('ZIP' => $zip);
示例6: getOrderPropFormated
function getOrderPropFormated($arProperties, $arResult, &$arUserResult, &$arDeleteFieldLocation = array())
{
global $USER;
$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
$curLocation = false;
static $propertyGroupID = 0;
static $propertyUSER_PROPS = "";
// take data from user profile
if ($arUserResult["PROFILE_CHANGE"] == "Y" && intval($arUserResult["PROFILE_ID"]) > 0 && !($arResult["HAVE_PREPAYMENT"] && $arUserResult["PROFILE_DEFAULT"] == "Y" && !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]]))) {
$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array("SORT" => "ASC"), array("USER_PROPS_ID" => $arUserResult["PROFILE_ID"], "ORDER_PROPS_ID" => $arProperties["ID"], "USER_ID" => intval($USER->GetID())), false, false, array("VALUE", "PROP_TYPE", "VARIANT_NAME", "SORT", "ORDER_PROPS_ID"));
if ($arUserPropsValues = $dbUserPropsValues->Fetch()) {
$valueTmp = "";
if ($arUserPropsValues["PROP_TYPE"] == "MULTISELECT") {
$arUserPropsValues["VALUE"] = explode(",", $arUserPropsValues["VALUE"]);
}
$curVal = $arUserPropsValues["VALUE"];
}
} elseif ($arUserResult["PROFILE_CHANGE"] == "Y" && intval($arUserResult["PROFILE_ID"]) <= 0) {
if (isset($curVal)) {
unset($curVal);
}
} elseif (isset($arUserResult["ORDER_PROP"][$arProperties["ID"]])) {
$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
} elseif ($arResult["HAVE_PREPAYMENT"] && !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]])) {
$curVal = $arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]];
if ($arProperties["TYPE"] == "LOCATION") {
$curLocation = $curVal;
}
}
if (intval($_REQUEST["NEW_LOCATION_" . $arProperties["ID"]]) > 0) {
$curVal = intval($_REQUEST["NEW_LOCATION_" . $arProperties["ID"]]);
}
$arProperties["FIELD_NAME"] = "ORDER_PROP_" . $arProperties["ID"];
if (strlen($arProperties["CODE"]) > 0) {
$arProperties["FIELD_ID"] = "ORDER_PROP_" . $arProperties["CODE"];
} else {
$arProperties["FIELD_ID"] = "ORDER_PROP_" . $arProperties["ID"];
}
if (intval($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID || $propertyUSER_PROPS != $arProperties["USER_PROPS"]) {
$arProperties["SHOW_GROUP_NAME"] = "Y";
}
$propertyGroupID = $arProperties["PROPS_GROUP_ID"];
$propertyUSER_PROPS = $arProperties["USER_PROPS"];
if ($arProperties["REQUIED"] == "Y" || $arProperties["IS_EMAIL"] == "Y" || $arProperties["IS_PROFILE_NAME"] == "Y" || $arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y" || $arProperties["IS_PAYER"] == "Y" || $arProperties["IS_ZIP"] == "Y") {
$arProperties["REQUIED_FORMATED"] = "Y";
}
if ($arProperties["TYPE"] == "CHECKBOX") {
if ($curVal == "Y" || !isset($curVal) && $arProperties["DEFAULT_VALUE"] == "Y") {
$arProperties["CHECKED"] = "Y";
$arProperties["VALUE_FORMATED"] = GetMessage("SOA_Y");
} else {
$arProperties["VALUE_FORMATED"] = GetMessage("SOA_N");
}
$arProperties["SIZE1"] = intval($arProperties["SIZE1"]) > 0 ? $arProperties["SIZE1"] : 30;
} elseif ($arProperties["TYPE"] == "TEXT") {
if (strlen($curVal) <= 0) {
if (strlen($arProperties["DEFAULT_VALUE"]) > 0 && !isset($curVal)) {
$arProperties["VALUE"] = $arProperties["DEFAULT_VALUE"];
} elseif ($arProperties["IS_EMAIL"] == "Y") {
$arProperties["VALUE"] = $USER->GetEmail();
} elseif ($arProperties["IS_PAYER"] == "Y") {
//$arProperties["VALUE"] = $USER->GetFullName();
$rsUser = CUser::GetByID($USER->GetID());
$fio = "";
if ($arUser = $rsUser->Fetch()) {
$fio = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"]), false, false);
}
$arProperties["VALUE"] = $fio;
}
} else {
$arProperties["VALUE"] = $curVal;
}
//select ZIP for LOCATION
if ($arProperties["IS_ZIP"] == "Y" && $arUserResult["PROFILE_CHANGE"] == "N") {
$dbPropertiesLoc = CSaleOrderProps::GetList(array("ID" => "DESC"), array("PERSON_TYPE_ID" => $arUserResult["PERSON_TYPE_ID"], "ACTIVE" => "Y", "UTIL" => "N", "IS_LOCATION" => "Y"), false, false, array("ID"));
$arPropertiesLoc = $dbPropertiesLoc->Fetch();
if ($arPropertiesLoc["ID"] > 0) {
$arZipLocation = array();
if (strlen($curVal) > 0) {
$arZipLocation = CSaleLocation::GetByZIP($curVal);
}
$rsZipList = CSaleLocation::GetLocationZIP($arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]);
if ($arZip = $rsZipList->Fetch()) {
if (strlen($arZip["ZIP"]) > 0 && (empty($arZipLocation) || $arZipLocation["ID"] != $arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]])) {
$arProperties["VALUE"] = $arZip["ZIP"];
}
}
}
}
if ($arProperties["IS_ZIP"] == "Y") {
$arUserResult["DELIVERY_LOCATION_ZIP"] = $arProperties["VALUE"];
}
$arProperties["VALUE"] = htmlspecialcharsEx($arProperties["VALUE"]);
$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];
} elseif ($arProperties["TYPE"] == "SELECT") {
$arProperties["SIZE1"] = intval($arProperties["SIZE1"]) > 0 ? $arProperties["SIZE1"] : 1;
$dbVariants = CSaleOrderPropsVariant::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ORDER_PROPS_ID" => $arProperties["ID"]), false, false, array("*"));
$flagDefault = "N";
$nameProperty = "";
while ($arVariants = $dbVariants->GetNext()) {
//.........这里部分代码省略.........
示例7: CCSVData
$siteID = $arParams["site_id"];
if (strlen($arParams["site_id"]) <= 0) {
$siteID = "s1";
}
$dbSite = CSite::GetByID($siteID);
if ($arSite = $dbSite->Fetch()) {
$lang = $arSite["LANGUAGE_ID"];
}
if (strlen($lang) <= 0) {
$lang = "ru";
}
$bRus = false;
if ($lang == "ru") {
$bRus = true;
}
$dbLocation = CSaleLocation::GetList(array());
if (!$dbLocation->Fetch()) {
//Locations
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/csv_data.php";
$csvFile = new CCSVData();
$csvFile->LoadFile(dirname(__FILE__) . "/data/" . $lang . "/loc.csv");
if (IntVal($_SESSION["LOC_POST"]) > 0) {
$csvFile->SetPos($_SESSION["LOC_POST"]);
}
$csvFile->SetFieldsType("R");
$csvFile->SetFirstHeader(false);
$csvFile->SetDelimiter(",");
$arRes = $csvFile->Fetch();
$arLocation = array();
$arLocationMap = array();
if (is_array($arRes) && count($arRes) > 0 && strlen($arRes[0]) == 2) {
示例8: array
$arOrderProps["VALUES"][] = $vars;
}
elseif($arOrderProps["TYPE"]=="LOCATION")
{
$propsOfTypeLocation[$arOrderProps['ID']] = true; // required for mapping ID<=>CODE below
if(CSaleLocation::isLocationProMigrated())
{
$arOrderProps["VALUES"] = array();
if(strlen($arOrderProps["DEFAULT_VALUE"]))
$arOrderProps["DEFAULT_VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["DEFAULT_VALUE"]);
}
else
{
// perfomance hole
$dbVars = CSaleLocation::GetList(Array("SORT"=>"ASC", "COUNTRY_NAME_LANG"=>"ASC", "CITY_NAME_LANG"=>"ASC"), array(), LANGUAGE_ID);
while($vars = $dbVars->GetNext())
$arOrderProps["VALUES"][] = $vars;
}
}
$arrayTmp[$arOrderPropsGroup["ID"]]["PROPS"][] = $arOrderProps;
}
}
$arResult["ORDER_PROPS"] = $arrayTmp;
// get prop values
$arPropValsTmp = Array();
if (!$bInitVars)
{
$dbPropVals = CSaleOrderUserPropsValue::GetList(
array("SORT" => "ASC"),
示例9: elseif
if (intval($rsUser->SelectedRowsCount())>0)
$arRes["RESULT"] = "Y";
else
$arRes["RESULT"] = "N";
}
}
elseif(isset($_POST['ADDRESS_ID']) && CModule::IncludeModule("useraddress") && CModule::IncludeModule("sale"))
{
$addressID = intval($_POST['ADDRESS_ID']);
$addressInfo = CUserAddress::getAddressId($addressID);
//поиск LOCATION по названию города
$db_vars = CSaleLocation::GetList(
array(),
array("LID" => LANGUAGE_ID, "CITY_NAME" => trim($addressInfo[0]["CITY"])),
false,
false,
array("ID")
);
while ($vars = $db_vars->Fetch()):
$arRes["LOCATION_ID"] = $vars["ID"];
endwhile;
}
elseif(isset($_POST["getAddressData"])){
include($_SERVER["DOCUMENT_ROOT"].'/local/components/zakrepi/sale.order.ajax/functions.php');
$arResult = Array();
getJsUserAddress($arResult, $USER->GetID());
$arRes = $arResult["JS_USER_ADDRESS"];
}
示例10: Delete
/**
* <p>Функция удаляет местоположение с кодом ID. Функция так же удаляет город этого местоположения, страну этого местоположения (если она не входит больше ни в одно другое местоположение), а так же связи этого местоположения с группами местоположений и службами доставки. </p>
*
*
*
*
* @param int $ID Код местоположения. </h
*
*
*
* @return bool <p>Функция возвращает <i>true</i> в случае успешного удаления
* местоположения и <i>false</i> - в противном случае.</p> <a name="examples"></a>
*
*
* <h4>Example</h4>
* <pre>
* <?
* if (!CSaleLocation::Delete(12))
* echo "Ошибка удаления местоположения";<br>?>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalelocation/csalelocation__delete.008e0aa2.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
if (!($arLocRes = CSaleLocation::GetByID($ID, LANGUAGE_ID))) {
return false;
}
foreach (GetModuleEvents("sale", "OnBeforeLocationDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
if (IntVal($arLocRes["CITY_ID"]) > 0) {
CSaleLocation::DeleteCity($arLocRes["CITY_ID"]);
}
$bDelCountry = True;
$db_res = CSaleLocation::GetList(array("SORT" => "ASC"), array("COUNTRY_ID" => $arLocRes["COUNTRY_ID"], "!ID" => $ID), LANGUAGE_ID);
if ($db_res->Fetch()) {
$bDelCountry = false;
}
if ($bDelCountry && IntVal($arLocRes["COUNTRY_ID"]) > 0) {
CSaleLocation::DeleteCountry($arLocRes["COUNTRY_ID"]);
}
$bDelRegion = True;
$db_res = CSaleLocation::GetList(array("SORT" => "ASC"), array("REGION_ID" => $arLocRes["REGION_ID"], "!ID" => $ID), LANGUAGE_ID);
if ($db_res->Fetch()) {
$bDelRegion = false;
}
if ($bDelRegion && IntVal($arLocRes["REGION_ID"]) > 0) {
CSaleLocation::DeleteRegion($arLocRes["REGION_ID"]);
}
$DB->Query("DELETE FROM b_sale_location2location_group WHERE LOCATION_ID = " . $ID . "", true);
$DB->Query("DELETE FROM b_sale_delivery2location WHERE LOCATION_ID = " . $ID . " AND LOCATION_TYPE = 'L'", true);
$DB->Query("DELETE FROM b_sale_location_zip WHERE LOCATION_ID = " . $ID . "", true);
$bDelete = $DB->Query("DELETE FROM b_sale_location WHERE ID = " . $ID . "", true);
foreach (GetModuleEvents("sale", "OnLocationDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
return $bDelete;
}
示例11: array
$arResult["REGION_LIST"] = array();
} elseif (count($arResult["REGION_LIST"]) == 1) {
$arParams["REGION"] = $arResult["REGION_LIST"][0]["ID"];
}
//select city
$arResult["CITY_LIST"] = array();
if ($arResult["EMPTY_CITY"] == "N" && (count($arResult["COUNTRY_LIST"]) > 0 && count($arResult["REGION_LIST"]) > 0 && $arParams["COUNTRY"] > 0 && $arParams["REGION"] > 0 || count($arResult["COUNTRY_LIST"]) <= 0 && count($arResult["REGION_LIST"]) > 0 && $arParams["REGION"] > 0 || count($arResult["COUNTRY_LIST"]) > 0 && count($arResult["REGION_LIST"]) <= 0 && $arParams["COUNTRY"] > 0 || count($arResult["COUNTRY_LIST"]) <= 0 && count($arResult["REGION_LIST"]) <= 0)) {
$arCityFilter = array("LID" => LANGUAGE_ID);
if ($arParams["COUNTRY"] > 0) {
$arCityFilter["COUNTRY_ID"] = $arParams["COUNTRY"];
}
if ($arParams["REGION"] > 0) {
$arCityFilter["REGION_ID"] = $arParams["REGION"];
}
if ($arParams['ALLOW_EMPTY_CITY'] == 'Y') {
$rsLocationsList = CSaleLocation::GetList(array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"), $arCityFilter, false, false, array("ID", "CITY_ID", "CITY_NAME"));
while ($arCity = $rsLocationsList->GetNext()) {
if (!SalesZone::checkCityId($arCity["CITY_ID"], $arParams["SITE_ID"])) {
continue;
}
$arResult["CITY_LIST"][] = array("ID" => $arCity[$arParams["CITY_OUT_LOCATION"] == "Y" ? "ID" : "CITY_ID"], "CITY_ID" => $arCity['CITY_ID'], "CITY_NAME" => $arCity["CITY_NAME"]);
if ($arCity["ID"] == $arParams["CITY"]) {
$locationString = (strlen($arCity["CITY_NAME"]) > 0 ? $arCity["CITY_NAME"] . ", " : "") . $locationString;
if (IntVal($arParams["LOCATION_VALUE"]) <= 0) {
$arParams["LOCATION_VALUE"] = $arCity["ID"];
}
$arResult["LOCATION_DEFAULT"] = $arCity["ID"];
}
}
//end while
}
示例12: grabTree
private function grabTree()
{
$this->data['LOC'] = array();
$auxIndex = array('COUNTRY' => array(), 'REGION' => array(), 'CITY' => array());
$this->data['LOC'] = array('COUNTRY' => array(), 'REGION' => array(), 'CITY' => array());
// level 1: country
$res = \CSaleLocation::GetList(array(), array('!COUNTRY_ID' => false, 'REGION_ID' => false, 'CITY_ID' => false, 'LID' => 'en'));
while ($item = $res->Fetch()) {
if (!isset($this->data['LOC']['COUNTRY'][$item['ID']])) {
$this->data['LOC']['COUNTRY'][$item['ID']] = array('SUBJ_ID' => $item['COUNTRY_ID'], 'PARENT_ID' => false, 'PARENT_TYPE' => false);
$auxIndex['COUNTRY'][$item['COUNTRY_ID']] = $item['ID'];
}
}
// level 2: country - region
$res = \CSaleLocation::GetList(array(), array('!REGION_ID' => false, 'CITY_ID' => false, 'LID' => 'en'));
while ($item = $res->Fetch()) {
if (!isset($this->data['LOC']['REGION'][$item['ID']])) {
$this->data['LOC']['REGION'][$item['ID']] = array('SUBJ_ID' => $item['REGION_ID'], 'PARENT_ID' => $auxIndex['COUNTRY'][$item['COUNTRY_ID']], 'PARENT_TYPE' => 'COUNTRY');
$auxIndex['REGION'][$item['REGION_ID']] = $item['ID'];
}
}
// level 2: country - city
$res = \CSaleLocation::GetList(array(), array('REGION_ID' => false, '!CITY_ID' => false, 'LID' => 'en'));
while ($item = $res->Fetch()) {
if (!isset($this->data['LOC']['CITY'][$item['ID']])) {
$this->data['LOC']['CITY'][$item['ID']] = array('SUBJ_ID' => $item['CITY_ID'], 'PARENT_ID' => $auxIndex['COUNTRY'][$item['COUNTRY_ID']], 'PARENT_TYPE' => 'COUNTRY');
}
}
// level 3: country - region - city
$res = \CSaleLocation::GetList(array(), array('!REGION_ID' => false, '!CITY_ID' => false, 'LID' => 'en'));
while ($item = $res->Fetch()) {
if (!isset($this->data['LOC']['CITY'][$item['ID']])) {
$this->data['LOC']['CITY'][$item['ID']] = array('SUBJ_ID' => $item['CITY_ID'], 'PARENT_ID' => $auxIndex['REGION'][$item['REGION_ID']], 'PARENT_TYPE' => 'REGION');
}
}
// language list
$a = false;
$b = false;
$lang = new \CLanguage();
$res = $lang->GetList($a, $b);
$this->data['LANG'] = array();
while ($item = $res->Fetch()) {
$this->data['LANG'][] = $item['LID'];
}
// type list
$res = Location\TypeTable::getList();
while ($item = $res->Fetch()) {
$this->data['TYPE'][$item['CODE']] = $item['ID'];
}
}
示例13: getLocationFromNameCity
function getLocationFromNameCity($name_city){
$arRes = Array();
if($name_city != '' && CModule::IncludeModule("useraddress") && CModule::IncludeModule("sale"))
{
//поиск LOCATION по названию города
$db_vars = CSaleLocation::GetList(
array(),
array("LID" => LANGUAGE_ID, "CITY_NAME" => trim($name_city)),
false,
false,
array("ID")
);
while ($vars = $db_vars->Fetch()):
$arRes["LOCATION_ID"] = $vars["ID"];
endwhile;
}
return $arRes["LOCATION_ID"];
}
示例14: 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;
//.........这里部分代码省略.........
示例15: unset
}
}
}
if ($bFinish) {
unset($_SESSION["LOC_POS"]);
} else {
return true;
}
$time_limit = ini_get('max_execution_time');
if ($time_limit < LOC_STEP_LENGTH) {
set_time_limit(LOC_STEP_LENGTH + 5);
}
$start_time = time();
$finish_time = $start_time + LOC_STEP_LENGTH;
if ($loc_file == "loc_ussr.csv" && file_exists($_SERVER['DOCUMENT_ROOT'] . WIZARD_SERVICE_RELATIVE_PATH . "/locations/ru/zip_ussr.csv")) {
$rsLocations = CSaleLocation::GetList(array(), array("LID" => 'ru'), false, false, array("ID", "CITY_NAME_LANG", "REGION_NAME_LANG"));
$arLocationMap = array();
while ($arLocation = $rsLocations->Fetch()) {
if (strlen($arLocation["CITY_NAME_LANG"]) > 0) {
if (strlen($arLocation["REGION_NAME_LANG"]) > 0) {
$arLocationMap[$arLocation["CITY_NAME_LANG"]][$arLocation["REGION_NAME_LANG"]] = $arLocation["ID"];
} else {
$arLocationMap[$arLocation["CITY_NAME_LANG"]] = $arLocation["ID"];
}
}
}
$DB->StartTransaction();
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/csv_data.php";
$csvFile = new CCSVData();
$csvFile->LoadFile($_SERVER['DOCUMENT_ROOT'] . WIZARD_SERVICE_RELATIVE_PATH . "/locations/ru/zip_ussr.csv");
$csvFile->SetFieldsType("R");