本文整理汇总了PHP中CSaleOrderPropsVariant类的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderPropsVariant类的具体用法?PHP CSaleOrderPropsVariant怎么用?PHP CSaleOrderPropsVariant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSaleOrderPropsVariant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
if (!CSaleOrderPropsVariant::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_sale_order_props_variant", $arFields);
$strSql = "UPDATE b_sale_order_props_variant SET " . $strUpdate . " WHERE ID = " . $ID . "";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
return $ID;
}
示例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
$propCityId = $id;
}
if(strlen($prop["CODE"]) > 0)
{
//$arGeneralInfo["propCode"][$prop["CODE"]] = $prop["CODE"];
$arGeneralInfo["propCodeID"][$prop["CODE"]] = $id;
$arGeneralInfo["properies"][$prop["PERSON_TYPE_ID"]][$prop["CODE"]] = $prop;
$arGeneralInfo["properies"][$prop["PERSON_TYPE_ID"]][$prop["CODE"]]["ID"] = $id;
}
if(!empty($variants))
{
foreach($variants as $val)
{
$val["ORDER_PROPS_ID"] = $id;
CSaleOrderPropsVariant::Add($val);
}
}
}
/*
$propReplace = "";
foreach($arGeneralInfo["properies"] as $key => $val)
{
if(IntVal($val["LOCATION"]["ID"]) > 0)
$propReplace .= '"PROP_'.$key.'" => Array(0 => "'.$val["LOCATION"]["ID"].'"), ';
}
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH."personal/order/", Array("PROPS" => $propReplace));
*/
//1C export
if($personType["fiz"] == "Y" && !$fizExist)
{
示例4: 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
示例5: GetRealValue
function GetRealValue($propertyID, $propertyCode, $propertyType, $value, $lang = false)
{
$propertyID = IntVal($propertyID);
$propertyCode = Trim($propertyCode);
$propertyType = Trim($propertyType);
if ($lang === false) {
$lang = LANGUAGE_ID;
}
$arResult = array();
$curKey = strlen($propertyCode) > 0 ? $propertyCode : $propertyID;
if ($propertyType == "SELECT" || $propertyType == "RADIO") {
$arValue = CSaleOrderPropsVariant::GetByValue($propertyID, $value);
$arResult[$curKey] = $arValue["NAME"];
} elseif ($propertyType == "MULTISELECT") {
$curValue = "";
if (!is_array($value)) {
$value = explode(",", $value);
}
for ($i = 0; $i < count($value); $i++) {
if ($arValue1 = CSaleOrderPropsVariant::GetByValue($propertyID, $value[$i])) {
if ($i > 0) {
$curValue .= ",";
}
$curValue .= $arValue1["NAME"];
}
}
$arResult[$curKey] = $curValue;
} elseif ($propertyType == "LOCATION") {
$arValue = CSaleLocation::GetByID($value, $lang);
$curValue = $arValue["COUNTRY_NAME"] . (strlen($arValue["COUNTRY_NAME"]) <= 0 || strlen($arValue["CITY_NAME"]) <= 0 ? "" : " - ") . $arValue["CITY_NAME"];
$arResult[$curKey] = $curValue;
$arResult[$curKey . "_COUNTRY"] = $arValue["COUNTRY_NAME"];
$arResult[$curKey . "_CITY"] = $arValue["CITY_NAME"];
} else {
$arResult[$curKey] = $value;
}
return $arResult;
}
示例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: 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
{
示例8: 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();
示例9: GetRealValue
function GetRealValue($propertyID, $propertyCode, $propertyType, $value, $lang = false)
{
$propertyID = IntVal($propertyID);
$propertyCode = Trim($propertyCode);
$propertyType = Trim($propertyType);
if ($lang === false) {
$lang = LANGUAGE_ID;
}
$arResult = array();
$curKey = strlen($propertyCode) > 0 ? $propertyCode : $propertyID;
if ($propertyType == "SELECT" || $propertyType == "RADIO") {
$arValue = CSaleOrderPropsVariant::GetByValue($propertyID, $value);
$arResult[$curKey] = $arValue["NAME"];
} elseif ($propertyType == "MULTISELECT") {
$curValue = "";
if (!is_array($value)) {
$value = explode(",", $value);
}
for ($i = 0, $max = count($value); $i < $max; $i++) {
if ($arValue1 = CSaleOrderPropsVariant::GetByValue($propertyID, $value[$i])) {
if ($i > 0) {
$curValue .= ",";
}
$curValue .= $arValue1["NAME"];
}
}
$arResult[$curKey] = $curValue;
} elseif ($propertyType == "LOCATION") {
if (CSaleLocation::isLocationProMigrated()) {
$curValue = '';
if (strlen($value)) {
$arValue = array();
if (intval($value)) {
try {
$locationStreetPropertyValue = '';
$res = \Bitrix\Sale\Location\LocationTable::getPathToNode($value, array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)));
$types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached();
$path = array();
while ($item = $res->fetch()) {
// copy street to STREET property
if ($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') {
$arResult[$curKey . "_STREET"] = $item['LNAME'];
}
if ($types['ID2CODE'][$item['TYPE_ID']] == 'COUNTRY') {
$arValue["COUNTRY_NAME"] = $item['LNAME'];
}
if ($types['ID2CODE'][$item['TYPE_ID']] == 'REGION') {
$arValue["REGION_NAME"] = $item['LNAME'];
}
if ($types['ID2CODE'][$item['TYPE_ID']] == 'CITY') {
$arValue["CITY_NAME"] = $item['LNAME'];
}
if ($types['ID2CODE'][$item['TYPE_ID']] == 'VILLAGE') {
$arResult[$curKey . "_VILLAGE"] = $item['LNAME'];
}
$path[] = $item['LNAME'];
}
$curValue = implode(' - ', $path);
} catch (\Bitrix\Main\SystemException $e) {
}
}
}
} else {
$arValue = CSaleLocation::GetByID($value, $lang);
$curValue = $arValue["COUNTRY_NAME"] . (strlen($arValue["COUNTRY_NAME"]) <= 0 || strlen($arValue["REGION_NAME"]) <= 0 ? "" : " - ") . $arValue["REGION_NAME"] . (strlen($arValue["COUNTRY_NAME"]) <= 0 || strlen($arValue["CITY_NAME"]) <= 0 ? "" : " - ") . $arValue["CITY_NAME"];
}
$arResult[$curKey] = $curValue;
$arResult[$curKey . "_COUNTRY"] = $arValue["COUNTRY_NAME"];
$arResult[$curKey . "_REGION"] = $arValue["REGION_NAME"];
$arResult[$curKey . "_CITY"] = $arValue["CITY_NAME"];
} else {
$arResult[$curKey] = $value;
}
return $arResult;
}
示例10: unset
unset($row['ID']);
if (!CSaleOrderPropsVariant::Update($variantId, $row)) {
$errors[] = Loc::getMessage('ERROR_EDIT_VARIANT') . " {$index}";
}
} else {
$row['ORDER_PROPS_ID'] = $propertyId;
if ($variantId = CSaleOrderPropsVariant::Add($row)) {
$variants[$key]['ID'] = $variantId;
} else {
$errors[] = Loc::getMessage('ERROR_ADD_VARIANT') . " {$index}";
}
}
}
}
} elseif ($existentProperty && $existentProperty['TYPE'] == 'ENUM') {
CSaleOrderPropsVariant::DeleteAll($propertyId);
}
// save property relations
foreach ($relationsSettings as $name => $input) {
CSaleOrderProps::UpdateOrderPropsRelations($propertyId, $relations[$name], $name);
}
}
if ($_POST['save'] && !$errors) {
LocalRedirect("sale_order_props.php?lang=" . LANG . GetFilterParams("filter_", false));
}
if ($_POST['apply'] && !$errors) {
LocalRedirect("sale_order_props_edit.php?lang=" . LANG . "&ID=" . $propertyId . GetFilterParams("filter_", false));
}
}
}
// RENDER VIEW /////////////////////////////////////////////////////////////////////////////////////////////////////////
示例11: getSaleProperties
/**
* @param \Bitrix\Sale\Order $order
* @param $arOrder
* @param $agentParams
* @param $bExportFromCrm
* @param $bCrmModuleIncluded
* @param $paySystems
* @param $delivery
* @param array $options
*
* @return array|void
*/
function getSaleProperties(Bitrix\Sale\Order $order, $arOrder, $agentParams, $bExportFromCrm, $bCrmModuleIncluded, $paySystems, $delivery, array $options = array())
{
$providersInstance = self::getProvidersInstanceByOrder($order);
$personTypeId = $order->getPersonTypeId();
$personTypes = BusinessValue::getPersonTypes();
if (!($personType = $personTypes[$personTypeId])) {
self::logError($order->getId(), 'Undefined DOMAIN for person type id "' . $personTypeId . '"');
return;
}
$systemCodes1C = array_flip(self::$systemCodes[$personType['DOMAIN']]);
$arProp = array();
$arProp["ORDER"] = $arOrder;
if (IntVal($arOrder["USER_ID"]) > 0) {
$dbUser = CUser::GetByID($arOrder["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
$arProp["USER"] = $arUser;
}
}
if ($bExportFromCrm) {
$arProp["CRM"] = array();
$companyID = isset($arOrder["UF_COMPANY_ID"]) ? intval($arOrder["UF_COMPANY_ID"]) : 0;
$contactID = isset($arOrder["UF_CONTACT_ID"]) ? intval($arOrder["UF_CONTACT_ID"]) : 0;
if ($companyID > 0) {
$arProp["CRM"]["CLIENT_ID"] = "CRMCO" . $companyID;
} else {
$arProp["CRM"]["CLIENT_ID"] = "CRMC" . $contactID;
}
$clientInfo = array("LOGIN" => "", "NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "");
if ($bCrmModuleIncluded) {
if ($companyID > 0) {
$arCompanyFilter = array('=ID' => $companyID);
$dbCompany = CCrmCompany::GetListEx(array(), $arCompanyFilter, false, array("nTopCount" => 1), array("TITLE"));
$arCompany = $dbCompany->Fetch();
unset($dbCompany, $arCompanyFilter);
if (is_array($arCompany)) {
if (isset($arCompany["TITLE"])) {
$clientInfo["NAME"] = $arCompany["TITLE"];
}
}
unset($arCompany);
} else {
if ($contactID > 0) {
$arContactFilter = array('=ID' => $contactID);
$dbContact = CCrmContact::GetListEx(array(), $arContactFilter, false, array("nTopCount" => 1), array("NAME", "LAST_NAME", "SECOND_NAME"));
$arContact = $dbContact->Fetch();
unset($dbContact, $arContactFilter);
if (is_array($arContact)) {
if (isset($arContact["NAME"])) {
$clientInfo["NAME"] = $arContact["NAME"];
}
if (isset($arContact["LAST_NAME"])) {
$clientInfo["LAST_NAME"] = $arContact["LAST_NAME"];
}
if (isset($arContact["SECOND_NAME"])) {
$clientInfo["SECOND_NAME"] = $arContact["SECOND_NAME"];
}
}
unset($arContact);
}
}
}
$arProp["CRM"]["CLIENT"] = $clientInfo;
unset($clientInfo);
}
if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0) {
$arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
}
if (strlen($arOrder["DELIVERY_ID"]) > 0) {
$arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];
}
$dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE"));
$locationStreetPropertyValue = '';
while ($arOrderPropVals = $dbOrderPropVals->Fetch()) {
if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX") {
if ($arOrderPropVals["VALUE"] == "Y") {
$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
} else {
$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
}
} elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA") {
$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
} elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO") {
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
} elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT") {
$curVal = explode(",", $arOrderPropVals["VALUE"]);
foreach ($curVal as $vm) {
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
//.........这里部分代码省略.........
示例12: Add
function Add($arFields)
{
global $DB;
if (!CSaleOrderPropsVariant::CheckFields("ADD", $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_sale_order_props_variant", $arFields);
$strSql = "INSERT INTO b_sale_order_props_variant(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
return $ID;
}
示例13: 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"]);
示例14: getOrderPropFormated
//.........这里部分代码省略.........
$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"];
if ($isProfileChanged || $isEmptyUserResult)
{
$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $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())
{
if ($flagDefault == "N" && $nameProperty == "")
{
$nameProperty = $arVariants["NAME"];
}
if (($arVariants["VALUE"] == $curVal) || ((!isset($curVal) || $curVal == "") && ($arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])))
{
$arVariants["SELECTED"] = "Y";
$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
$flagDefault = "Y";
if ($isProfileChanged || $isEmptyUserResult)
{
$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arVariants["NAME"];
}
}
$arProperties["VARIANTS"][] = $arVariants;
}
if ($flagDefault == "N")
{
$arProperties["VARIANTS"][0]["SELECTED"]= "Y";
$arProperties["VARIANTS"][0]["VALUE_FORMATED"] = $nameProperty;
示例15: nl2br
echo '<a href="mailto:'.htmlspecialcharsbx($arOrderProps["VALUE"]).'">'.htmlspecialcharsEx($arOrderProps["VALUE"]).'</a>';
else
echo nl2br(htmlspecialcharsbx(trim($arOrderProps["VALUE"])));
}
elseif ($arOrderProps["TYPE"] == "SELECT" || $arOrderProps["TYPE"] == "RADIO")
{
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $arOrderProps["VALUE"]);
echo htmlspecialcharsEx($arVal["NAME"]);
}
elseif ($arOrderProps["TYPE"] == "MULTISELECT")
{
$curVal = explode(",", $arOrderProps["VALUE"]);
$countCurVal = count($curVal);
for ($i = 0; $i < $countCurVal; $i++)
{
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
if ($i > 0)
echo ", ";
echo htmlspecialcharsEx($arVal["NAME"]);
}
}
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'];