本文整理汇总了PHP中CSaleLocation::getLocationIDbyCODE方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::getLocationIDbyCODE方法的具体用法?PHP CSaleLocation::getLocationIDbyCODE怎么用?PHP CSaleLocation::getLocationIDbyCODE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleLocation
的用法示例。
在下文中一共展示了CSaleLocation::getLocationIDbyCODE方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Array
// get prop values
$arPropValsTmp = Array();
if (!$bInitVars)
{
$dbPropVals = CSaleOrderUserPropsValue::GetList(
array("SORT" => "ASC"),
array("USER_PROPS_ID" => $arUserProps["ID"]),
false,
false,
array("ID", "ORDER_PROPS_ID", "VALUE", "SORT")
);
while ($arPropVals = $dbPropVals->GetNext())
{
// replace here
if(CSaleLocation::isLocationProMigrated() && isset($propsOfTypeLocation[$arPropVals['ORDER_PROPS_ID']]))
$arPropVals["VALUE"] = CSaleLocation::getLocationIDbyCODE($arPropVals["VALUE"]);
$arPropValsTmp["ORDER_PROP_".$arPropVals["ORDER_PROPS_ID"]] = $arPropVals["VALUE"];
}
}
else
{
foreach ($_REQUEST as $key => $value)
{
if (substr($key, 0, strlen("ORDER_PROP_"))=="ORDER_PROP_")
$arPropValsTmp[$key] = htmlspecialcharsbx($value);
}
}
$arResult["ORDER_PROPS_VALUES"] = $arPropValsTmp;
}
else
示例2: strlen
elseif ($arOrderProps["TYPE"] == "LOCATION")
{
$arOrder["LOCATION_TO"] = $arOrderProps["VALUE"];
if(CSaleLocation::isLocationProEnabled())
{
$locationString = Location\Admin\LocationHelper::getLocationStringByCode($arOrderProps['VALUE']);
if(!strlen($locationString))
$locationString = $arOrderProps['VALUE'];
print(htmlspecialcharsEx($locationString));
}
else
{
if(CSaleLocation::isLocationProMigrated())
$arOrderProps["VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["VALUE"]);
$arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANG);
$locationString = $arVal["COUNTRY_NAME"];
if (strlen($arVal["REGION_NAME"]) > 0 && strlen($locationString) > 0)
$locationString .= " - ".$arVal["REGION_NAME"];
elseif (strlen($locationString) <= 0 && strlen($arVal["REGION_NAME"]) > 0)
$locationString = $arVal["REGION_NAME"];
if (strlen($locationString) > 0 && strlen($arVal["CITY_NAME"]) > 0)
$locationString .= " - ".$arVal["CITY_NAME"];
elseif (strlen($locationString) <= 0 && strlen($arVal["CITY_NAME"]) > 0)
$locationString = $arVal["CITY_NAME"];
echo htmlspecialcharsEx($locationString);
示例3: fGetBuyerType
//.........这里部分代码省略.........
if (substr($key, 0, strlen("CITY_ORDER_PROP_")) == "CITY_ORDER_PROP_")
{
$arPropValues[intval(substr($key, strlen("CITY_ORDER_PROP_")))] = htmlspecialcharsbx($value);
$locationIndexForm = intval(substr($key, strlen("CITY_ORDER_PROP_")));
}
if (substr($key, 0, strlen("ORDER_PROP_")) == "ORDER_PROP_")
{
if ($locationIndexForm != intval(substr($key, strlen("ORDER_PROP_"))) && !is_array($value))
$arPropValues[intval(substr($key, strlen("ORDER_PROP_")))] = htmlspecialcharsbx($value);
}
}
$userComment = $_POST["USER_DESCRIPTION"];
}
elseif ($ORDER_ID == "" AND $USER_ID != "") // from profile
{
//profile
$userProfile = array();
$userProfile = CSaleOrderUserProps::DoLoadProfiles($USER_ID, $PERSON_TYPE_ID);
$arPropValues = $userProfile[$PERSON_TYPE_ID]["VALUES"];
}
elseif ($ORDER_ID != "") // from order properties
{
$dbPropValuesList = CSaleOrderPropsValue::GetList(
array(),
array("ORDER_ID" => $ORDER_ID, "ACTIVE" => "Y"),
false,
false,
array("ID", "ORDER_PROPS_ID", "NAME", "VALUE", "CODE")
);
while ($arPropValuesList = $dbPropValuesList->Fetch())
{
// from db
if(CSaleLocation::isLocationProMigrated() && $arPropertiesList[$arPropValuesList['ORDER_PROPS_ID']]['TYPE'] == 'LOCATION')
$arPropValuesList["VALUE"] = CSaleLocation::getLocationIDbyCODE($arPropValuesList["VALUE"]);
$arPropValues[intval($arPropValuesList["ORDER_PROPS_ID"])] = htmlspecialcharsbx($arPropValuesList["VALUE"]);
}
}
$location2townFldMap = array();
$arDisableFieldForLocation = array();
//select field (town) for disable
$dbProperties = CSaleOrderProps::GetList(
array(),
array("PERSON_TYPE_ID" => $PERSON_TYPE_ID, "ACTIVE" => "Y", ">INPUT_FIELD_LOCATION" => 0),
false,
false,
array("INPUT_FIELD_LOCATION")
);
while ($arProperties = $dbProperties->Fetch())
{
$arDisableFieldForLocation[$arProperties["INPUT_FIELD_LOCATION"]] = $arProperties["INPUT_FIELD_LOCATION"];
}
//show town if location is another
$arEnableTownProps = array();
$dbOrderProps = CSaleOrderPropsValue::GetOrderProps($ORDER_ID);
while ($arOrderProps = $dbOrderProps->Fetch())
{
if($arOrderProps["TYPE"] == "LOCATION" && $arOrderProps["ACTIVE"] == "Y" && $arOrderProps["IS_LOCATION"] == "Y")
{
if (in_array($arOrderProps["INPUT_FIELD_LOCATION"], $arDisableFieldForLocation))
{
if(CSaleLocation::isLocationProMigrated())
{
if(CSaleLocation::checkLocationIsAboveCity($arPropValues[$arOrderProps["ORDER_PROPS_ID"]]))
示例4: array
$arFilter["!ID"] = $arParams["PROP_" . $arUserResult["PERSON_TYPE_ID"]];
}
$dbProperties = CSaleOrderProps::GetList(array("GROUP_SORT" => "ASC", "PROPS_GROUP_ID" => "ASC", "USER_PROPS" => "ASC", "SORT" => "ASC", "NAME" => "ASC"), $arFilter, false, false, array("ID", "NAME", "TYPE", "REQUIED", "DEFAULT_VALUE", "IS_LOCATION", "PROPS_GROUP_ID", "SIZE1", "SIZE2", "DESCRIPTION", "IS_EMAIL", "IS_PROFILE_NAME", "IS_PAYER", "IS_LOCATION4TAX", "CODE", "GROUP_NAME", "GROUP_SORT", "SORT", "USER_PROPS", "IS_ZIP", "INPUT_FIELD_LOCATION"));
while ($arProperties = $dbProperties->GetNext()) {
unset($curVal);
if ($arUserResult["PROFILE_CHANGE"] == "Y" && IntVal($arUserResult["PROFILE_ID"]) > 0) {
$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"];
// here we must map location ID to location CODE, kz we always keep CODE in user profile
if (CSaleLocation::isLocationProMigrated() && $arUserPropsValues["PROP_TYPE"] == "LOCATION" && strlen($curVal)) {
$curVal = CSaleLocation::getLocationIDbyCODE($curVal);
}
} else {
$curVal = false;
}
} elseif ($arUserResult["PROFILE_CHANGE"] == "Y" && IntVal($arUserResult["PROFILE_ID"]) <= 0) {
unset($curVal);
} elseif (isset($arUserResult["ORDER_PROP"][$arProperties["ID"]])) {
$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
}
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"];
示例5: TranslateLocationPropertyValues
public static function TranslateLocationPropertyValues($personTypeId, &$orderProps, $direct = true)
{
if (CSaleLocation::isLocationProMigrated()) {
// location ID to CODE
$dbOrderProps = CSaleOrderProps::GetList(array("SORT" => "ASC"), array('PERSON_TYPE_ID' => $personTypeId), false, false, array("ID", "NAME", "TYPE", "IS_LOCATION", "IS_LOCATION4TAX", "IS_PROFILE_NAME", "IS_PAYER", "IS_EMAIL", "REQUIED", "SORT", "IS_ZIP", "CODE", "MULTIPLE"));
while ($item = $dbOrderProps->fetch()) {
if ($item['TYPE'] == 'LOCATION' && strlen($orderProps[$item['ID']])) {
$source = $orderProps[$item['ID']];
$replace = $direct ? CSaleLocation::getLocationCODEbyID($source) : CSaleLocation::getLocationIDbyCODE($source);
$orderProps[$item['ID']] = $replace;
}
}
}
}
示例6: obtainProps
/**
* Function gets order properties from database
* @param mixed[] $cached Cached data taken from obtainDataCachedStructure()
* @return void
*/
protected function obtainProps(&$cached)
{
if (empty($this->dbResult["ID"])) {
return;
}
$props = array();
$dbOrderProps = CSaleOrderPropsValue::GetOrderProps($this->dbResult["ID"]);
$iGroup = -1;
while ($arOrderProps = $dbOrderProps->Fetch()) {
if (empty($this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]]) || !in_array($arOrderProps["ORDER_PROPS_ID"], $this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]])) {
if ($arOrderProps["ACTIVE"] == "Y" && $arOrderProps["UTIL"] == "N") {
$arOrderPropsTmp = $arOrderProps;
if ($iGroup != intval($arOrderProps["PROPS_GROUP_ID"])) {
$arOrderPropsTmp["SHOW_GROUP_NAME"] = "Y";
$iGroup = intval($arOrderProps["PROPS_GROUP_ID"]);
}
if ($arOrderProps["TYPE"] == "SELECT" || $arOrderProps["TYPE"] == "RADIO") {
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $arOrderProps["VALUE"]);
$arOrderPropsTmp["VALUE"] = htmlspecialcharsEx($arVal["NAME"]);
} elseif ($arOrderProps["TYPE"] == "MULTISELECT") {
$arOrderPropsTmp["VALUE"] = "";
$curVal = explode(",", $arOrderProps["VALUE"]);
for ($i = 0, $intCount = count($curVal); $i < $intCount; $i++) {
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
if ($i > 0) {
$arOrderPropsTmp["VALUE"] .= ", ";
}
$arOrderPropsTmp["VALUE"] .= htmlspecialcharsEx($arVal["NAME"]);
}
} elseif ($arOrderProps["TYPE"] == "LOCATION") {
$locationName = "";
if (CSaleLocation::isLocationProEnabled()) {
$locationName = Location\Admin\LocationHelper::getLocationPathDisplay($arOrderProps["VALUE"]);
} else {
if (CSaleLocation::isLocationProMigrated()) {
$arOrderProps["VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["VALUE"]);
}
$arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANGUAGE_ID);
$locationName .= !strlen($arVal["COUNTRY_NAME"]) ? "" : $arVal["COUNTRY_NAME"];
if (strlen($arVal["COUNTRY_NAME"]) && strlen($arVal["REGION_NAME"])) {
$locationName .= " - " . $arVal["REGION_NAME"];
} elseif (strlen($arVal["REGION_NAME"])) {
$locationName .= $arVal["REGION_NAME"];
}
if (strlen($arVal["COUNTRY_NAME"]) || strlen($arVal["REGION_NAME"])) {
$locationName .= " - " . $arVal["CITY_NAME"];
} elseif (strlen($arVal["CITY_NAME"])) {
$locationName .= $arVal["CITY_NAME"];
}
}
$arOrderPropsTmp["VALUE"] = $locationName;
} elseif ($arOrderProps["TYPE"] == "FILE") {
if (strpos($arOrderProps["VALUE"], ",") !== false) {
$fileValue = "";
$values = explode(",", $arOrderProps["VALUE"]);
if (self::isNonemptyArray($values)) {
foreach ($values as $fileId) {
$fileValue .= CFile::ShowFile(trim($fileId), 0, 90, 90, true) . "<br/>";
}
}
$arOrderPropsTmp["VALUE"] = $fileValue;
} else {
$arOrderPropsTmp["VALUE"] = CFile::ShowFile($arOrderProps["VALUE"], 0, 90, 90, true);
}
}
$props[] = $arOrderPropsTmp;
}
}
}
$cached["ORDER_PROPS"] = $props;
}
示例7: elseif
$arRes = $arResult["JS_USER_ADDRESS"];
}
elseif(isset($_POST["CITY_NAME"])&& CModule::IncludeModule("useraddress") && CModule::IncludeModule("sale")){
$city_name = "%".$_POST["CITY_NAME"]."%";
$res = \Bitrix\Sale\Location\LocationTable::getList(array(
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID,"NAME_RU"=>$city_name,"!CITY_ID"=>''),
'select' => array('*', 'NAME_RU' => 'NAME.NAME', 'TYPE_CODE' => 'TYPE.CODE')
));
$arRes["LOCATION_ID"] = array();
$i=0;
while($item = $res->Fetch())
{
$ID = CSaleLocation::getLocationIDbyCODE($item['CODE']);
$arVal = CSaleLocation::GetByID( $ID, LANGUAGE_ID);
//$arRes["LOCATION_ID"][$i] = $item;
$arRes["LOCATION_ID"][$i]['ID'] = $item['CITY_ID'];
$arRes["LOCATION_ID"][$i]['NAME'] = $item['NAME_RU'];
$arRes["LOCATION_ID"][$i]['REGION'] = $arVal['REGION_NAME_LANG'];
$i++;
}
}
$APPLICATION->RestartBuffer();
header('Content-Type: application/json; charset='.LANG_CHARSET);
echo CUtil::PhpToJSObject($arRes);
die();
示例8: orderCreate
/**
*
* Creates order or returns array of order and customer for mass upload
*
* @param array $arFields
* @param $api
* @param $arParams
* @param $send
* @return boolean
* @return array - array('order' = $order, 'customer' => $customer)
*/
public static function orderCreate($arFields, $api, $arParams, $send = false, $site = null)
{
if (!$api || empty($arParams)) {
// add cond to check $arParams
return false;
}
if (empty($arFields)) {
self::eventLog('ICrmOrderActions::orderCreate', 'empty($arFields)', 'incorrect order');
return false;
}
if (isset($arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['city']) == false) {
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'], 'CODE' => 'LOCATION'));
$arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['city'] = $rsOrderProps->SelectedRowsCount() < 1 ? 'CITY' : 'LOCATION';
}
$normalizer = new RestNormalizer();
$normalizer->setValidation($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.intarocrm/classes/general/config/retailcrm.json');
$customer = array();
if ($arFields['CANCELED'] == 'Y') {
$arFields['STATUS_ID'] = $arFields['CANCELED'] . $arFields['CANCELED'];
}
$order = array('number' => $arFields['ACCOUNT_NUMBER'], 'externalId' => $arFields['ID'], 'createdAt' => new \DateTime($arFields['DATE_INSERT']), 'customerId' => $arFields['USER_ID'], 'discount' => $arFields['DISCOUNT_VALUE'], 'markDateTime' => $arFields['DATE_MARKED'], 'paymentType' => isset($arParams['optionsPayTypes'][$arFields['PAY_SYSTEM_ID']]) ? $arParams['optionsPayTypes'][$arFields['PAY_SYSTEM_ID']] : '', 'paymentStatus' => isset($arParams['optionsPayment'][$arFields['PAYED']]) ? $arParams['optionsPayment'][$arFields['PAYED']] : '', 'orderType' => isset($arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']]) ? $arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']] : '', 'contragentType' => isset($arParams['optionsContragentType'][$arFields['PERSON_TYPE_ID']]) ? $arParams['optionsContragentType'][$arFields['PERSON_TYPE_ID']] : '', 'status' => isset($arParams['optionsPayStatuses'][$arFields['STATUS_ID']]) ? $arParams['optionsPayStatuses'][$arFields['STATUS_ID']] : '', 'statusComment' => $arFields['REASON_CANCELED'], 'customerComment' => $arFields['USER_DESCRIPTION'], 'managerComment' => $arFields['COMMENTS'], 'delivery' => array('cost' => $arFields['PRICE_DELIVERY']));
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
while ($ar = $rsOrderProps->Fetch()) {
if ($search = array_search($ar['CODE'], $arParams['optionsLegalDetails'][$arFields['PERSON_TYPE_ID']])) {
$order[$search] = $ar['VALUE'];
$customer[$search] = $ar['VALUE'];
} elseif ($search = array_search($ar['CODE'], $arParams['optionsCustomFields'][$arFields['PERSON_TYPE_ID']])) {
$order['customFields'][$search] = $ar['VALUE'];
} elseif ($search = array_search($ar['CODE'], $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']])) {
if (in_array($search, array('fio', 'phone', 'email'))) {
if ($search == 'fio') {
$order = array_merge($order, self::explodeFIO($ar['VALUE']));
} else {
$order[$search] = $ar['VALUE'];
}
} else {
$prop = CSaleOrderProps::GetByID($ar['ORDER_PROPS_ID']);
if ($prop['TYPE'] == 'LOCATION') {
$ar['VALUE'] = CSaleLocation::GetByID(method_exists('CSaleLocation', 'getLocationIDbyCODE') ? CSaleLocation::getLocationIDbyCODE($ar['VALUE']) : $ar['VALUE']);
$ar['VALUE'] = $ar['VALUE']['CITY_NAME_LANG'];
}
$order['delivery']['address'][$search] = $ar['VALUE'];
}
}
}
if (strpos($arFields['DELIVERY_ID'], ":") !== false) {
$arFields["DELIVERY_ID"] = explode(":", $arFields["DELIVERY_ID"], 2);
if ($arDeliveryType = CSaleDeliveryHandler::GetBySID(reset($arFields["DELIVERY_ID"]))->GetNext()) {
if (array_key_exists(end($arFields["DELIVERY_ID"]), $arDeliveryType['PROFILES'])) {
$arFields["DELIVERY_SERVICE"] = array('code' => implode('-', $arFields["DELIVERY_ID"]), 'name' => $arDeliveryType['PROFILES'][end($arFields["DELIVERY_ID"])]['TITLE']);
}
}
$arFields["DELIVERY_ID"] = reset($arFields["DELIVERY_ID"]);
}
if (array_key_exists($arFields['DELIVERY_ID'], $arParams['optionsDelivTypes'])) {
$order['delivery']['code'] = $arParams['optionsDelivTypes'][$arFields["DELIVERY_ID"]];
if (isset($arFields["DELIVERY_SERVICE"])) {
$order['delivery']['service'] = $arFields["DELIVERY_SERVICE"];
}
}
$rsOrderBasket = CSaleBasket::GetList(array('ID' => 'ASC'), array('ORDER_ID' => $arFields['ID']));
while ($p = $rsOrderBasket->Fetch()) {
$item = array('quantity' => $p['QUANTITY'], 'productId' => $p['PRODUCT_ID'], 'xmlId' => $p['PRODUCT_XML_ID'], 'productName' => $p['NAME'], 'comment' => $p['NOTES'], 'createdAt' => new \DateTime($p['DATE_INSERT']));
$pp = CCatalogProduct::GetByID($p['PRODUCT_ID']);
if (is_null($pp['PURCHASING_PRICE']) == false) {
$item['purchasePrice'] = $pp['PURCHASING_PRICE'];
}
$propCancel = CSaleBasket::GetPropsList(array(), array('BASKET_ID' => $p['ID'], 'CODE' => self::CANCEL_PROPERTY_CODE))->Fetch();
if (!$propCancel || $propCancel && !(int) $propCancel['VALUE']) {
$item['discount'] = (double) $p['DISCOUNT_PRICE'];
$item['initialPrice'] = (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'];
}
$order['items'][] = $item;
}
$arUser = CUser::GetByID($arFields['USER_ID'])->Fetch();
$customer = array('externalId' => $arFields['USER_ID'], 'lastName' => $arUser['LAST_NAME'], 'firstName' => $arUser['NAME'], 'patronymic' => $arUser['SECOND_NAME'], 'phones' => array(array('number' => $arUser['PERSONAL_PHONE']), array('number' => $arUser['WORK_PHONE'])), 'createdAt' => new \DateTime($arUser['DATE_REGISTER']), 'contragentType' => $arParams['optionsContragentType'][$arFields['PERSON_TYPE_ID']]);
if (function_exists('intarocrm_get_order_type')) {
$orderType = intarocrm_get_order_type($arFields);
if ($orderType) {
$order['orderType'] = $orderType;
}
}
if (function_exists('intarocrm_before_order_send')) {
$newResOrder = intarocrm_before_order_send($order);
if (is_array($newResOrder) && !empty($newResOrder)) {
$order = $newResOrder;
}
}
$customer = $normalizer->normalize($customer, 'customers');
//.........这里部分代码省略.........
示例9: 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"];
if(CSaleLocation::isLocationProMigrated())
{
if($arProperties['TYPE'] == 'LOCATION')
$curVal = CSaleLocation::getLocationIDbyCODE($curVal);
}
}
}
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());
//.........这里部分代码省略.........
示例10: 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"];
if(CSaleLocation::isLocationProMigrated())
{
// SPIKE: map here LOCATION CODE to ID, kz now we keep CODE, not ID in the DB
if($arProperties['TYPE'] == 'LOCATION')
{
$curVal = CSaleLocation::getLocationIDbyCODE($curVal);
}
}
}
}
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")
//.........这里部分代码省略.........