Ejemplo n.º 1
0
    public static function UserCreate($name, $phone, $domen, $login, $group) //$name - string, $phone - string, $domen - string, $login - string, $group - array
    {

        if (CUser::IsAuthorized()) {
            $userId = CUser::GetID();
            return (int)$userId;
        } else {
            $usersCheck = CUser::GetByLogin($login);
            if ($arUser = $usersCheck->Fetch()) {
                return (int)$arUser["ID"];
            } else {
            	$stringPhone = preg_replace('~\D~','',$phone);
                $password = OrderClick::GeneratePassword(10);
                $user = new CUser;
                $arFields = Array(
                    "NAME" => $name,
                    "EMAIL" => $stringPhone . "@" . $domen,
                    "LOGIN" => $phone,
                    "ACTIVE" => "N", // Делаю пользователя не активным
                    "GROUP_ID" => $group,
                    "PASSWORD" => $password,
                    "CONFIRM_PASSWORD" => $password,
                    "PERSONAL_PHONE" => $stringPhone,
                );
                return $user->Add($arFields);
            }
        }

    }
Ejemplo n.º 2
0
        $buyer = OrderClick::UserCreate(
            $arResult["INTERFACE"][$arParams["NAME_USER_FILDS"]]["VALUE"], // NAME USER
            $arResult["INTERFACE"][$arParams["PHONE_USER_FILDS"]]["VALUE"], // PHONE USER
            $arParams["DOMAIN_USER_MAIL"], // DOMAIN EMAIL
            $arResult["INTERFACE"][$arParams["LOGIN_USER_FILDS"]]["VALUE"], // LOGIN USER
            $arParams["USER_GROUP"] // GROUP USER
        );
    }

    $currency = CCurrency::GetBaseCurrency();

    $arResult["ORDER_ID"] = OrderClick::AddProduct(
        $arResult["ELEMENT"], // Product ID
        $arResult["QUANTITY"], //QUANTITY
        array(), //arRewriteFields array()*
        false,
        $buyer, // BUYER
        $currency, //CURRENCY
        $arParams["PERSON_TYPE"], //PERSON TYPE
        $arParams["CLEAR_CART"]
    );
}

$ajaxId = new CComponentAjax($this->getName(), $this->getTemplateName(), $arParams, null);
$arResult["AJAX_ID"] = $ajaxId->componentID;


$this->includeComponentTemplate();

?>