当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleOrderUserProps::Add方法代码示例

本文整理汇总了PHP中CSaleOrderUserProps::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderUserProps::Add方法的具体用法?PHP CSaleOrderUserProps::Add怎么用?PHP CSaleOrderUserProps::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleOrderUserProps的用法示例。


在下文中一共展示了CSaleOrderUserProps::Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DoSaveUserProfile

 static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors)
 {
     $profileId = intval($profileId);
     $arIDs = array();
     if ($profileId > 0) {
         $dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID"));
         $arProfile = $dbProfile->Fetch();
         if (!$arProfile) {
             $arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND'));
             return false;
         }
         if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) {
             $arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR'));
             return false;
         }
         //if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"])
         if (strlen($profileName) > 0) {
             $arFields = array("NAME" => $profileName, "USER_ID" => $userId);
             CSaleOrderUserProps::Update($profileId, $arFields);
         }
         $dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID"));
         while ($arUserPropsValue = $dbUserPropsValues->Fetch()) {
             $arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"];
         }
     }
     if (!is_array($orderProps)) {
         $dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE"));
         $orderProps = array();
         while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) {
             $orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"];
         }
     }
     $dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "UTIL" => "N", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE"));
     while ($arOrderProperty = $dbOrderProperties->Fetch()) {
         $curVal = $orderProps[$arOrderProperty["ID"]];
         if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
             $curVal = implode(",", $curVal);
         }
         if (strlen($curVal) > 0) {
             if ($profileId <= 0) {
                 if (strlen($profileName) <= 0) {
                     $profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d");
                 }
                 $arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId);
                 $profileId = CSaleOrderUserProps::Add($arFields);
             }
             if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
                 $arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
                 CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
                 unset($arIDs[$arOrderProperty["ID"]]);
             } else {
                 $arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
                 CSaleOrderUserPropsValue::Add($arFields);
             }
         }
     }
     foreach ($arIDs as $id) {
         CSaleOrderUserPropsValue::Delete($id);
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:60,代码来源:order_user_props.php

示例2: OnBeforeUserRegisterHandler

    function OnBeforeUserRegisterHandler(&$arFields)
    {
      CModule::IncludeModule('sale');
      //создаём профиль
      //PERSON_TYPE_ID - идентификатор типа плательщика, для которого создаётся профиль
      $arProfileFields = array(
         "NAME" => "Профиль покупателя (".$arFields['LOGIN'].')',
         "USER_ID" => $arFields['ID'],
         "PERSON_TYPE_ID" => 1
      );
      /**
       * Добавляем счет пользователя
       * @var array
       */
      $arFields = array(
        "USER_ID" => $arFields['ID'], 
        "CURRENCY" => "RUB", 
        "CURRENT_BUDGET" => 0
      );
      $accountID = CSaleUserAccount::Add($arFields);

      $PROFILE_ID = CSaleOrderUserProps::Add($arProfileFields);
      //если профиль создан
      if ($PROFILE_ID) {
         //формируем массив свойств
         $PROPS = array(
         array(
               "USER_PROPS_ID" => $PROFILE_ID,
               "ORDER_PROPS_ID" => 2,
               "NAME" => "Адрес доставки",
               "VALUE" => $arFields['PERSONAL_STREET']
            ),
         array(
               "USER_PROPS_ID" => $PROFILE_ID,
               "ORDER_PROPS_ID" => 1,
               "NAME" => "Ф.И.О.",
               "VALUE" => $arFields['LAST_NAME'].' '.$arFields['NAME'].' '.$arFields['SECOND_NAME']
            )
         );
         //добавляем значения свойств к созданному ранее профилю
         foreach ($PROPS as $prop) {
            CSaleOrderUserPropsValue::Add($prop);
         }
      }
    }
开发者ID:ASDAFF,项目名称:mp,代码行数:45,代码来源:events.php

示例3: Add

    static function Add($arFields) {
        $result = new WS_SaleUserProfilesErrorsContainer();
        $fields = array(
            "NAME"              => $arFields["NAME"],
            "PERSON_TYPE_ID"    => $arFields["PERSON_TYPE_ID"],
            "USER_ID"           => $arFields["USER_ID"],
            "DATE_UPDATE"       => $arFields["DATE_UPDATE"]
        );
        if (empty($fields["USER_ID"])) {
            $result->addErrorString(GetMessage("ws.saleuserprofiles_save_error_required_field") . "\"код пользователя, которому принадлежит профиль\"");
        }

        // сохраняем поля
        if (!$result->getErrorsAsString() && !empty($arFields)) {
            $id = CSaleOrderUserProps::Add($arFields);

            if ($id) {
                return $id;
            }
        }
        return $result;
    }
开发者ID:ASDAFF,项目名称:mp,代码行数:22,代码来源:profilesManager.php

示例4: nodeHandler

	function nodeHandler(CDataXML $value)
	{
		$value = $value->GetArray();

		if(!empty($value[GetMessage("CC_BSC1_DOCUMENT")]))
		{
			$value = $value[GetMessage("CC_BSC1_DOCUMENT")];

			$arOrder = $this->collectOrderInfo($value);

			if(!empty($arOrder))
			{
				if(strlen($arOrder["ID"]) <= 0 && strlen($arOrder["ID_1C"]) > 0)//try to search order from 1C
				{
					$dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID_1C" => $arOrder["ID_1C"]), false, false, array("ID", "ID_1C"));
					if($orderInfo = $dbOrder->Fetch())
					{
						$arOrder["ID"] = $orderInfo["ID"];
					}
				}
				if(strlen($arOrder["ID"]) > 0) // exists site order
				{
					$dbOrder = CSaleOrder::GetList(array(), array("ACCOUNT_NUMBER" => $arOrder["ID"]), false, false, array("ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "CANCELED", "DATE_CANCELED", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION", "ADDITIONAL_INFO", "COMMENTS", "TAX_VALUE", "DELIVERY_DOC_NUM", "DELIVERY_DOC_DATE", "STORE_ID", "ACCOUNT_NUMBER", "VERSION", "VERSION_1C", "ID_1C"));
					if($orderInfo = $dbOrder->Fetch())
					{
						if($arOrder["VERSION_1C"] != $orderInfo["VERSION_1C"] || (strlen($orderInfo["VERSION_1C"]) <= 0 || strlen($arOrder["VERSION_1C"]) <= 0)) // skip update if the same version
						{
							$arOrderFields = array();
							$orderId = $orderInfo["ID"];
							CSaleOrderChange::AddRecord($orderId, "ORDER_1C_IMPORT");
							if($arOrder["ID_1C"] != $orderInfo["ID_1C"])
								$arOrderFields["ID_1C"] = $arOrder["ID_1C"];
							$arOrderFields["VERSION_1C"] = $arOrder["VERSION_1C"];

							if($orderInfo["PAYED"] != "Y" && $orderInfo["ALLOW_DELIVERY"] != "Y" && $orderInfo["STATUS_ID"] != "F")
							{
								$dbOrderTax = CSaleOrderTax::GetList(
									array(),
									array("ORDER_ID" => $orderId),
									false,
									false,
									array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE")
								);
								$bTaxFound = false;
								if($arOrderTax = $dbOrderTax->Fetch())
								{
									$bTaxFound = true;
									if(IntVal($arOrderTax["VALUE_MONEY"]) != IntVal($arOrder["TAX"]["VALUE_MONEY"]) || IntVal($arOrderTax["VALUE"]) != IntVal($arOrder["TAX"]["VALUE"]) || ($arOrderTax["IS_IN_PRICE"] != $arOrder["TAX"]["IS_IN_PRICE"]))
									{
										if(IntVal($arOrder["TAX"]["VALUE"])>0)
										{
											$arFields = Array(
												"TAX_NAME" => $arOrder["TAX"]["NAME"],
												"ORDER_ID" => $orderId,
												"VALUE" => $arOrder["TAX"]["VALUE"],
												"IS_PERCENT" => "Y",
												"IS_IN_PRICE" => $arOrder["TAX"]["IS_IN_PRICE"],
												"VALUE_MONEY" => $arOrder["TAX"]["VALUE_MONEY"],
												"CODE" => "VAT1C",
												"APPLY_ORDER" => "100"
											);
											CSaleOrderTax::Update($arOrderTax["ID"], $arFields);
											$arOrderFields["TAX_VALUE"] = $arOrder["TAX"]["VALUE_MONEY"];
										}
										else
										{
											CSaleOrderTax::Delete($arOrderTax["ID"]);
											$arOrderFields["TAX_VALUE"] = 0;
										}
									}
								}

								if(!$bTaxFound)
								{
									if(IntVal($arOrder["TAX"]["VALUE"])>0)
									{
										$arFields = Array(
											"TAX_NAME" => $arOrder["TAX"]["NAME"],
											"ORDER_ID" => $orderId,
											"VALUE" => $arOrder["TAX"]["VALUE"],
											"IS_PERCENT" => "Y",
											"IS_IN_PRICE" => $arOrder["TAX"]["IS_IN_PRICE"],
											"VALUE_MONEY" => $arOrder["TAX"]["VALUE_MONEY"]
										);
										CSaleOrderTax::Add($arFields);
										$arOrderFields["TAX_VALUE"] = $arOrder["TAX"]["VALUE_MONEY"];
									}
								}

								$arShoppingCart = array();
								$bNeedUpdate = false;
								$dbBasket = CSaleBasket::GetList(
									array("NAME" => "ASC"),
									array("ORDER_ID" => $orderId),
									false,
									false,
									array(
										"ID",
										"QUANTITY",
										"CANCEL_CALLBACK_FUNC",
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:order_loader.php

示例5: GetMessage

									"CODE" => $arOrderProperties["CODE"],
									"VALUE" => $curVal
								);
							CSaleOrderPropsValue::Add($arFields);

							if ( $arOrderProperties["USER_PROPS"] == "Y" && IntVal($arUserResult["PROFILE_ID"])<=0 && IntVal($arUserResult["PROFILE_ID_new"])<=0)
							{
								if (strlen($arUserResult["PROFILE_NAME"]) <= 0)
									$arUserResult["PROFILE_NAME"] = GetMessage("SOA_PROFILE")." ".Date("Y-m-d");

								$arFields = array(
										"NAME" => $arUserResult["PROFILE_NAME"],
										"USER_ID" => IntVal($USER->GetID()),
										"PERSON_TYPE_ID" => $arUserResult["PERSON_TYPE_ID"]
									);
								$arUserResult["PROFILE_ID_new"] = CSaleOrderUserProps::Add($arFields);
								$arUserResult["PROFILE_ID_new"] = IntVal($arUserResult["PROFILE_ID_new"]);
							}

							if ($arOrderProperties["USER_PROPS"] == "Y" && IntVal($arUserResult["PROFILE_ID_new"]) > 0)
							{
								$arFields = array(
										"USER_PROPS_ID" => $arUserResult["PROFILE_ID_new"],
										"ORDER_PROPS_ID" => $arOrderProperties["ID"],
										"NAME" => $arOrderProperties["NAME"],
										"VALUE" => $curVal
									);
								CSaleOrderUserPropsValue::Add($arFields);
							}

							if ($arOrderProperties["USER_PROPS"] == "Y" && IntVal($arUserResult["PROFILE_ID"]) > 0)
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:component.php

示例6: DoSaveUserProfile

 static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors)
 {
     $profileId = intval($profileId);
     $arIDs = array();
     if ($profileId > 0) {
         $dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID"));
         $arProfile = $dbProfile->Fetch();
         if (!$arProfile) {
             $arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND'));
             return false;
         }
         if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) {
             $arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR'));
             return false;
         }
         //if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"])
         if (strlen($profileName) > 0) {
             $arFields = array("NAME" => $profileName, "USER_ID" => $userId);
             CSaleOrderUserProps::Update($profileId, $arFields);
         }
         $dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID"));
         while ($arUserPropsValue = $dbUserPropsValues->Fetch()) {
             $arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"];
         }
     }
     if (!is_array($orderProps)) {
         $dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE"));
         $orderProps = array();
         while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) {
             $orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"];
         }
     }
     /*
     TRANSLATION_CUT_OFF
     else
     {
     	// map location ID to CODE, if taken from parameters
     	static::TranslateLocationPropertyValues($personTypeId, $orderProps);
     }
     */
     $utilPropertyList = array();
     $dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE", "UTIL"));
     while ($arOrderProperty = $dbOrderProperties->Fetch()) {
         if ($arOrderProperty['UTIL'] == "Y") {
             $utilPropertyList[] = $arIDs[$arOrderProperty["ID"]];
             continue;
         }
         $curVal = $orderProps[$arOrderProperty["ID"]];
         if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
             $curVal = implode(",", $curVal);
         }
         if ($arOrderProperty["TYPE"] == "FILE" && is_array($curVal)) {
             $fileList = array();
             foreach ($curVal as $fileDat) {
                 $fileList[] = $fileDat['ID'];
             }
             $curVal = serialize($fileList);
         }
         if (strlen($curVal) > 0) {
             if ($profileId <= 0) {
                 if (strlen($profileName) <= 0) {
                     $profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d");
                 }
                 $arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId);
                 $profileId = CSaleOrderUserProps::Add($arFields);
             }
             if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
                 $arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
                 CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
                 unset($arIDs[$arOrderProperty["ID"]]);
             } else {
                 $arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
                 CSaleOrderUserPropsValue::Add($arFields);
             }
         }
     }
     foreach ($arIDs as $id) {
         if (!empty($utilPropertyList) && in_array($id, $utilPropertyList)) {
             continue;
         }
         CSaleOrderUserPropsValue::Delete($id);
     }
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:83,代码来源:order_user_props.php

示例7: array

        CSaleOrderUserPropsValue::Update($_REQUEST["phone_id"], array("VALUE" => $_REQUEST["phone"]));
    }
    if (!empty($_REQUEST["phone"])) {
        CSaleOrderUserPropsValue::Update($_REQUEST["phone_id"], array("VALUE" => $_REQUEST["phone"]));
    }
    if (!empty($_REQUEST["adres"])) {
        CSaleOrderUserPropsValue::Update($_REQUEST["adres_id"], array("VALUE" => $_REQUEST["adres"]));
    }
    if (!empty($_REQUEST["city"])) {
        CSaleOrderUserPropsValue::Update($_REQUEST["city_id"], array("VALUE" => $_REQUEST["city"]));
    }
}
if ($_REQUEST["action"] == "add") {
    $profileName = trim($_REQUEST["f_name"] . " " . $_REQUEST["name"] . " " . $_REQUEST["last_name"]);
    $arFields = array("NAME" => $profileName, "USER_ID" => $USER->GetID(), "PERSON_TYPE_ID" => 1);
    $USER_PROPS_ID = CSaleOrderUserProps::Add($arFields);
    if ($USER_PROPS_ID) {
        $db_props = CSaleOrderProps::GetList(array(), array("CODE" => 'FIO'), false, false, array());
        if ($props = $db_props->Fetch()) {
            $prop_id = $props['ID'];
        }
        $arFields = array("USER_PROPS_ID" => $USER_PROPS_ID, "ORDER_PROPS_ID" => $prop_id, "NAME" => GetMessage('NAME1'), "VALUE" => $_REQUEST["name"] . ' ' . $_REQUEST["last_name"] . ' ' . $_REQUEST["f_name"]);
        CSaleOrderUserPropsValue::Add($arFields);
        $db_props = CSaleOrderProps::GetList(array(), array("CODE" => 'EMAIL'), false, false, array());
        if ($props = $db_props->Fetch()) {
            $prop_id = $props['ID'];
        }
        $arFields = array("USER_PROPS_ID" => $USER_PROPS_ID, "ORDER_PROPS_ID" => $prop_id, "NAME" => GetMessage('EMAIL1'), "VALUE" => $_REQUEST["email"]);
        CSaleOrderUserPropsValue::Add($arFields);
        $db_props = CSaleOrderProps::GetList(array(), array("CODE" => 'PHONE'), false, false, array());
        if ($props = $db_props->Fetch()) {
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:result_modifier.php


注:本文中的CSaleOrderUserProps::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。