本文整理汇总了PHP中CSaleOrderPropsVariant::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderPropsVariant::GetList方法的具体用法?PHP CSaleOrderPropsVariant::GetList怎么用?PHP CSaleOrderPropsVariant::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrderPropsVariant
的用法示例。
在下文中一共展示了CSaleOrderPropsVariant::GetList方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetByValue
/**
* <p>Функция возвращает параметры варианта значения свойства заказа по коду свойства заказа и значению.</p>
*
*
*
*
* @param int $PropID Код свойства заказа. </ht
*
*
*
* @param string $Value Значение свойства. </h
*
*
*
* @return array <p>Возвращается ассоциативный массив значений параметров заказа
* с ключами:</p> <table class="tnormal" width="100%"> <tr> <th width="15%">Код</th> <th>Описание</th>
* </tr> <tr> <td>ID</td> <td>Код варианта значения свойства заказа.</td> </tr> <tr>
* <td>ORDER_PROPS_ID</td> <td>Код свойства заказа.</td> </tr> <tr> <td>NAME</td> <td>Название
* варианта.</td> </tr> <tr> <td>VALUE</td> <td>Значение варианта.</td> </tr> <tr> <td>SORT</td>
* <td>Индекс сортировки.</td> </tr> <tr> <td>DESCRIPTION</td> <td>Описание варианта
* значения свойства заказа.</td> </tr> </table> <a name="examples"></a>
*
*
* <h4>Example</h4>
* <pre>
* <?
* $arVal = CSaleOrderPropsVariant::GetByValue(12, "F");
* echo $arVal["NAME"];
* ?>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csaleorderpropsvariant/csaleorderpropsvariant__getbyvalue.48f24a76.php
* @author Bitrix
*/
public static function GetByValue($PropID, $Value)
{
$PropID = IntVal($PropID);
$db_res = CSaleOrderPropsVariant::GetList($by = "SORT", $order = "ASC", array("ORDER_PROPS_ID" => $PropID, "VALUE" => $Value));
if ($res = $db_res->Fetch()) {
return $res;
}
return False;
}
示例2: GetProfileProps
static function GetProfileProps($profileID, $personID) {
if (!empty($profileID)) {
// получаем значения свойств
$props = array();
$res = CSaleOrderUserPropsValue::GetList(array(), array('USER_PROPS_ID'=>$profileID), false, false, array('ID', 'ORDER_PROPS_ID', 'VALUE'));
while ($arRes = $res->Fetch()) {
$props[$arRes['ORDER_PROPS_ID']] = array('VALUE' => htmlspecialchars($arRes['VALUE']));
}
}
// если не задан $personID
if (empty($personID)) {
$res = CSalePersonType::GetList(Array(), Array());
if ($arRes = $res->Fetch()) {
$personID = $arRes["ID"];
}
}
// получаем свойства
$arProps = array();
$res = CSaleOrderProps::GetList(array("SORT"=>"ASC"), array("PERSON_TYPE_ID" => $personID, "USER_PROPS" => "Y"), false, false, array());
while ($arRes = $res->Fetch()) {
if (in_array($arRes["TYPE"], array("SELECT", "MULTISELECT", "RADIO"))) {
$rs = \CSaleOrderPropsVariant::GetList(array(), array("ORDER_PROPS_ID" => $arRes["ID"]));
while ($arRs = $rs->Fetch()) {
$arRes["variants"][] = $arRs;
}
}
if (!empty($props[$arRes['ID']])) {
$arProps[$arRes['ID']] = array_merge($props[$arRes['ID']], $arRes);
} else {
$arProps[$arRes['ID']] = $arRes;
}
}
return $arProps;
}
示例3: Array
array(
"PERSON_TYPE_ID" => $arUserProps["PERSON_TYPE_ID"],
"PROPS_GROUP_ID" => $arOrderPropsGroup["ID"],
"USER_PROPS" => "Y", "ACTIVE" => "Y", "UTIL" => "N"
),
false,
false,
array("ID", "PERSON_TYPE_ID", "NAME", "TYPE", "REQUIED", "DEFAULT_VALUE", "SORT", "USER_PROPS", "IS_LOCATION", "PROPS_GROUP_ID", "SIZE1", "SIZE2", "DESCRIPTION", "IS_EMAIL", "IS_PROFILE_NAME", "IS_PAYER", "IS_LOCATION4TAX", "CODE", "SORT")
);
while($arOrderProps = $dbOrderProps->GetNext())
{
if ($arOrderProps["REQUIED"]=="Y" || $arOrderProps["IS_EMAIL"]=="Y" || $arOrderProps["IS_PROFILE_NAME"]=="Y" || $arOrderProps["IS_LOCATION"]=="Y" || $arOrderProps["IS_PAYER"]=="Y")
$arOrderProps["REQUIED"] = "Y";
if (in_array($arOrderProps["TYPE"], Array("SELECT", "MULTISELECT", "RADIO")))
{
$dbVars = CSaleOrderPropsVariant::GetList(($by="SORT"), ($order="ASC"), Array("ORDER_PROPS_ID"=>$arOrderProps["ID"]));
while ($vars = $dbVars->GetNext())
$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
{
示例4: elseif
// 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";
$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
}
$arProperties["VARIANTS"][] = $arVariants;
}
}
if ($arProperties["TYPE"] == "CHECKBOX" && strlen($curVal) <= 0 && $arProperties["REQUIED"] != "Y") {
$curVal = "N";
}
if (!empty($curVal) && is_array($curVal) || !is_array($curVal) && (string) $curVal != "") {
$arPropValues[$arProperties["ID"]] = $curVal;
}
if ($arProperties["USER_PROPS"] == "Y") {
示例5: getOrderPropertiesHTML
//.........这里部分代码省略.........
if (isset($_REQUEST["BREAK_SECOND_NAME"]) && strlen($_REQUEST["BREAK_SECOND_NAME"]) > 0)
$BREAK_SECOND_NAME_TMP = htmlspecialcharsbx(trim($_REQUEST["BREAK_SECOND_NAME"]));
$resultHtml .= "<div class=\"fio newo_break_active\"><input onblur=\"if (this.value==''){this.value='".CUtil::JSEscape(GetMessage('NEWO_BREAK_LAST_NAME'))."';BX.addClass(this.parentNode,'newo_break_active');}\" onfocus=\"if (this.value=='".CUtil::JSEscape(GetMessage('NEWO_BREAK_LAST_NAME'))."') {this.value='';BX.removeClass(this.parentNode,'newo_break_active');}\" type=\"text\" name=\"BREAK_LAST_NAME\" id=\"BREAK_LAST_NAME\" size=\"30\" value=\"".$BREAK_LAST_NAME_TMP."\" /></div>";
$resultHtml .= "<div class=\"fio newo_break_active\"><input onblur=\"if (this.value==''){this.value='".CUtil::JSEscape(GetMessage('NEWO_BREAK_NAME'))."';BX.addClass(this.parentNode,'newo_break_active');}\" onfocus=\"if (this.value=='".CUtil::JSEscape(GetMessage('NEWO_BREAK_NAME'))."') {this.value='';BX.removeClass(this.parentNode,'newo_break_active');}\" type=\"text\" name=\"BREAK_NAME\" id=\"BREAK_NAME_BUYER\" size=\"30\" value=\"".$NEWO_BREAK_NAME_TMP."\" /></div>";
$resultHtml .= "<div class=\"fio newo_break_active\"><input onblur=\"if (this.value==''){this.value='".CUtil::JSEscape(GetMessage('NEWO_BREAK_SECOND_NAME'))."';BX.addClass(this.parentNode,'newo_break_active');}\" onfocus=\"if (this.value=='".CUtil::JSEscape(GetMessage('NEWO_BREAK_SECOND_NAME'))."') {this.value='';BX.removeClass(this.parentNode,'newo_break_active');}\" type=\"text\" name=\"BREAK_SECOND_NAME\" id=\"BREAK_SECOND_NAME\" size=\"30\" value=\"".$BREAK_SECOND_NAME_TMP."\" /></div>";
$resultHtml .= '</div>';
$resultHtml .= '<div id="NO_BREAK_NAME"';
if ($ORDER_ID <= 0)
$tmpNone = ' style="display:none"';
if ($formVarsSubmit && $_REQUEST["btnTypeBuyer"] == "btnBuyerExist")
$tmpNone = ' style="display:block"';
$resultHtml .= $tmpNone.'>';
}
$resultHtml .= '<input type="text" maxlength="250" ';
$resultHtml .= 'size="30" ';
$resultHtml .= 'value="'.((isset($curVal)) ? $curVal : $arProperties["DEFAULT_VALUE"]).'" ';
$resultHtml .= 'name="ORDER_PROP_'.$arProperties["ID"].'" ';
$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" '.$change.'>';
if ($arProperties["IS_PAYER"] == "Y" && intval($USER_ID) <= 0)
$resultHtml .= '</div>';
}
elseif ($arProperties["TYPE"] == "SELECT")
{
$size = (intval($arProperties["SIZE1"]) > 0) ? intval($arProperties["SIZE1"]) : 5;
$resultHtml .= '<select name="ORDER_PROP_'.$arProperties["ID"].'" ';
$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" ';
$resultHtml .= 'size='.$size.' ';
$resultHtml .= 'class="typeselect">';
$dbVariants = CSaleOrderPropsVariant::GetList(
array("SORT" => "ASC"),
array("ORDER_PROPS_ID" => $arProperties["ID"]),
false,
false,
array("*")
);
while ($arVariants = $dbVariants->Fetch())
{
$resultHtml .= '<option value="'.htmlspecialcharsex($arVariants["VALUE"]).'"';
if ($arVariants["VALUE"] == $curVal || !isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])
$resultHtml .= " selected";
$resultHtml .= '>'.htmlspecialcharsEx($arVariants["NAME"]).'</option>';
}
$resultHtml .= '</select>';
}
elseif ($arProperties["TYPE"] == "MULTISELECT")
{
$size = (intval($arProperties["SIZE1"]) > 0) ? intval($arProperties["SIZE1"]) : 5;
$resultHtml .= '<select multiple name="ORDER_PROP_'.$arProperties["ID"].'[]" ';
$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" ';
$resultHtml .= 'size='.$size.' ';
$resultHtml .= 'class="typeselect" type="multyselect">';
if (!is_array($curVal))
{
if (strlen($curVal) > 0 OR $ORDER_ID != "")
$curVal = explode(",", $curVal);
else
$curVal = explode(",", $arProperties["DEFAULT_VALUE"]);
$arCurVal = array();
示例6: GetMessage
</td>
<td align="center"><?php
echo GetMessage("SALE_VARIANTS_SORT");
?>
</td>
<td align="center"><?php
echo GetMessage("SALE_VARIANTS_DESCR");
?>
</td>
<td align="center"><?php
echo GetMessage("SALE_VARIANTS_DEL");
?>
</td>
</tr>
<?php
$db_propsVars = CSaleOrderPropsVariant::GetList($b = "SORT", $o = "ASC", array("ORDER_PROPS_ID" => $ID));
$ind = -1;
$oldind = -1;
while ($db_propsVars->ExtractFields("f_")) {
$ind++;
$oldind++;
if ($bInitVars) {
$DB->InitTableVarsForEdit("b_sale_order_props_variant", "", "f_", "_" . $oldind);
}
?>
<tr>
<td>
<input type="hidden" name="ID_<?php
echo $ind;
?>
" value="<?php
示例7: DoProcessOrder
static function DoProcessOrder(&$arOrder, $arOrderPropsValues, &$arErrors, &$arWarnings)
{
if (!is_array($arOrderPropsValues)) {
$arOrderPropsValues = array();
}
$arUser = null;
$dbOrderProps = CSaleOrderProps::GetList(array("SORT" => "ASC"), array("PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "ACTIVE" => "Y"), 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);
}
$curVal = intval($curVal);
$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")) {
$curVal = intval($curVal);
if ($arOrderProp["IS_LOCATION"] == "Y") {
$arOrder["DELIVERY_LOCATION"] = $curVal;
}
if ($arOrderProp["IS_LOCATION4TAX"] == "Y") {
$arOrder["TAX_LOCATION"] = $curVal;
}
if ($curVal <= 0) {
$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;
}
if ($arOrderProp["IS_EMAIL"] == "Y") {
$arOrder["USER_EMAIL"] = $curVal;
if (!check_email($curVal)) {
$arWarnings[] = array("CODE" => "PARAM", "TEXT" => str_replace(array("#EMAIL#", "#NAME#"), array(htmlspecialcharsbx($curVal), htmlspecialcharsbx($arOrderProp["NAME"])), GetMessage("SALE_GOPE_WRONG_EMAIL")));
}
}
if (strlen($curVal) <= 0) {
$bErrorField = true;
}
} elseif ($arOrderProp["REQUIED"] == "Y") {
if ($arOrderProp["TYPE"] == "TEXT" || $arOrderProp["TYPE"] == "TEXTAREA" || $arOrderProp["TYPE"] == "RADIO" || $arOrderProp["TYPE"] == "SELECT" || $arOrderProp["TYPE"] == "CHECKBOX") {
if (strlen($curVal) <= 0) {
$bErrorField = true;
}
} elseif ($arOrderProp["TYPE"] == "LOCATION") {
if (intval($curVal) <= 0) {
$bErrorField = true;
}
} elseif ($arOrderProp["TYPE"] == "MULTISELECT") {
//.........这里部分代码省略.........
示例8: 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()) {
//.........这里部分代码省略.........
示例9: getOrderPropFormated
function getOrderPropFormated($arProperties, $arResult, &$arUserResult, &$arDeleteFieldLocation = array())
{
global $USER;
$isProfileChanged = ($arUserResult["PROFILE_CHANGE"] == "Y");
$isEmptyUserResult = (empty($arUserResult["ORDER_PROP"]));
$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);
if ($isProfileChanged || $isEmptyUserResult)
{
$arUserResult["ORDER_PROP"][$arProperties["ID"]] = (isset($arProperties["CHECKED"]) && $arProperties["CHECKED"] == "Y" ? 'Y' : "N");
}
}
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")
//.........这里部分代码省略.........
示例10: 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;
//.........这里部分代码省略.........
示例11: unset
// input settings
$inputSettings = Input\Manager::getSettings($property, $reload);
if (isset($resetInputSettings)) {
unset($property['DEFAULT_VALUE'], $property['SETTINGS']);
$property = array_diff_key($property, $inputSettings);
if ($propertyId && $existentProperty && $property['TYPE'] == $existentProperty['TYPE']) {
$property['MULTIPLE'] = $existentProperty['MULTIPLE'];
$property['DEFAULT_VALUE'] = $existentProperty['DEFAULT_VALUE'];
$property += $existentProperty['SETTINGS'];
}
}
// load property metadata
switch ($property['TYPE']) {
case 'ENUM':
if (!$variants) {
$result = CSaleOrderPropsVariant::GetList($b = 'SORT', $o = 'ASC', array('ORDER_PROPS_ID' => $propertyId));
while ($row = $result->Fetch()) {
$variants[] = $row;
}
}
break;
case 'FILE':
$property['DEFAULT_VALUE'] = Input\File::loadInfo($property['DEFAULT_VALUE']);
break;
}
// variant settings
$variantSettings = array('VALUE' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('SALE_VARIANTS_CODE'), 'SIZE' => '5', 'MAXLENGTH' => 255, 'REQUIRED' => 'Y'), 'NAME' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('SALE_VARIANTS_NAME'), 'SIZE' => '20', 'MAXLENGTH' => 255, 'REQUIRED' => 'Y'), 'SORT' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('SALE_VARIANTS_SORT'), 'MIN' => 0, 'STEP' => 1, 'VALUE' => 100), 'DESCRIPTION' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('SALE_VARIANTS_DESCR'), 'SIZE' => '30', 'MAXLENGTH' => 255), 'ID' => array('TYPE' => 'NUMBER', 'MIN' => 0, 'STEP' => 1, 'HIDDEN' => 'Y'));
// common settings
$groupOptions = array();
$result = \CSaleOrderPropsGroup::GetList($b = "NAME", $o = "ASC", array('PERSON_TYPE_ID' => $personTypeId));
while ($row = $result->Fetch()) {
示例12: elseif
?>
</option><?php
}
?>
</select>
<?php
} elseif ($value["TYPE"] == "RADIO") {
?>
<input type="radio" name="filter_prop_<?php
echo $key;
?>
" value=""><?php
echo GetMessage("SALE_F_ALL");
?>
<br /><?php
$db_vars = CSaleOrderPropsVariant::GetList($by = "SORT", $order = "ASC", array("ORDER_PROPS_ID" => $value["ID"]));
while ($vars = $db_vars->Fetch()) {
?>
<input type="radio" name="filter_prop_<?php
echo $key;
?>
" value="<?php
echo $vars["VALUE"];
?>
"<?php
if ($vars["VALUE"] == $curVal) {
echo " checked";
}
?>
><?php
echo htmlspecialcharsbx($vars["NAME"]);
示例13: 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());
//.........这里部分代码省略.........