1
0
mirror of synced 2024-11-28 16:26:07 +03:00

ref #91040 Добавить возможность создания клиентов с признаком "Подписан" (#303)

This commit is contained in:
Kocmonavtik 2023-08-22 13:09:20 +03:00 committed by GitHub
parent 9b3bfaf3ff
commit 25b4a17e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 2064 additions and 117 deletions

View File

@ -1,3 +1,6 @@
## 2023-08-22 v.6.4.0
- Добавлена функция подписки на рекламно-информационные рассылки
## 2023-07-25 v.6.3.20
- Исправлена ошибка некорректного вывода информации о программе лояльности в личном кабинете клиента

View File

@ -200,6 +200,15 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
if (isset($this->dataCrm['address'])) {
$this->buildAddress();
}
// клиент считается подписанным при значении равном null
if (array_key_exists('emailMarketingUnsubscribedAt', $this->dataCrm)) {
if (empty($this->dataCrm['emailMarketingUnsubscribedAt'])) {
$this->customer->setSubscribe('Y');
} else {
$this->customer->setSubscribe('N');
}
}
}
public function buildPassword()

View File

@ -47,6 +47,9 @@ class Customer extends BaseModel
/**@var string $PERSONAL_GENDER */
protected $PERSONAL_GENDER;
/**@var string $UF_SUBSCRIBE_USER_EMAIL */
protected $UF_SUBSCRIBE_USER_EMAIL;
/**
* @param string $EMAIL
* @return $this
@ -200,4 +203,15 @@ class Customer extends BaseModel
return $this;
}
/**
* @param string $UF_SUBSCRIBE_USER_EMAIL
* @return $this
*/
public function setSubscribe($UF_SUBSCRIBE_USER_EMAIL)
{
$this->UF_SUBSCRIBE_USER_EMAIL = $UF_SUBSCRIBE_USER_EMAIL;
return $this;
}
}

View File

@ -237,12 +237,12 @@ class RCrmActions
RetailCrmHistory::orderHistory();
self::uploadOrdersAgent();
} catch (\Throwable $exception) {
RCrmActions::eventLog(
'RCrmActions',
'orderAgent',
Logger::getInstance()->write(
'Fail orderAgent:' . PHP_EOL .
$exception->getMessage() . PHP_EOL .
'File: ' . $exception->getFile() . PHP_EOL .
'Line: ' . $exception->getLine() . PHP_EOL
'Line: ' . $exception->getLine() . PHP_EOL,
'orderAgent'
);
}

View File

@ -15,6 +15,7 @@
<field id="cumulative_discount" group="customer">cumulativeDiscount</field>
<field id="personal_discount" group="customer">personalDiscount</field>
<field id="discount_card_number" group="customer">discountCardNumber</field>
<field id="email_marketing_unsubscribed_at" group="customer">emailMarketingUnsubscribedAt</field>
<field id="address.index" group="customerAddress">index</field>
<field id="address.country" group="customerAddress">countryIso</field>

View File

@ -81,12 +81,7 @@
"default": false
},
"subscribed": {
"type": "bool",
"default": false
},
"subscribed": {
"type": "bool",
"default": false
"type": "string"
},
"commentary": {
"type": "string"

View File

@ -1,6 +1,10 @@
<?php
use Bitrix\Main\Context\Culture;
use Intaro\RetailCrm\Component\ServiceLocator;
use Intaro\RetailCrm\Repository\UserRepository;
use Intaro\RetailCrm\Service\CustomerService;
use Intaro\RetailCrm\Service\LoyaltyAccountService;
use Intaro\RetailCrm\Service\ManagerService;
use Bitrix\Sale\Payment;
use Bitrix\Catalog\Model\Event;
@ -42,6 +46,8 @@ class RetailCrmEvent
*/
public static function OnAfterUserUpdate($arFields)
{
RetailCrmService::writeLogsSubscribe($arFields);
if (isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) {
return false;
}
@ -632,6 +638,66 @@ class RetailCrmEvent
}
}
/**
* Регистрирует пользователя в CRM системе после регистрации на сайте
*
* @param array $arFields
* @return mixed
* @throws \ReflectionException
*/
public static function OnAfterUserRegister(array $arFields): void
{
if (isset($arFields['USER_ID']) && $arFields['USER_ID'] > 0) {
$user = UserRepository::getById($arFields['USER_ID']);
if (isset($_POST['REGISTER']['PERSONAL_PHONE'])) {
$phone = htmlspecialchars($_POST['REGISTER']['PERSONAL_PHONE']);
if ($user !== null) {
$user->setPersonalPhone($phone);
$user->save();
}
$arFields['PERSONAL_PHONE'] = $phone;
}
/* @var CustomerService $customerService */
$customerService = ServiceLocator::get(CustomerService::class);
$customer = $customerService->createModel($arFields['USER_ID']);
$customerService->createOrUpdateCustomer($customer);
RetailCrmService::writeLogsSubscribe($arFields);
//Если пользователь выразил желание зарегистрироваться в ПЛ и согласился со всеми правилами
if ((int) $arFields['UF_REG_IN_PL_INTARO'] === 1
&& (int) $arFields['UF_AGREE_PL_INTARO'] === 1
&& (int) $arFields['UF_PD_PROC_PL_INTARO'] === 1
) {
$phone = $arFields['PERSONAL_PHONE'] ?? '';
$card = $arFields['UF_CARD_NUM_INTARO'] ?? '';
$customerId = (string) $arFields['USER_ID'];
/** @var LoyaltyAccountService $service */
$service = ServiceLocator::get(LoyaltyAccountService::class);
$createResponse = $service->createLoyaltyAccount($phone, $card, $customerId);
$service->activateLpUserInBitrix($createResponse, $arFields['USER_ID']);
}
}
}
/**
* @param $arFields
*
* @return void
* @throws InvalidArgumentException
*/
public static function OnAfterUserAdd($arFields)
{
RetailCrmService::writeLogsSubscribe($arFields);
}
/**
* @return bool
*/

View File

@ -155,9 +155,8 @@ class RetailCrmHistory
if ($registerNewUser === true) {
$customerBuilder->buildPassword();
$registeredUserID = $newUser->Add(
$customerBuilder->getCustomer()->getObjectToArray()
);
$registeredUserID = $newUser->Add(self::getDataUser($customerBuilder));
if ($registeredUserID === false) {
RCrmActions::eventLog(
@ -198,7 +197,9 @@ class RetailCrmHistory
);
}
$u = $newUser->Update($customer['externalId'], $customerBuilder->getCustomer()->getObjectToArray());
$customerArray = $customerBuilder->getCustomer()->getObjectToArray();
$u = $newUser->Update($customer['externalId'], self::convertBooleanFields($customerArray));
if (!$u) {
RCrmActions::eventLog(
'RetailCrmHistory::customerHistory',
@ -457,9 +458,13 @@ class RetailCrmHistory
$corporateCustomerBuilder->setCorporateContact($userData);
$newUser = new CUser();
$registeredUserID = $newUser->Add(
$corporateCustomerBuilder->getCustomer()->getObjectToArray()
);
$customerArray = $corporateCustomerBuilder->getCustomer()->getObjectToArray();
if (!array_key_exists('UF_SUBSCRIBE_USER_EMAIL', $customerArray)) {
$customerArray['UF_SUBSCRIBE_USER_EMAIL'] = 'Y';
}
$registeredUserID = $newUser->Add(self::convertBooleanFields($customerArray));
if ($registeredUserID === false) {
RCrmActions::eventLog(
@ -921,9 +926,8 @@ class RetailCrmHistory
}
if ($registerNewUser === true) {
$registeredUserID = $newUser->Add(
$customerBuilder->getCustomer()->getObjectToArray()
);
$registeredUserID = $newUser->Add(self::getDataUser($customerBuilder));
if ($registeredUserID === false) {
RCrmActions::eventLog(
'RetailCrmHistory::orderHistory',
@ -2088,4 +2092,34 @@ class RetailCrmHistory
);
}
}
/**
* @param array $array
* @return array
*/
public static function convertBooleanFields($array)
{
foreach ($array as $key => $value) {
if ($value === 'N') {
$array[$key] = false;
}
}
return $array;
}
/**
* @param $customerBuilder
* @return array
*/
private static function getDataUser($customerBuilder)
{
$customerArray = $customerBuilder->getCustomer()->getObjectToArray();
if (!array_key_exists('UF_SUBSCRIBE_USER_EMAIL', $customerArray)) {
$customerArray['UF_SUBSCRIBE_USER_EMAIL'] = 'Y';
}
return self::convertBooleanFields($customerArray);
}
}

View File

@ -154,4 +154,28 @@ class RetailCrmService
return $result;
}
/**
* @param array $arFields
* @return void
*/
public static function writeLogsSubscribe(array $arFields): void
{
if (array_key_exists('UF_SUBSCRIBE_USER_EMAIL', $arFields)) {
$actionSub = GetMessage('SUBSCRIBED_USER');
$fileSub = 'subscribe';
if (empty($arFields['UF_SUBSCRIBE_USER_EMAIL'])) {
$actionSub = GetMessage('UNSUBSCRIBED_USER');
$fileSub = 'unSubscribe';
}
$id = $arFields['ID'] ?? $arFields['USER_ID'];
Logger::getInstance()->write(
$actionSub . ' (' . $id . ')',
$fileSub
);
}
}
}

View File

@ -27,7 +27,6 @@ class RetailCrmUser
$customer = self::getSimpleCustomer($arFields);
$customer['createdAt'] = new \DateTime($arFields['DATE_REGISTER']);
$customer['subscribed'] = false;
$customer['contragent'] = ['contragentType' => $contragentType];
if ($send && isset($_COOKIE['_rc']) && $_COOKIE['_rc'] != '') {
@ -49,6 +48,10 @@ class RetailCrmUser
$normalizer = new RestNormalizer();
$customer = $normalizer->normalize($customer, 'customers');
if (empty($arFields['UF_SUBSCRIBE_USER_EMAIL'])) {
$customer['subscribed'] = false;
}
Logger::getInstance()->write($customer, 'customerSend');
if (
@ -90,6 +93,7 @@ class RetailCrmUser
if ($found) {
$normalizer = new RestNormalizer();
$customer = $normalizer->normalize($customer, 'customers');
$customer = self::getBooleanFields($customer, $arFields);
if (function_exists('retailCrmBeforeCustomerSend')) {
$newResCustomer = retailCrmBeforeCustomerSend($customer);
@ -133,4 +137,17 @@ class RetailCrmUser
return $customer;
}
private static function getBooleanFields($customer, $arFields)
{
if (isset($arFields['UF_SUBSCRIBE_USER_EMAIL'])) {
if ($arFields['UF_SUBSCRIBE_USER_EMAIL'] === "1") {
$customer['subscribed'] = true;
} else {
$customer['subscribed'] = false;
}
}
return $customer;
}
}

View File

@ -1 +1 @@
- Исправлена ошибка некорректного вывода информации о программе лояльности в личном кабинете клиента
- Добавлена функция подписки на рекламно-информационные рассылки

View File

@ -81,3 +81,4 @@ $MESS["SEC"] = "сек.";
$MESS["RESEND_SMS"] = "Отправить смс повторно";
$MESS["RESEND_POSSIBLE"] = "Повторная отправка смс возможна через";
$MESS["LOYALTY_CONNECTION_ERROR"] = "Возникли проблемы с подключением к удаленному серверу. Попробуйте перезагрузить страницу.";
$MESS["SUBSCRIBE_EMAIL"] = "Согласен на рекламно-информационные рассылки";

View File

@ -540,6 +540,19 @@ if ($arResult["LOYALTY_CONNECTION_ERROR"] === true) {
<td><?=GetMessage("REGISTER_CAPTCHA_PROMT")?>:<span class="starrequired">*</span></td>
<td><input type="text" name="captcha_word" maxlength="50" value="" autocomplete="off"/></td>
</tr>
<tr>
<td></td>
<td>
<div class="fields boolean">
<div class="fields boolean">
<label>
<input type="checkbox" name="UF_SUBSCRIBE_USER_EMAIL" id="checkbox_UF_SUBSCRIBE_USER_EMAIL"> <?=GetMessage("SUBSCRIBE_EMAIL")?>
</label>
</div>
</div>
</td>
</tr>
<?
}
/* !CAPTCHA */

View File

@ -0,0 +1,10 @@
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$arTemplateParameters = array(
"USER_PROPERTY_NAME"=>array(
"NAME" => GetMessage("USER_PROPERTY_NAME"),
"TYPE" => "STRING",
"DEFAULT" => "",
),
);
?>

View File

@ -0,0 +1,3 @@
<?
$MESS ['USER_PROPERTY_NAME'] = "User properties section title";
?>

View File

@ -0,0 +1,64 @@
<?
$MESS['AUTH_NONSECURE_NOTE'] = "The password will be sent in open form. Enable JavaScript in your web browser to enable password encryption.";
$MESS['AUTH_REGISTER'] = "Registration";
$MESS['AUTH_REQ'] = "Required fields.";
$MESS['AUTH_SECURE_NOTE'] = "The password will be encrypted before it is sent. This will prevent the password from appearing in open form over data transmission channels.";
$MESS['MAIN_REGISTER_AUTH'] = "You have been registered and authorized successfully.";
$MESS['REGISTER_CAPTCHA_PROMT'] = "CAPTCHA image characters";
$MESS['REGISTER_CAPTCHA_TITLE'] = "Spam bot protection (CAPTCHA)";
$MESS['REGISTER_EMAIL_WILL_BE_SENT'] = "A registration confirmation request will be sent to the specified e-mail address.";
$MESS['REGISTER_FIELD_AUTO_TIME_ZONE'] = "Time Zone";
$MESS['REGISTER_FIELD_CONFIRM_PASSWORD'] = "Password confirmation";
$MESS['REGISTER_FIELD_EMAIL'] = "E-mail";
$MESS['REGISTER_FIELD_LAST_NAME'] = "Last Name";
$MESS['REGISTER_FIELD_LOGIN'] = "Login (min. 3 characters)";
$MESS['REGISTER_FIELD_NAME'] = "Name";
$MESS['REGISTER_FIELD_PASSWORD'] = "Password";
$MESS['REGISTER_FIELD_PERSONAL_BIRTHDAY'] = "Birthday";
$MESS['REGISTER_FIELD_PERSONAL_CITY'] = "City";
$MESS['REGISTER_FIELD_PERSONAL_COUNTRY'] = "Country";
$MESS['REGISTER_FIELD_PERSONAL_FAX'] = "Fax";
$MESS['REGISTER_FIELD_PERSONAL_GENDER'] = "Gender";
$MESS['REGISTER_FIELD_PERSONAL_ICQ'] = "ICQ";
$MESS['REGISTER_FIELD_PERSONAL_MAILBOX'] = "Mailbox";
$MESS['REGISTER_FIELD_PERSONAL_MOBILE'] = "Mobile";
$MESS['REGISTER_FIELD_PERSONAL_NOTES'] = "Notes";
$MESS['REGISTER_FIELD_PERSONAL_PAGER'] = "Pager";
$MESS['REGISTER_FIELD_PERSONAL_PHONE'] = "Phone";
$MESS['REGISTER_FIELD_PERSONAL_PHOTO'] = "Photo";
$MESS['REGISTER_FIELD_PERSONAL_PROFESSION'] = "Job Title";
$MESS['REGISTER_FIELD_PERSONAL_STATE'] = "State";
$MESS['REGISTER_FIELD_PERSONAL_STREET'] = "Address";
$MESS['REGISTER_FIELD_PERSONAL_WWW'] = "Web page";
$MESS['REGISTER_FIELD_PERSONAL_ZIP'] = "Zip code";
$MESS['REGISTER_FIELD_PHONE_NUMBER'] = "Phone number";
$MESS['REGISTER_FIELD_SECOND_NAME'] = "Middle Name";
$MESS['REGISTER_FIELD_TITLE'] = "Salutation";
$MESS['REGISTER_FIELD_WORK_CITY'] = "City";
$MESS['REGISTER_FIELD_WORK_COMPANY'] = "Company";
$MESS['REGISTER_FIELD_WORK_COUNTRY'] = "Country";
$MESS['REGISTER_FIELD_WORK_DEPARTMENT'] = "Department";
$MESS['REGISTER_FIELD_WORK_FAX'] = "Fax";
$MESS['REGISTER_FIELD_WORK_LOGO'] = "Company logo";
$MESS['REGISTER_FIELD_WORK_MAILBOX'] = "Mailbox";
$MESS['REGISTER_FIELD_WORK_NOTES'] = "Notes";
$MESS['REGISTER_FIELD_WORK_PAGER'] = "Pager";
$MESS['REGISTER_FIELD_WORK_PHONE'] = "Phone";
$MESS['REGISTER_FIELD_WORK_POSITION'] = "Position";
$MESS['REGISTER_FIELD_WORK_PROFILE'] = "Profile";
$MESS['REGISTER_FIELD_WORK_STATE'] = "State";
$MESS['REGISTER_FIELD_WORK_STREET'] = "Address";
$MESS['REGISTER_FIELD_WORK_WWW'] = "Web page";
$MESS['REGISTER_FIELD_WORK_ZIP'] = "Zip code";
$MESS['USER_DONT_KNOW'] = "(unknown)";
$MESS['USER_FEMALE'] = "Female";
$MESS['USER_MALE'] = "Male";
$MESS['main_profile_time_zones_auto'] = "Auto Time Zone:";
$MESS['main_profile_time_zones_auto_def'] = "(default)";
$MESS['main_profile_time_zones_auto_no'] = "No, select from list";
$MESS['main_profile_time_zones_auto_yes'] = "Yes, use browser settings";
$MESS['main_profile_time_zones_zones'] = "Time Zone:";
$MESS['main_register_sms'] = "SMS confirmation code:";
$MESS['main_register_sms_send'] = "Submit";
$MESS["SUBSCRIBE_EMAIL"] = "I agree to receive promotional newsletters";
?>

View File

@ -0,0 +1,3 @@
<?
$MESS ['USER_PROPERTY_NAME'] = "Название блока пользовательских свойств";
?>

View File

@ -0,0 +1,64 @@
<?
$MESS["AUTH_REGISTER"] = "Регистрация";
$MESS["REGISTER_CAPTCHA_TITLE"] = "Защита от автоматической регистрации";
$MESS["REGISTER_CAPTCHA_PROMT"] = "Введите слово на картинке";
$MESS["AUTH_REQ"] = "Поля, обязательные для заполнения.";
$MESS["USER_DONT_KNOW"] = "(неизвестно)";
$MESS["USER_MALE"] = "Мужской";
$MESS["USER_FEMALE"] = "Женский";
$MESS["REGISTER_FIELD_LOGIN"] = "Логин (мин. 3 символа)";
$MESS["REGISTER_FIELD_EMAIL"] = "Email";
$MESS["REGISTER_FIELD_PASSWORD"] = "Пароль";
$MESS["REGISTER_FIELD_CONFIRM_PASSWORD"] = "Подтверждение пароля";
$MESS["REGISTER_FIELD_TITLE"] = "Обращение";
$MESS["REGISTER_FIELD_NAME"] = "Имя";
$MESS["REGISTER_FIELD_SECOND_NAME"] = "Отчество";
$MESS["REGISTER_FIELD_LAST_NAME"] = "Фамилия";
$MESS["REGISTER_FIELD_AUTO_TIME_ZONE"] = "Часовой пояс";
$MESS["REGISTER_FIELD_PERSONAL_PROFESSION"] = "Профессия";
$MESS["REGISTER_FIELD_PERSONAL_WWW"] = "WWW-страница";
$MESS["REGISTER_FIELD_PERSONAL_ICQ"] = "ICQ";
$MESS["REGISTER_FIELD_PERSONAL_GENDER"] = "Пол";
$MESS["REGISTER_FIELD_PERSONAL_BIRTHDAY"] = "Дата рождения";
$MESS["REGISTER_FIELD_PERSONAL_PHOTO"] = "Фотография";
$MESS["REGISTER_FIELD_PERSONAL_PHONE"] = "Телефон";
$MESS["REGISTER_FIELD_PERSONAL_FAX"] = "Факс";
$MESS["REGISTER_FIELD_PERSONAL_MOBILE"] = "Мобильный";
$MESS["REGISTER_FIELD_PERSONAL_PAGER"] = "Пейджер";
$MESS["REGISTER_FIELD_PERSONAL_STREET"] = "Улица, дом";
$MESS["REGISTER_FIELD_PERSONAL_MAILBOX"] = "Почтовый ящик";
$MESS["REGISTER_FIELD_PERSONAL_CITY"] = "Город";
$MESS["REGISTER_FIELD_PERSONAL_STATE"] = "Область / край";
$MESS["REGISTER_FIELD_PERSONAL_ZIP"] = "Почтовый индекс";
$MESS["REGISTER_FIELD_PERSONAL_COUNTRY"] = "Страна";
$MESS["REGISTER_FIELD_PERSONAL_NOTES"] = "Дополнительные заметки";
$MESS["REGISTER_FIELD_WORK_COMPANY"] = "Наименование компании";
$MESS["REGISTER_FIELD_WORK_DEPARTMENT"] = "Департамент / Отдел";
$MESS["REGISTER_FIELD_WORK_POSITION"] = "Должность";
$MESS["REGISTER_FIELD_WORK_WWW"] = "WWW-страница (работа)";
$MESS["REGISTER_FIELD_WORK_PHONE"] = "Телефон (работа)";
$MESS["REGISTER_FIELD_WORK_FAX"] = "Факс (работа)";
$MESS["REGISTER_FIELD_WORK_PAGER"] = "Пейджер (работа)";
$MESS["REGISTER_FIELD_WORK_STREET"] = "Улица, дом (работа)";
$MESS["REGISTER_FIELD_WORK_MAILBOX"] = "Почтовый ящик (работа)";
$MESS["REGISTER_FIELD_WORK_CITY"] = "Город (работа)";
$MESS["REGISTER_FIELD_WORK_STATE"] = "Область / край (работа)";
$MESS["REGISTER_FIELD_WORK_ZIP"] = "Почтовый индекс (работа)";
$MESS["REGISTER_FIELD_WORK_COUNTRY"] = "Страна (работа)";
$MESS["REGISTER_FIELD_WORK_PROFILE"] = "Направления деятельности";
$MESS["REGISTER_FIELD_WORK_LOGO"] = "Логотип компании";
$MESS["REGISTER_FIELD_WORK_NOTES"] = "Дополнительные заметки (работа)";
$MESS["REGISTER_FIELD_PHONE_NUMBER"] = "Номер телефона";
$MESS["REGISTER_EMAIL_WILL_BE_SENT"] = "На указанный в форме email придет запрос на подтверждение регистрации.";
$MESS["MAIN_REGISTER_AUTH"] = "Вы зарегистрированы на сервере и успешно авторизованы.";
$MESS["main_profile_time_zones_auto"] = "Автоматически определять часовой пояс:";
$MESS["main_profile_time_zones_auto_def"] = "(по умолчанию)";
$MESS["main_profile_time_zones_auto_yes"] = "Да, определить по браузеру";
$MESS["main_profile_time_zones_auto_no"] = "Нет, выбрать из списка";
$MESS["main_profile_time_zones_zones"] = "Часовой пояс:";
$MESS["AUTH_SECURE_NOTE"] = "Перед отправкой формы пароль будет зашифрован в браузере. Это позволит избежать передачи пароля в открытом виде.";
$MESS["AUTH_NONSECURE_NOTE"] = "Пароль будет отправлен в открытом виде. Включите JavaScript в браузере, чтобы зашифровать пароль перед отправкой.";
$MESS["main_register_sms"] = "Код подтверждения из СМС:";
$MESS["main_register_sms_send"] = "Отправить";
$MESS["SUBSCRIBE_EMAIL"] = "Согласен на рекламно-информационные рассылки";
?>

View File

@ -0,0 +1,5 @@
div.bx-auth-reg input.bx-auth-input {vertical-align:middle;}
div.bx-auth-reg span.bx-auth-secure {background-color:#FFFAE3; border:1px solid #DEDBC8; padding:2px; display:inline-block; vertical-align:middle;}
div.bx-auth-reg div.bx-auth-secure-icon {background-image:url(images/sec.png); background-repeat:no-repeat; background-position:center; width:19px; height:18px;}
div.bx-auth-reg div.bx-auth-secure-unlock {background-image:url(images/sec-unlocked.png);}

View File

@ -0,0 +1 @@
div.bx-auth-reg input.bx-auth-input{vertical-align:middle}div.bx-auth-reg span.bx-auth-secure{background-color:#fffae3;border:1px solid #dedbc8;padding:2px;display:inline-block;vertical-align:middle}div.bx-auth-reg div.bx-auth-secure-icon{background-image:url(images/sec.png);background-repeat:no-repeat;background-position:center;width:19px;height:18px}div.bx-auth-reg div.bx-auth-secure-unlock{background-image:url(images/sec-unlocked.png)}

View File

@ -0,0 +1,279 @@
<?
/**
* Bitrix Framework
* @package bitrix
* @subpackage main
* @copyright 2001-2014 Bitrix
*/
/**
* Bitrix vars
* @global CMain $APPLICATION
* @global CUser $USER
* @param array $arParams
* @param array $arResult
* @param CBitrixComponentTemplate $this
*/
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
die();
if($arResult["SHOW_SMS_FIELD"] == true)
{
CJSCore::Init('phone_auth');
}
?>
<div class="bx-auth-reg">
<?if($USER->IsAuthorized()):?>
<p><?echo GetMessage("MAIN_REGISTER_AUTH")?></p>
<?else:?>
<?
if (!empty($arResult["ERRORS"])):
foreach ($arResult["ERRORS"] as $key => $error)
if (intval($key) == 0 && $key !== 0)
$arResult["ERRORS"][$key] = str_replace("#FIELD_NAME#", "&quot;".GetMessage("REGISTER_FIELD_".$key)."&quot;", $error);
ShowError(implode("<br />", $arResult["ERRORS"]));
elseif($arResult["USE_EMAIL_CONFIRMATION"] === "Y"):
?>
<p><?echo GetMessage("REGISTER_EMAIL_WILL_BE_SENT")?></p>
<?endif?>
<?if($arResult["SHOW_SMS_FIELD"] == true):?>
<form method="post" action="<?=POST_FORM_ACTION_URI?>" name="regform">
<?
if($arResult["BACKURL"] <> ''):
?>
<input type="hidden" name="backurl" value="<?=$arResult["BACKURL"]?>" />
<?
endif;
?>
<input type="hidden" name="SIGNED_DATA" value="<?=htmlspecialcharsbx($arResult["SIGNED_DATA"])?>" />
<table>
<tbody>
<tr>
<td><?echo GetMessage("main_register_sms")?><span class="starrequired">*</span></td>
<td><input size="30" type="text" name="SMS_CODE" value="<?=htmlspecialcharsbx($arResult["SMS_CODE"])?>" autocomplete="off" /></td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td><input type="submit" name="code_submit_button" value="<?echo GetMessage("main_register_sms_send")?>" /></td>
</tr>
</tfoot>
</table>
</form>
<script>
new BX.PhoneAuth({
containerId: 'bx_register_resend',
errorContainerId: 'bx_register_error',
interval: <?=$arResult["PHONE_CODE_RESEND_INTERVAL"]?>,
data:
<?=CUtil::PhpToJSObject([
'signedData' => $arResult["SIGNED_DATA"],
])?>,
onError:
function(response)
{
var errorDiv = BX('bx_register_error');
var errorNode = BX.findChildByClassName(errorDiv, 'errortext');
errorNode.innerHTML = '';
for(var i = 0; i < response.errors.length; i++)
{
errorNode.innerHTML = errorNode.innerHTML + BX.util.htmlspecialchars(response.errors[i].message) + '<br>';
}
errorDiv.style.display = '';
}
});
</script>
<div id="bx_register_error" style="display:none"><?ShowError("error")?></div>
<div id="bx_register_resend"></div>
<?else:?>
<form method="post" action="<?=POST_FORM_ACTION_URI?>" name="regform" enctype="multipart/form-data">
<?
if($arResult["BACKURL"] <> ''):
?>
<input type="hidden" name="backurl" value="<?=$arResult["BACKURL"]?>" />
<?
endif;
?>
<table>
<thead>
<tr>
<td colspan="2"><b><?=GetMessage("AUTH_REGISTER")?></b></td>
</tr>
</thead>
<tbody>
<?foreach ($arResult["SHOW_FIELDS"] as $FIELD):?>
<?if($FIELD == "AUTO_TIME_ZONE" && $arResult["TIME_ZONE_ENABLED"] == true):?>
<tr>
<td><?echo GetMessage("main_profile_time_zones_auto")?><?if ($arResult["REQUIRED_FIELDS_FLAGS"][$FIELD] == "Y"):?><span class="starrequired">*</span><?endif?></td>
<td>
<select name="REGISTER[AUTO_TIME_ZONE]" onchange="this.form.elements['REGISTER[TIME_ZONE]'].disabled=(this.value != 'N')">
<option value=""><?echo GetMessage("main_profile_time_zones_auto_def")?></option>
<option value="Y"<?=$arResult["VALUES"][$FIELD] == "Y" ? " selected=\"selected\"" : ""?>><?echo GetMessage("main_profile_time_zones_auto_yes")?></option>
<option value="N"<?=$arResult["VALUES"][$FIELD] == "N" ? " selected=\"selected\"" : ""?>><?echo GetMessage("main_profile_time_zones_auto_no")?></option>
</select>
</td>
</tr>
<tr>
<td><?echo GetMessage("main_profile_time_zones_zones")?></td>
<td>
<select name="REGISTER[TIME_ZONE]"<?if(!isset($_REQUEST["REGISTER"]["TIME_ZONE"])) echo 'disabled="disabled"'?>>
<?foreach($arResult["TIME_ZONE_LIST"] as $tz=>$tz_name):?>
<option value="<?=htmlspecialcharsbx($tz)?>"<?=$arResult["VALUES"]["TIME_ZONE"] == $tz ? " selected=\"selected\"" : ""?>><?=htmlspecialcharsbx($tz_name)?></option>
<?endforeach?>
</select>
</td>
</tr>
<?else:?>
<tr>
<td><?=GetMessage("REGISTER_FIELD_".$FIELD)?>:<?if ($arResult["REQUIRED_FIELDS_FLAGS"][$FIELD] == "Y"):?><span class="starrequired">*</span><?endif?></td>
<td><?
switch ($FIELD)
{
case "PASSWORD":
?><input size="30" type="password" name="REGISTER[<?=$FIELD?>]" value="<?=$arResult["VALUES"][$FIELD]?>" autocomplete="off" class="bx-auth-input" />
<?if($arResult["SECURE_AUTH"]):?>
<span class="bx-auth-secure" id="bx_auth_secure" title="<?echo GetMessage("AUTH_SECURE_NOTE")?>" style="display:none">
<div class="bx-auth-secure-icon"></div>
</span>
<noscript>
<span class="bx-auth-secure" title="<?echo GetMessage("AUTH_NONSECURE_NOTE")?>">
<div class="bx-auth-secure-icon bx-auth-secure-unlock"></div>
</span>
</noscript>
<script type="text/javascript">
document.getElementById('bx_auth_secure').style.display = 'inline-block';
</script>
<?endif?>
<?
break;
case "CONFIRM_PASSWORD":
?><input size="30" type="password" name="REGISTER[<?=$FIELD?>]" value="<?=$arResult["VALUES"][$FIELD]?>" autocomplete="off" /><?
break;
case "PERSONAL_GENDER":
?><select name="REGISTER[<?=$FIELD?>]">
<option value=""><?=GetMessage("USER_DONT_KNOW")?></option>
<option value="M"<?=$arResult["VALUES"][$FIELD] == "M" ? " selected=\"selected\"" : ""?>><?=GetMessage("USER_MALE")?></option>
<option value="F"<?=$arResult["VALUES"][$FIELD] == "F" ? " selected=\"selected\"" : ""?>><?=GetMessage("USER_FEMALE")?></option>
</select><?
break;
case "PERSONAL_COUNTRY":
case "WORK_COUNTRY":
?><select name="REGISTER[<?=$FIELD?>]"><?
foreach ($arResult["COUNTRIES"]["reference_id"] as $key => $value)
{
?><option value="<?=$value?>"<?if ($value == $arResult["VALUES"][$FIELD]):?> selected="selected"<?endif?>><?=$arResult["COUNTRIES"]["reference"][$key]?></option>
<?
}
?></select><?
break;
case "PERSONAL_PHOTO":
case "WORK_LOGO":
?><input size="30" type="file" name="REGISTER_FILES_<?=$FIELD?>" /><?
break;
case "PERSONAL_NOTES":
case "WORK_NOTES":
?><textarea cols="30" rows="5" name="REGISTER[<?=$FIELD?>]"><?=$arResult["VALUES"][$FIELD]?></textarea><?
break;
default:
if ($FIELD == "PERSONAL_BIRTHDAY"):?><small><?=$arResult["DATE_FORMAT"]?></small><br /><?endif;
?><input size="30" type="text" name="REGISTER[<?=$FIELD?>]" value="<?=$arResult["VALUES"][$FIELD]?>" /><?
if ($FIELD == "PERSONAL_BIRTHDAY")
$APPLICATION->IncludeComponent(
'bitrix:main.calendar',
'',
array(
'SHOW_INPUT' => 'N',
'FORM_NAME' => 'regform',
'INPUT_NAME' => 'REGISTER[PERSONAL_BIRTHDAY]',
'SHOW_TIME' => 'N'
),
null,
array("HIDE_ICONS"=>"Y")
);
?><?
}?></td>
</tr>
<?endif?>
<?endforeach?>
<?// ********************* User properties ***************************************************?>
<?if($arResult["USER_PROPERTIES"]["SHOW"] == "Y"):?>
<tr><td colspan="2"><?=trim($arParams["USER_PROPERTY_NAME"]) <> '' ? $arParams["USER_PROPERTY_NAME"] : GetMessage("USER_TYPE_EDIT_TAB")?></td></tr>
<?foreach ($arResult["USER_PROPERTIES"]["DATA"] as $FIELD_NAME => $arUserField):?>
<tr><td><?=$arUserField["EDIT_FORM_LABEL"]?>:<?if ($arUserField["MANDATORY"]=="Y"):?><span class="starrequired">*</span><?endif;?></td><td>
<?$APPLICATION->IncludeComponent(
"bitrix:system.field.edit",
$arUserField["USER_TYPE"]["USER_TYPE_ID"],
array("bVarsFromForm" => $arResult["bVarsFromForm"], "arUserField" => $arUserField, "form_name" => "regform"), null, array("HIDE_ICONS"=>"Y"));?></td></tr>
<?endforeach;?>
<?endif;?>
<?// ******************** /User properties ***************************************************?>
<?
/* CAPTCHA */
if ($arResult["USE_CAPTCHA"] == "Y")
{
?>
<tr>
<td colspan="2"><b><?=GetMessage("REGISTER_CAPTCHA_TITLE")?></b></td>
</tr>
<tr>
<td></td>
<td>
<input type="hidden" name="captcha_sid" value="<?=$arResult["CAPTCHA_CODE"]?>" />
<img src="/bitrix/tools/captcha.php?captcha_sid=<?=$arResult["CAPTCHA_CODE"]?>" width="180" height="40" alt="CAPTCHA" />
</td>
</tr>
<tr>
<td><?=GetMessage("REGISTER_CAPTCHA_PROMT")?>:<span class="starrequired">*</span></td>
<td><input type="text" name="captcha_word" maxlength="50" value="" autocomplete="off" /></td>
</tr>
<tr>
<td></td>
<td>
<label>
<input type="checkbox" name="UF_SUBSCRIBE_USER_EMAIL" id="checkbox_UF_SUBSCRIBE_USER_EMAIL"> <?=GetMessage("SUBSCRIBE_EMAIL")?>
</label>
</td>
</tr>
<?
}
/* !CAPTCHA */
?>
</tbody>
<tfoot>
<tr>
<td></td>
<td><input type="submit" name="register_submit_button" value="<?=GetMessage("AUTH_REGISTER")?>" /></td>
</tr>
</tfoot>
</table>
</form>
<p><?echo $arResult["GROUP_POLICY"]["PASSWORD_REQUIREMENTS"];?></p>
<?endif //$arResult["SHOW_SMS_FIELD"] == true ?>
<p><span class="starrequired">*</span><?=GetMessage("AUTH_REQ")?></p>
<?endif?>
</div>

View File

@ -0,0 +1,90 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
{
die();
}
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @var PersonalOrderSection $component */
/** @var array $arParams */
/** @var array $arResult */
use Bitrix\Main\Localization\Loc;
global $USER;
if ($arParams['SHOW_ACCOUNT_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams['SET_TITLE'] === 'Y')
{
$APPLICATION->SetTitle(Loc::getMessage("SPS_TITLE_ACCOUNT"));
}
if ($arParams["MAIN_CHAIN_NAME"] !== '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_ACCOUNT"));
if ($arParams['SHOW_ACCOUNT_COMPONENT'] !== 'N')
{
$APPLICATION->IncludeComponent(
"bitrix:sale.personal.account",
"bootstrap_v4",
[
"SET_TITLE" => "N",
"AUTH_FORM_IN_TEMPLATE" => 'Y',
],
$component
);
}
if ($arParams['SHOW_ACCOUNT_PAY_COMPONENT'] !== 'N' && $USER->IsAuthorized())
{
?>
<div class="row">
<div class="col">
<h2 class="sale-personal-section-account-sub-header"><?=Loc::getMessage("SPS_BUY_MONEY")?></h2>
</div>
</div>
<div class="row">
<div class="col">
<?
$APPLICATION->IncludeComponent(
"bitrix:sale.account.pay",
"bootstrap_v4",
Array(
"COMPONENT_TEMPLATE" => "bootstrap_v4",
"REFRESHED_COMPONENT_MODE" => "Y",
"ELIMINATED_PAY_SYSTEMS" => $arParams['ACCOUNT_PAYMENT_ELIMINATED_PAY_SYSTEMS'],
"PATH_TO_BASKET" => $arParams['PATH_TO_BASKET'],
"PATH_TO_PAYMENT" => $arParams['PATH_TO_PAYMENT'],
"PERSON_TYPE" => $arParams['ACCOUNT_PAYMENT_PERSON_TYPE'],
"REDIRECT_TO_CURRENT_PAGE" => "N",
"SELL_AMOUNT" => $arParams['ACCOUNT_PAYMENT_SELL_TOTAL'],
"SELL_CURRENCY" => $arParams['ACCOUNT_PAYMENT_SELL_CURRENCY'],
"SELL_SHOW_FIXED_VALUES" => $arParams['ACCOUNT_PAYMENT_SELL_SHOW_FIXED_VALUES'],
"SELL_SHOW_RESULT_SUM" => $arParams['ACCOUNT_PAYMENT_SELL_SHOW_RESULT_SUM'],
"SELL_TOTAL" => $arParams['ACCOUNT_PAYMENT_SELL_TOTAL'],
"SELL_USER_INPUT" => $arParams['ACCOUNT_PAYMENT_SELL_USER_INPUT'],
"SELL_VALUES_FROM_VAR" => "N",
"SELL_VAR_PRICE_VALUE" => "",
"SET_TITLE" => "N",
"CONTEXT_SITE_ID" => $arParams["CONTEXT_SITE_ID"],
"AUTH_FORM_IN_TEMPLATE" => 'Y',
),
$component
);
}
?>
</div>
</div>

View File

@ -0,0 +1,18 @@
<?php
$MESS["ACTIVE"] = "Active:";
$MESS["EMAIL"] = "E-mail:";
$MESS["LAST_LOGIN"] = "Last authorized:";
$MESS["LAST_NAME"] = "Last name:";
$MESS["LAST_UPDATE"] = "Last update:";
$MESS["LOGIN"] = "Login (min. 3 characters):";
$MESS["MAIN_PROFILE_TITLE"] = "Salutation:";
$MESS["MAIN_RESET"] = "Cancel";
$MESS["NAME"] = "Name:";
$MESS["NEW_PASSWORD"] = "New password (min. 6 characters):";
$MESS["NEW_PASSWORD_CONFIRM"] = "Confirm new password:";
$MESS["NEW_PASSWORD_REQ"] = "New Password:";
$MESS["PROFILE_DATA_SAVED"] = "All changes saved";
$MESS["RESET"] = "Reset";
$MESS["SAVE"] = "Save changes";
$MESS["SECOND_NAME"] = "Middle name:";
$MESS['SUBSCRIBE_EMAIL'] = 'I agree to receive promotional newsletters';

View File

@ -0,0 +1,18 @@
<?php
$MESS['PROFILE_DATA_SAVED'] = "Изменения сохранены";
$MESS['LAST_UPDATE'] = "Дата обновления:";
$MESS['ACTIVE'] = "Активен:";
$MESS['NAME'] = "Имя:";
$MESS['LAST_NAME'] = "Фамилия:";
$MESS['SECOND_NAME'] = "Отчество:";
$MESS['EMAIL'] = "E-Mail:";
$MESS['MAIN_RESET'] = "Отмена";
$MESS['LOGIN'] = "Логин (мин. 3 символа):";
$MESS['NEW_PASSWORD'] = "Новый пароль (мин. 6 символов):";
$MESS['NEW_PASSWORD_CONFIRM'] = "Подтверждение нового пароля:";
$MESS['SAVE'] = "Сохранить изменения";
$MESS['RESET'] = "Сбросить";
$MESS['LAST_LOGIN'] = "Последняя авторизация:";
$MESS['NEW_PASSWORD_REQ'] = "Новый пароль:";
$MESS['MAIN_PROFILE_TITLE'] = "Обращение:";
$MESS['SUBSCRIBE_EMAIL'] = 'Согласен на рекламно-информационные рассылки';

View File

@ -0,0 +1,33 @@
BX.namespace('BX.Sale.PersonalProfileComponent');
(function() {
BX.Sale.PrivateProfileComponent = {
init: function ()
{
var passwordNode = BX('main-profile-password');
var confirmNode = BX('main-profile-password-confirm');
BX.ready(function(){
BX.bind(confirmNode, 'input', function(){
if (!BX.type.isNotEmptyString(confirmNode.value))
{
BX.removeClass(passwordNode.parentNode, 'has-error');
}
else if (!BX.type.isNotEmptyString(passwordNode.value))
{
BX.addClass(passwordNode.parentNode, 'has-error');
}
});
BX.bind(passwordNode, 'input', function(){
if (BX.type.isNotEmptyString(passwordNode.value))
{
BX.removeClass(passwordNode.parentNode, 'has-error');
}
else if (BX.type.isNotEmptyString(confirmNode.value))
{
BX.addClass(passwordNode.parentNode, 'has-error');
}
})
});
},
}
})();

View File

@ -0,0 +1 @@
{"version":3,"sources":["script.js"],"names":["BX","namespace","Sale","PrivateProfileComponent","init","passwordNode","confirmNode","ready","bind","type","isNotEmptyString","value","removeClass","parentNode","addClass"],"mappings":"AAAAA,GAAGC,UAAU,qCAEb,WACCD,GAAGE,KAAKC,yBACPC,KAAM,WAEL,IAAIC,EAAeL,GAAG,yBACtB,IAAIM,EAAcN,GAAG,iCACrBA,GAAGO,MAAM,WACRP,GAAGQ,KAAKF,EAAa,QAAS,WAC7B,IAAKN,GAAGS,KAAKC,iBAAiBJ,EAAYK,OAC1C,CACCX,GAAGY,YAAYP,EAAaQ,WAAY,kBAEpC,IAAKb,GAAGS,KAAKC,iBAAiBL,EAAaM,OAChD,CACCX,GAAGc,SAAST,EAAaQ,WAAY,gBAGvCb,GAAGQ,KAAKH,EAAc,QAAS,WAC9B,GAAIL,GAAGS,KAAKC,iBAAiBL,EAAaM,OAC1C,CACCX,GAAGY,YAAYP,EAAaQ,WAAY,kBAEpC,GAAIb,GAAGS,KAAKC,iBAAiBJ,EAAYK,OAC9C,CACCX,GAAGc,SAAST,EAAaQ,WAAY,qBAxB3C","file":"script.map.js"}

View File

@ -0,0 +1,2 @@
BX.namespace("BX.Sale.PersonalProfileComponent");(function(){BX.Sale.PrivateProfileComponent={init:function(){var e=BX("main-profile-password");var r=BX("main-profile-password-confirm");BX.ready(function(){BX.bind(r,"input",function(){if(!BX.type.isNotEmptyString(r.value)){BX.removeClass(e.parentNode,"has-error")}else if(!BX.type.isNotEmptyString(e.value)){BX.addClass(e.parentNode,"has-error")}});BX.bind(e,"input",function(){if(BX.type.isNotEmptyString(e.value)){BX.removeClass(e.parentNode,"has-error")}else if(BX.type.isNotEmptyString(r.value)){BX.addClass(e.parentNode,"has-error")}})})}}})();
//# sourceMappingURL=script.map.js

View File

@ -0,0 +1,14 @@
.bx_profile .main-profile-block-date-info { margin-bottom: 15px; }
.bx_profile .main-profile-form-password-annotation {
margin-top: 15px;
margin-bottom: 0;
color: grey;
font-weight: lighter;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
.bx_profile .main-profile-social-block { margin-top: 40px; }

View File

@ -0,0 +1 @@
.bx_profile .main-profile-block-date-info{margin-bottom:15px}.bx_profile .main-profile-form-password-annotation{margin-top:15px;margin-bottom:0;color:grey;font-weight:lighter;font-size:12px;font-family:Arial,Helvetica,sans-serif}.bx_profile .main-profile-social-block{margin-top:40px}

View File

@ -0,0 +1,163 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
die();
use Bitrix\Main\Localization\Loc;
?>
<div class="bx_profile">
<?
ShowError($arResult["strProfileError"]);
if (($arResult['DATA_SAVED'] ?? 'N') === 'Y')
{
ShowNote(Loc::getMessage('PROFILE_DATA_SAVED'));
}
?>
<form method="post" name="form1" action="<?=POST_FORM_ACTION_URI?>" enctype="multipart/form-data" role="form">
<?=$arResult["BX_SESSION_CHECK"]?>
<input type="hidden" name="lang" value="<?=LANG?>" />
<input type="hidden" name="ID" value="<?=$arResult["ID"]?>" />
<input type="hidden" name="LOGIN" value="<?=$arResult["arUser"]["LOGIN"]?>" />
<div class="main-profile-block-shown" id="user_div_reg">
<div class="row main-profile-block-date-info">
<?
if($arResult["ID"]>0)
{
if ($arResult["arUser"]["TIMESTAMP_X"] <> '')
{
?>
<div class="col-12">
<strong><?=Loc::getMessage('LAST_UPDATE')?></strong>
<strong><?=$arResult["arUser"]["TIMESTAMP_X"]?></strong>
</div>
<?
}
if ($arResult["arUser"]["LAST_LOGIN"] <> '')
{
?>
<div class="col-12">
<strong><?=Loc::getMessage('LAST_LOGIN')?></strong>
<strong><?=$arResult["arUser"]["LAST_LOGIN"]?></strong>
</div>
<?
}
}
?>
</div>
<div class="row">
<div class="col-12">
<?
if (!in_array(LANGUAGE_ID,array('ru', 'ua')))
{
?>
<div class="row">
<div class="col align-items-center">
<div class="form-group">
<label class="main-profile-form-label" for="main-profile-title"><?=Loc::getMessage('MAIN_PROFILE_TITLE')?></label>
<input class="form-control" type="text" name="TITLE" maxlength="50" id="main-profile-title" value="<?=$arResult["arUser"]["TITLE"]?>" />
</div>
</div>
</div>
<?
}
?>
<div class="form-group row">
<label class="col-sm-4 col-md-3 col-form-label main-profile-form-label" for="main-profile-name"><?=Loc::getMessage('NAME')?></label>
<div class="col-sm-8 col-md-9">
<input class="form-control" type="text" name="NAME" maxlength="50" id="main-profile-name" value="<?=$arResult["arUser"]["NAME"]?>" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-md-3 col-form-label main-profile-form-label" for="main-profile-last-name"><?=Loc::getMessage('LAST_NAME')?></label>
<div class="col-sm-8 col-md-9">
<input class="form-control" type="text" name="LAST_NAME" maxlength="50" id="main-profile-last-name" value="<?=$arResult["arUser"]["LAST_NAME"]?>" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-md-3 col-form-label main-profile-form-label" for="main-profile-second-name"><?=Loc::getMessage('SECOND_NAME')?></label>
<div class="col-sm-8 col-md-9">
<input class="form-control" type="text" name="SECOND_NAME" maxlength="50" id="main-profile-second-name" value="<?=$arResult["arUser"]["SECOND_NAME"]?>" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-md-3 col-form-label main-profile-form-label" for="main-profile-email"><?=Loc::getMessage('EMAIL')?></label>
<div class="col-sm-8 col-md-9">
<input class="form-control" type="text" name="EMAIL" maxlength="50" id="main-profile-email" value="<?=$arResult["arUser"]["EMAIL"]?>" />
</div>
</div>
<?
if ($arResult['CAN_EDIT_PASSWORD'])
{
?>
<div class="form-group row">
<label class="col-sm-4 col-md-3 col-form-label main-profile-form-label" for="main-profile-password"><?=Loc::getMessage('NEW_PASSWORD_REQ')?></label>
<div class="col-sm-8 col-md-9">
<input class=" form-control bx-auth-input main-profile-password" type="password" name="NEW_PASSWORD" maxlength="50" id="main-profile-password" value="" autocomplete="off"/>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-md-3 col-form-label main-profile-form-label main-profile-password" for="main-profile-password-confirm">
<?=Loc::getMessage('NEW_PASSWORD_CONFIRM')?>
</label>
<div class="col-sm-8 col-md-9">
<input class="form-control" type="password" name="NEW_PASSWORD_CONFIRM" maxlength="50" value="" id="main-profile-password-confirm" autocomplete="off" />
<small id="emailHelp" class="form-text text-muted"><?echo $arResult["GROUP_POLICY"]["PASSWORD_REQUIREMENTS"];?></small>
</div>
</div>
<?
}
?>
</div>
</div>
<div class="form-check row">
<div class="col-sm-8 col-md-9">
<input type="hidden" name="UF_SUBSCRIBE_USER_EMAIL" value="0">
<input class="form-check-input" type="checkbox" name="UF_SUBSCRIBE_USER_EMAIL" value="1" id="main-profile-subscribe" <?if($arResult["arUser"]["UF_SUBSCRIBE_USER_EMAIL"] == true) echo "checked";?>/>
<label class="form-check-label" for="main-profile-subscribe"><?=Loc::getMessage('SUBSCRIBE_EMAIL')?></label>
</div>
</div>
</div>
<div class="row">
<div class="col">
<input type="submit" class="btn btn-themes btn-primary btn-md main-profile-submit" name="save" value="<?=(($arResult["ID"]>0) ? Loc::getMessage("MAIN_SAVE") : Loc::getMessage("MAIN_ADD"))?>">
<input type="submit" class="btn btn-themes btn-link btn-md" name="reset" value="<?echo GetMessage("MAIN_RESET")?>">
</div>
</div>
</form>
<?
$disabledSocServices = isset($arParams['DISABLE_SOCSERV_AUTH']) && $arParams['DISABLE_SOCSERV_AUTH'] === 'Y';
if (!$disabledSocServices)
{
?>
<div class="col-sm-12 main-profile-social-block">
<?
if ($arResult["SOCSERV_ENABLED"])
{
$APPLICATION->IncludeComponent(
"bitrix:socserv.auth.split",
".default",
[
"SHOW_PROFILES" => "Y",
"ALLOW_DELETE" => "Y",
],
false
);
}
?>
</div>
<?
}
?>
<div class="clearfix"></div>
<script>
BX.Sale.PrivateProfileComponent.init();
</script>
</div>

View File

@ -0,0 +1,133 @@
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
if ($arParams["MAIN_CHAIN_NAME"] <> '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$this->addExternalCss("/bitrix/css/main/font-awesome.css");
$theme = Bitrix\Main\Config\Option::get("main", "wizard_eshop_bootstrap_theme_id", "blue", SITE_ID);
$availablePages = array();
if ($arParams['SHOW_ORDER_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_ORDERS'],
"name" => Loc::getMessage("SPS_ORDER_PAGE_NAME"),
"icon" => '<i class="fa fa-calculator"></i>'
);
}
if ($arParams['SHOW_ACCOUNT_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_ACCOUNT'],
"name" => Loc::getMessage("SPS_ACCOUNT_PAGE_NAME"),
"icon" => '<i class="fa fa-credit-card"></i>'
);
}
if ($arParams['SHOW_PRIVATE_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_PRIVATE'],
"name" => Loc::getMessage("SPS_PERSONAL_PAGE_NAME"),
"icon" => '<i class="fa fa-user-secret"></i>'
);
}
if ($arParams['SHOW_ORDER_PAGE'] === 'Y')
{
$delimeter = ($arParams['SEF_MODE'] === 'Y') ? "?" : "&";
$availablePages[] = array(
"path" => $arResult['PATH_TO_ORDERS'].$delimeter."filter_history=Y",
"name" => Loc::getMessage("SPS_ORDER_PAGE_HISTORY"),
"icon" => '<i class="fa fa-list-alt"></i>'
);
}
if ($arParams['SHOW_PROFILE_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_PROFILE'],
"name" => Loc::getMessage("SPS_PROFILE_PAGE_NAME"),
"icon" => '<i class="fa fa-list-ol"></i>'
);
}
if ($arParams['SHOW_BASKET_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arParams['PATH_TO_BASKET'],
"name" => Loc::getMessage("SPS_BASKET_PAGE_NAME"),
"icon" => '<i class="fa fa-shopping-cart"></i>'
);
}
if ($arParams['SHOW_SUBSCRIBE_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_SUBSCRIBE'],
"name" => Loc::getMessage("SPS_SUBSCRIBE_PAGE_NAME"),
"icon" => '<i class="fa fa-envelope"></i>'
);
}
if ($arParams['SHOW_CONTACT_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arParams['PATH_TO_CONTACT'],
"name" => Loc::getMessage("SPS_CONTACT_PAGE_NAME"),
"icon" => '<i class="fa fa-info-circle"></i>'
);
}
$customPagesList = CUtil::JsObjectToPhp($arParams['~CUSTOM_PAGES']);
if ($customPagesList)
{
foreach ($customPagesList as $page)
{
$availablePages[] = array(
"path" => $page[0],
"name" => $page[1],
"icon" => (mb_strlen($page[2])) ? '<i class="fa '.htmlspecialcharsbx($page[2]).'"></i>' : ""
);
}
}
if (empty($availablePages))
{
ShowError(Loc::getMessage("SPS_ERROR_NOT_CHOSEN_ELEMENT"));
}
else
{
?>
<div class="row">
<?
foreach ($availablePages as $blockElement)
{
?>
<div class="col-lg-3 col-md-6 col-sm-6 col">
<div class="sale-personal-section-index-block bx-theme-<?=$theme?>">
<a class="sale-personal-section-index-block-link" href="<?=htmlspecialcharsbx($blockElement['path'])?>">
<span class="sale-personal-section-index-block-ico">
<?=$blockElement['icon']?>
</span>
<h2 class="sale-personal-section-index-block-name">
<?=htmlspecialcharsbx($blockElement['name'])?>
</h2>
</a>
</div>
</div>
<?
}
?>
</div>
<?
}
?>

View File

@ -0,0 +1,6 @@
<?
$MESS["SPS_TITLE_ACCOUNT"] = "My Account";
$MESS["SPS_CHAIN_ACCOUNT"] = "Internal account";
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_BUY_MONEY"] = "Top up account";
?>

View File

@ -0,0 +1,13 @@
<?
$MESS["SPS_ACCOUNT_PAGE_NAME"] = "Personal account";
$MESS["SPS_PERSONAL_PAGE_NAME"] = "Personal information";
$MESS["SPS_PROFILE_PAGE_NAME"] = "Order profiles";
$MESS["SPS_ORDER_PAGE_NAME"] = "Current orders";
$MESS["SPS_ORDER_PAGE_HISTORY"] = "Order history";
$MESS["SPS_SUBSCRIBE_PAGE_NAME"] = "Subscriptions";
$MESS["SPS_BASKET_PAGE_NAME"] = "Shopping cart";
$MESS["SPS_CONTACT_PAGE_NAME"] = "Contacts";
$MESS["SPS_ERROR_NOT_CHOSEN_ELEMENT"] = "No items selected";
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_TITLE_MAIN"] = "Personal area";
?>

View File

@ -0,0 +1,5 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_ORDERS"] = "My orders";
$MESS["SPS_CHAIN_ORDER_DETAIL"] = "Cancel order ##ID#";
?>

View File

@ -0,0 +1,5 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_ORDERS"] = "My orders";
$MESS["SPS_CHAIN_ORDER_DETAIL"] = "Order information ##ID#";
?>

View File

@ -0,0 +1,4 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_ORDERS"] = "My orders";
?>

View File

@ -0,0 +1,4 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_ORDERS"] = "My orders";
?>

View File

@ -0,0 +1,5 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_PRIVATE"] = "Personal information";
$MESS["SPS_TITLE_PRIVATE"] = "Personal information";
?>

View File

@ -0,0 +1,5 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_PROFILE"] = "User profiles";
$MESS["SPS_TITLE_PROFILE"] = "User profile";
?>

View File

@ -0,0 +1,5 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_PROFILE"] = "User profiles";
$MESS["SPS_TITLE_PROFILE"] = "User profile";
?>

View File

@ -0,0 +1,5 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_PROFILE"] = "User profiles";
$MESS["SPS_TITLE_PROFILE"] = "User profile";
?>

View File

@ -0,0 +1,6 @@
<?
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_CHAIN_SUBSCRIBE"] = "User subscriptions";
$MESS["SPS_TITLE_SUBSCRIBE"] = "My subscriptions";
$MESS["SPS_CHAIN_SUBSCRIBE_NEW"] = "Your subscriptions";
?>

View File

@ -0,0 +1,13 @@
<?
$MESS["SPS_ACCOUNT_PAGE_NAME"] = "Personal account";
$MESS["SPS_PERSONAL_PAGE_NAME"] = "Personal information";
$MESS["SPS_PROFILE_PAGE_NAME"] = "Order profiles";
$MESS["SPS_ORDER_PAGE_NAME"] = "Current orders";
$MESS["SPS_ORDER_PAGE_HISTORY"] = "Order history";
$MESS["SPS_SUBSCRIBE_PAGE_NAME"] = "Subscriptions";
$MESS["SPS_BASKET_PAGE_NAME"] = "Shopping cart";
$MESS["SPS_CONTACT_PAGE_NAME"] = "Contacts";
$MESS["SPS_ERROR_NOT_CHOSEN_ELEMENT"] = "No items selected";
$MESS["SPS_CHAIN_MAIN"] = "My account";
$MESS["SPS_TITLE_MAIN"] = "Personal area";
?>

View File

@ -0,0 +1,5 @@
<?php
$MESS["SPS_TITLE_ACCOUNT"] = "Мои пользовательский счет";
$MESS["SPS_CHAIN_ACCOUNT"] = "Внутренний счет";
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_BUY_MONEY"] = "Пополнение счета";

View File

@ -0,0 +1,14 @@
<?php
$MESS["SPS_ACCOUNT_PAGE_NAME"] = "Личный счет";
$MESS["SPS_PERSONAL_PAGE_NAME"] = "Личные данные";
$MESS["SPS_PROFILE_PAGE_NAME"] = "Профили заказов";
$MESS["SPS_ORDER_PAGE_NAME"] = "Текущие заказы";
$MESS["SPS_ORDER_PAGE_HISTORY"] = "История заказов";
$MESS["SPS_SUBSCRIBE_PAGE_NAME"] = "Подписки";
$MESS["SPS_BASKET_PAGE_NAME"] = "Корзина";
$MESS["SPS_CONTACT_PAGE_NAME"] = "Контакты";
$MESS["SPS_ERROR_NOT_CHOSEN_ELEMENT"] = "Отсутвуют выбранные элементы";
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_TITLE_MAIN"] = "Персональный раздел";

View File

@ -0,0 +1,4 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_ORDERS"] = "Мои заказы";
$MESS["SPS_CHAIN_ORDER_DETAIL"] = "Отмена заказа №#ID#";

View File

@ -0,0 +1,4 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_ORDERS"] = "Мои заказы";
$MESS["SPS_CHAIN_ORDER_DETAIL"] = "Информация о заказе №#ID#";

View File

@ -0,0 +1,3 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_ORDERS"] = "Мои заказы";

View File

@ -0,0 +1,3 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_ORDERS"] = "Мои заказы";

View File

@ -0,0 +1,5 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_PRIVATE"] = "Персональные данные";
$MESS["SPS_TITLE_PRIVATE"] = "Персональные данные";
$MESS["SPS_ACCESS_DENIED"] = "Для просмотра личных данных необходимо авторизоваться.";

View File

@ -0,0 +1,4 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_PROFILE"] = "Список профилей пользователя";
$MESS["SPS_TITLE_PROFILE"] = "Профиль пользователя";

View File

@ -0,0 +1,4 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_PROFILE"] = "Список профилей пользователя";
$MESS["SPS_TITLE_PROFILE"] = "Профиль пользователя";

View File

@ -0,0 +1,4 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_PROFILE"] = "Список профилей пользователя";
$MESS["SPS_TITLE_PROFILE"] = "Профиль пользователя";

View File

@ -0,0 +1,5 @@
<?php
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_CHAIN_SUBSCRIBE"] = "Список подписок пользователя";
$MESS["SPS_TITLE_SUBSCRIBE"] = "Мои подписки";
$MESS["SPS_CHAIN_SUBSCRIBE_NEW"] = "Ваши подписки";

View File

@ -0,0 +1,14 @@
<?php
$MESS["SPS_ACCOUNT_PAGE_NAME"] = "Личный счет";
$MESS["SPS_PERSONAL_PAGE_NAME"] = "Личные данные";
$MESS["SPS_PROFILE_PAGE_NAME"] = "Профили заказов";
$MESS["SPS_ORDER_PAGE_NAME"] = "Текущие заказы";
$MESS["SPS_ORDER_PAGE_HISTORY"] = "История заказов";
$MESS["SPS_SUBSCRIBE_PAGE_NAME"] = "Подписки";
$MESS["SPS_BASKET_PAGE_NAME"] = "Корзина";
$MESS["SPS_CONTACT_PAGE_NAME"] = "Контакты";
$MESS["SPS_ERROR_NOT_CHOSEN_ELEMENT"] = "Отсутвуют выбранные элементы";
$MESS["SPS_CHAIN_MAIN"] = "Мой кабинет";
$MESS["SPS_TITLE_MAIN"] = "Персональный раздел";

View File

@ -0,0 +1,40 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_ORDER_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
elseif ($arParams['ORDER_DISALLOW_CANCEL'] === 'Y')
{
LocalRedirect($arResult['PATH_TO_ORDERS']);
}
global $USER;
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams["MAIN_CHAIN_NAME"] <> '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_ORDERS"), $arResult['PATH_TO_ORDERS']);
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_ORDER_DETAIL", array("#ID#" => $arResult["VARIABLES"]["ID"])));
$APPLICATION->IncludeComponent(
"bitrix:sale.personal.order.cancel",
"bootstrap_v4",
array(
"PATH_TO_LIST" => $arResult["PATH_TO_ORDERS"],
"PATH_TO_DETAIL" => $arResult["PATH_TO_ORDER_DETAIL"],
"AUTH_FORM_IN_TEMPLATE" => 'Y',
"SET_TITLE" =>$arParams["SET_TITLE"],
"ID" => $arResult["VARIABLES"]["ID"],
"CONTEXT_SITE_ID" => $arParams["CONTEXT_SITE_ID"],
),
$component
);
?>

View File

@ -0,0 +1,56 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_ORDER_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
global $USER;
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams["MAIN_CHAIN_NAME"] <> '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_ORDERS"), $arResult['PATH_TO_ORDERS']);
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_ORDER_DETAIL", array("#ID#" => urldecode($arResult["VARIABLES"]["ID"]))));
$arDetParams = array(
"PATH_TO_LIST" => $arResult["PATH_TO_ORDERS"],
"PATH_TO_CANCEL" => $arResult["PATH_TO_ORDER_CANCEL"],
"PATH_TO_COPY" => $arResult["PATH_TO_ORDER_COPY"],
"PATH_TO_PAYMENT" => $arParams["PATH_TO_PAYMENT"],
"SET_TITLE" =>$arParams["SET_TITLE"],
"ID" => $arResult["VARIABLES"]["ID"],
"ACTIVE_DATE_FORMAT" => $arParams["ACTIVE_DATE_FORMAT"],
"ALLOW_INNER" => $arParams["ALLOW_INNER"],
"ONLY_INNER_FULL" => $arParams["ONLY_INNER_FULL"],
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"CACHE_GROUPS" => $arParams["CACHE_GROUPS"],
"RESTRICT_CHANGE_PAYSYSTEM" => $arParams["ORDER_RESTRICT_CHANGE_PAYSYSTEM"],
"REFRESH_PRICES" => $arParams["ORDER_REFRESH_PRICES"],
"DISALLOW_CANCEL" => $arParams["ORDER_DISALLOW_CANCEL"],
"HIDE_USER_INFO" => $arParams["ORDER_HIDE_USER_INFO"],
"AUTH_FORM_IN_TEMPLATE" => 'Y',
"CONTEXT_SITE_ID" => $arParams["CONTEXT_SITE_ID"],
"CUSTOM_SELECT_PROPS" => $arParams["CUSTOM_SELECT_PROPS"]
);
foreach($arParams as $key => $val)
{
if(mb_strpos($key, "PROP_") !== false)
$arDetParams[$key] = $val;
}
$APPLICATION->IncludeComponent(
"bitrix:sale.personal.order.detail",
"bootstrap_v4",
$arDetParams,
$component
);
?>

View File

@ -0,0 +1,62 @@
<?php
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
{
die();
}
/** @var array $arParams */
/** @var array $arResult */
/** @var CBitrixComponent $component */
/** @global CMain $APPLICATION */
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_ORDER_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
global $USER;
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams["MAIN_CHAIN_NAME"] !== '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_ORDERS"), $arResult['PATH_TO_ORDERS']);
$APPLICATION->IncludeComponent(
"bitrix:sale.personal.order.list",
"bootstrap_v4",
array(
"PATH_TO_DETAIL" => $arResult["PATH_TO_ORDER_DETAIL"],
"PATH_TO_CANCEL" => $arResult["PATH_TO_ORDER_CANCEL"],
"PATH_TO_CATALOG" => $arParams["PATH_TO_CATALOG"],
"PATH_TO_COPY" => $arResult["PATH_TO_ORDER_COPY"],
"PATH_TO_BASKET" => $arParams["PATH_TO_BASKET"],
"PATH_TO_PAYMENT" => $arParams["PATH_TO_PAYMENT"],
"SAVE_IN_SESSION" => $arParams["SAVE_IN_SESSION"],
"ORDERS_PER_PAGE" => $arParams["ORDERS_PER_PAGE"],
"SET_TITLE" =>$arParams["SET_TITLE"],
"ID" => $arResult["VARIABLES"]["ID"],
"NAV_TEMPLATE" => $arParams["NAV_TEMPLATE"],
"ACTIVE_DATE_FORMAT" => $arParams["ACTIVE_DATE_FORMAT"],
"HISTORIC_STATUSES" => $arParams["ORDER_HISTORIC_STATUSES"],
"ALLOW_INNER" => $arParams["ALLOW_INNER"],
"ONLY_INNER_FULL" => $arParams["ONLY_INNER_FULL"],
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"CACHE_GROUPS" => $arParams["CACHE_GROUPS"],
"DEFAULT_SORT" => $arParams["ORDER_DEFAULT_SORT"],
"DISALLOW_CANCEL" => $arParams["ORDER_DISALLOW_CANCEL"],
"RESTRICT_CHANGE_PAYSYSTEM" => $arParams["ORDER_RESTRICT_CHANGE_PAYSYSTEM"],
"REFRESH_PRICES" => $arParams["ORDER_REFRESH_PRICES"],
"CONTEXT_SITE_ID" => $arParams["CONTEXT_SITE_ID"],
"AUTH_FORM_IN_TEMPLATE" => 'Y',
),
$component
);

View File

@ -0,0 +1,119 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
{
die();
}
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @var PersonalOrderSection $component */
/** @var array $arParams */
/** @var array $arResult */
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_PRIVATE_PAGE'] !== 'Y' && $arParams['USE_PRIVATE_PAGE_TO_AUTH'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
if ($arParams["MAIN_CHAIN_NAME"] !== '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_PRIVATE"));
if ($arParams['SET_TITLE'] == 'Y')
{
$APPLICATION->SetTitle(Loc::getMessage("SPS_TITLE_PRIVATE"));
}
if (!$USER->IsAuthorized() || $arResult['SHOW_LOGIN_FORM'] === 'Y')
{
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] !== 'Y')
{
ob_start();
$APPLICATION->AuthForm('', false, false, 'N', false);
$authForm = ob_get_clean();
}
else
{
if ($arResult['SHOW_FORGOT_PASSWORD_FORM'] === 'Y')
{
ob_start();
$APPLICATION->IncludeComponent(
'bitrix:main.auth.forgotpasswd',
'.default',
array(
'AUTH_AUTH_URL' => $arResult['PATH_TO_PRIVATE'],
// 'AUTH_REGISTER_URL' => 'register.php',
),
false
);
$authForm = ob_get_clean();
}
elseif($arResult['SHOW_CHANGE_PASSWORD_FORM'] === 'Y')
{
ob_start();
$APPLICATION->IncludeComponent(
'bitrix:main.auth.changepasswd',
'.default',
array(
'AUTH_AUTH_URL' => $arResult['PATH_TO_PRIVATE'],
// 'AUTH_REGISTER_URL' => 'register.php',
),
false
);
$authForm = ob_get_clean();
}
else
{
ob_start();
$APPLICATION->IncludeComponent(
'bitrix:main.auth.form',
'.default',
array(
'AUTH_FORGOT_PASSWORD_URL' => $arResult['PATH_TO_PASSWORD_RESTORE'],
// 'AUTH_REGISTER_URL' => 'register.php',
'AUTH_SUCCESS_URL' => $arResult['AUTH_SUCCESS_URL'],
'DISABLE_SOCSERV_AUTH' => $arParams['DISABLE_SOCSERV_AUTH'],
),
false
);
$authForm = ob_get_clean();
}
}
?>
<div class="row">
<?
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] !== 'Y')
{
?>
<div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
<div class="alert alert-danger"><?=GetMessage("SPS_ACCESS_DENIED")?></div>
</div>
<?
}
?>
<div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
<?=$authForm?>
</div>
</div>
<?
}
else
{
$APPLICATION->IncludeComponent(
"bitrix:main.profile",
"",
Array(
"SET_TITLE" =>$arParams["SET_TITLE"],
"AJAX_MODE" => $arParams['AJAX_MODE_PRIVATE'],
"SEND_INFO" => $arParams["SEND_INFO_PRIVATE"],
"CHECK_RIGHTS" => $arParams['CHECK_RIGHTS_PRIVATE'],
"EDITABLE_EXTERNAL_AUTH_ID" => $arParams['EDITABLE_EXTERNAL_AUTH_ID'],
"DISABLE_SOCSERV_AUTH" => $arParams['DISABLE_SOCSERV_AUTH']
),
$component
);
}

View File

@ -0,0 +1,42 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
{
die();
}
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @var PersonalOrderSection $component */
/** @var array $arParams */
/** @var array $arResult */
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_PROFILE_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
global $USER;
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams["MAIN_CHAIN_NAME"] !== '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_PROFILE"));
$APPLICATION->IncludeComponent(
"bitrix:sale.personal.profile.list",
"bootstrap_v4",
[
"PATH_TO_DETAIL" => $arResult['PATH_TO_PROFILE_DETAIL'],
"PATH_TO_DELETE" => $arResult['PATH_TO_PROFILE_DELETE'],
"PER_PAGE" => $arParams["PROFILES_PER_PAGE"],
"SET_TITLE" =>$arParams["SET_TITLE"],
"AUTH_FORM_IN_TEMPLATE" => 'Y',
],
$component
);

View File

@ -0,0 +1,35 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_PROFILE_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
global $USER;
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams["MAIN_CHAIN_NAME"] <> '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_PROFILE"));
$APPLICATION->IncludeComponent(
"bitrix:sale.personal.profile.detail",
"bootstrap_v4",
array(
"PATH_TO_LIST" => $arResult["PATH_TO_PROFILE"],
"PATH_TO_DETAIL" => $arResult["PATH_TO_PROFILE_DETAIL"],
"SET_TITLE" =>$arParams["SET_TITLE"],
"USE_AJAX_LOCATIONS" => $arParams['USE_AJAX_LOCATIONS_PROFILE'],
"COMPATIBLE_LOCATION_MODE" => $arParams['COMPATIBLE_LOCATION_MODE_PROFILE'],
"ID" => $arResult["VARIABLES"]["ID"],
"AUTH_FORM_IN_TEMPLATE" => 'Y',
),
$component
);
?>

View File

@ -0,0 +1,49 @@
.sale-personal-section-index-block {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin: 15px 0;
padding: 0;
height: 87%;
border-radius: 3px;
background-size: cover;
color: #fff;
text-align: center;
text-transform: uppercase;
opacity: .8;
transition: all 0.3s;
justify-content: space-around;
background-color: var(--theme-color-primary, #51cbce);
}
@media (max-width: 992px) {
.sale-personal-section-index-block {
margin: 8px 0;
height: auto;
}
}
.sale-personal-section-index-block:hover { opacity: 1; }
.sale-personal-section-index-block-link,
.sale-personal-section-index-block-link:hover,
.sale-personal-section-index-block-link:active,
.sale-personal-section-index-block-link:focus,
.sale-personal-section-index-block-link:visited {
display: block;
padding: 25px 5px;
width: 100%;
color: #fff;
text-decoration: none;
}
.sale-personal-section-index-block-link { color: #fff; }
.sale-personal-section-index-block-ico { font-size: 64px; }
.sale-personal-section-index-block-name {
color: #fff;
font-size: 15px;
margin: 0;
padding: 0;
}

View File

@ -0,0 +1 @@
.sale-personal-section-index-block{display:-webkit-box;display:-ms-flexbox;display:flex;margin:15px 0;padding:0;height:87%;border-radius:3px;background-size:cover;color:#fff;text-align:center;text-transform:uppercase;opacity:.8;transition:all .3s;justify-content:space-around;background-color:var(--theme-color-primary,#51cbce)}@media(max-width:992px){.sale-personal-section-index-block{margin:8px 0;height:auto}}.sale-personal-section-index-block:hover{opacity:1}.sale-personal-section-index-block-link,.sale-personal-section-index-block-link:hover,.sale-personal-section-index-block-link:active,.sale-personal-section-index-block-link:focus,.sale-personal-section-index-block-link:visited{display:block;padding:25px 5px;width:100%;color:#fff;text-decoration:none}.sale-personal-section-index-block-link{color:#fff}.sale-personal-section-index-block-ico{font-size:64px}.sale-personal-section-index-block-name{color:#fff;font-size:15px;margin:0;padding:0}

View File

@ -0,0 +1,31 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
if ($arParams['SHOW_SUBSCRIBE_PAGE'] !== 'Y')
{
LocalRedirect($arParams['SEF_FOLDER']);
}
global $USER;
if ($arParams['USE_PRIVATE_PAGE_TO_AUTH'] === 'Y' && !$USER->IsAuthorized())
{
LocalRedirect($arResult['PATH_TO_AUTH_PAGE']);
}
if ($arParams["MAIN_CHAIN_NAME"] <> '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$APPLICATION->AddChainItem(Loc::getMessage("SPS_CHAIN_SUBSCRIBE_NEW"));
$APPLICATION->IncludeComponent(
'bitrix:catalog.product.subscribe.list',
"bootstrap_v4",
array(
'SET_TITLE' => $arParams['SET_TITLE'],
'DETAIL_URL' => $arParams['SUBSCRIBE_DETAIL_URL']
),
$component
);

View File

@ -0,0 +1,132 @@
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
if ($arParams["MAIN_CHAIN_NAME"] <> '')
{
$APPLICATION->AddChainItem(htmlspecialcharsbx($arParams["MAIN_CHAIN_NAME"]), $arResult['SEF_FOLDER']);
}
$this->addExternalCss("/bitrix/css/main/font-awesome.css");
$theme = Bitrix\Main\Config\Option::get("main", "wizard_eshop_bootstrap_theme_id", "blue", SITE_ID);
$availablePages = array();
if ($arParams['SHOW_ORDER_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_ORDERS'],
"name" => Loc::getMessage("SPS_ORDER_PAGE_NAME"),
"icon" => '<i class="fa fa-calculator"></i>'
);
}
if ($arParams['SHOW_ACCOUNT_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_ACCOUNT'],
"name" => Loc::getMessage("SPS_ACCOUNT_PAGE_NAME"),
"icon" => '<i class="fa fa-credit-card"></i>'
);
}
if ($arParams['SHOW_PRIVATE_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_PRIVATE'],
"name" => Loc::getMessage("SPS_PERSONAL_PAGE_NAME"),
"icon" => '<i class="fa fa-user-secret"></i>'
);
}
if ($arParams['SHOW_ORDER_PAGE'] === 'Y')
{
$delimeter = ($arParams['SEF_MODE'] === 'Y') ? "?" : "&";
$availablePages[] = array(
"path" => $arResult['PATH_TO_ORDERS'].$delimeter."filter_history=Y",
"name" => Loc::getMessage("SPS_ORDER_PAGE_HISTORY"),
"icon" => '<i class="fa fa-list-alt"></i>'
);
}
if ($arParams['SHOW_PROFILE_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_PROFILE'],
"name" => Loc::getMessage("SPS_PROFILE_PAGE_NAME"),
"icon" => '<i class="fa fa-list-ol"></i>'
);
}
if ($arParams['SHOW_BASKET_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arParams['PATH_TO_BASKET'],
"name" => Loc::getMessage("SPS_BASKET_PAGE_NAME"),
"icon" => '<i class="fa fa-shopping-cart"></i>'
);
}
if ($arParams['SHOW_SUBSCRIBE_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arResult['PATH_TO_SUBSCRIBE'],
"name" => Loc::getMessage("SPS_SUBSCRIBE_PAGE_NAME"),
"icon" => '<i class="fa fa-envelope"></i>'
);
}
if ($arParams['SHOW_CONTACT_PAGE'] === 'Y')
{
$availablePages[] = array(
"path" => $arParams['PATH_TO_CONTACT'],
"name" => Loc::getMessage("SPS_CONTACT_PAGE_NAME"),
"icon" => '<i class="fa fa-info-circle"></i>'
);
}
$customPagesList = CUtil::JsObjectToPhp($arParams['~CUSTOM_PAGES']);
if ($customPagesList)
{
foreach ($customPagesList as $page)
{
$availablePages[] = array(
"path" => $page[0],
"name" => $page[1],
"icon" => (mb_strlen($page[2])) ? '<i class="fa '.htmlspecialcharsbx($page[2]).'"></i>' : ""
);
}
}
if (empty($availablePages))
{
ShowError(Loc::getMessage("SPS_ERROR_NOT_CHOSEN_ELEMENT"));
}
else
{
?>
<div class="row">
<? foreach ($availablePages as $blockElement)
{
?>
<div class="col-lg-3 col-md-4 col-6">
<div class="sale-personal-section-index-block bx-<?=$theme?>">
<a class="sale-personal-section-index-block-link" href="<?=htmlspecialcharsbx($blockElement['path'])?>">
<span class="sale-personal-section-index-block-ico">
<?=$blockElement['icon']?>
</span>
<h2 class="sale-personal-section-index-block-name">
<?=htmlspecialcharsbx($blockElement['name'])?>
</h2>
</a>
</div>
</div>
<?
}
?>
</div>
<?
}
?>

View File

@ -0,0 +1,21 @@
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
$APPLICATION->SetTitle('Регистрация');
?>
<?php $APPLICATION->IncludeComponent(
'bitrix:main.register',
'default_subscribe',
[
'AUTH' => 'Y',
'REQUIRED_FIELDS' => [],
'SET_TITLE' => 'Y',
'SHOW_FIELDS' => ['NAME'],
'SUCCESS_PAGE' => '',
'USER_PROPERTY' => [],
'USER_PROPERTY_NAME' => '',
'USE_BACKURL' => 'Y',
]
); ?>
<?php require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/footer.php'); ?>

View File

@ -14,7 +14,7 @@ use Bitrix\Sale\Delivery\Services\Manager;
use Bitrix\Sale\EventActions;
use Bitrix\Sale\Internals\OrderTable;
use Intaro\RetailCrm\Component\ConfigProvider;
use Intaro\RetailCrm\Component\Installer\LoyaltyInstallerTrait;
use Intaro\RetailCrm\Component\Installer\InstallerTrait;
use Intaro\RetailCrm\Service\OrderLoyaltyDataService;
use Intaro\RetailCrm\Vendor\Symfony\Component\Process\PhpExecutableFinder;
use RetailCrm\ApiClient;
@ -29,11 +29,11 @@ if (class_exists('intaro_retailcrm')) {
return false;
}
include(__DIR__ . '/../lib/component/installer/loyaltyinstallertrait.php');
include (__DIR__ . '/../lib/component/installer/installertrait.php');
class intaro_retailcrm extends CModule
{
use LoyaltyInstallerTrait;
use InstallerTrait;
public const V5 = 'v5';
public $MODULE_ID = 'intaro.retailcrm';
@ -247,9 +247,9 @@ class intaro_retailcrm extends CModule
include($this->INSTALL_PATH . '/../lib/component/apiclient/clientadapter.php');
$this->CopyFiles();
$this->addLPUserFields();
$this->addLPEvents();
$this->addEvents();
$this->addAgreement();
$this->addUserFields();
OrderLoyaltyDataService::createLoyaltyHlBlock();
@ -1069,6 +1069,9 @@ class intaro_retailcrm extends CModule
RegisterModuleDependences('sale', 'OnSaleOrderDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'orderDelete');
RegisterModuleDependences('sale', 'OnSalePaymentEntitySaved', $this->MODULE_ID, 'RetailCrmEvent', 'paymentSave');
RegisterModuleDependences('sale', 'OnSalePaymentEntityDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'paymentDelete');
RegisterModuleDependences('main', 'OnAfterUserRegister', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserRegister');
RegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd');
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
COption::SetOptionString($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD, 'N');
@ -1266,6 +1269,8 @@ class intaro_retailcrm extends CModule
UnRegisterModuleDependences('main', 'OnBeforeProlog', $this->MODULE_ID, 'RetailCrmUa', 'add');
UnRegisterModuleDependences('sale', 'OnSalePaymentEntitySaved', $this->MODULE_ID, 'RetailCrmEvent', 'paymentSave');
UnRegisterModuleDependences('sale', 'OnSalePaymentEntityDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'paymentDelete');
UnRegisterModuleDependences('main', 'OnAfterUserRegister', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserRegister');
UnRegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd');
if (
CModule::IncludeModule('catalog')

View File

@ -1,6 +1,6 @@
<?php
$arModuleVersion = [
'VERSION' => '6.3.20',
'VERSION_DATE' => '2023-07-25 13:00:00'
'VERSION' => '6.4.0',
'VERSION_DATE' => '2023-08-22 13:00:00'
];

View File

@ -0,0 +1,4 @@
<?php
$MESS['SUBSCRIBED_USER'] = 'User subscribed to mailing lists';
$MESS['UNSUBSCRIBED_USER'] = 'User unsubscribed from mailing lists';

View File

@ -16,3 +16,4 @@ $MESS ['RETAILCRM_CURL_ERR'] = 'RetailCRM integration module requires PHP CURL e
$MESS ['ERR_ARTICLE_IBLOCK'] = 'Articles are not set';
$MESS ['DATE_TIMEZONE_ERR'] = 'Timezone is not specified in php settings.';
$MESS ['SALE_VERSION_ERR'] = '\'Online-store\' module version must be higher than 16.';
$MESS['UF_SUBSCRIBE_USER_EMAIL_TITLE'] = 'Agree to receive promotional newsletters';

View File

@ -0,0 +1,4 @@
<?php
$MESS['SUBSCRIBED_USER'] = 'Пользователь подписался на рассылки';
$MESS['UNSUBSCRIBED_USER'] = 'Пользователь отписался от рассылок';

View File

@ -54,4 +54,5 @@ $MESS ['UF_CARD_NUMBER_INTARO_TITLE'] = 'Номер карты программ
$MESS ['UF_LP_ID_INTARO_TITLE'] = 'Номер аккаунта в программе лояльности';
$MESS['IBLOCK_NOT_SELECTED'] = 'Не выбрано ни одного инфоблока для экспорта';
$MESS['TARGET_DIR_DOESNT_EXIST'] = 'Целевая директория не существует';
$MESS['UF_SUBSCRIBE_USER_EMAIL_TITLE'] = 'Согласен на рекламно-информационные рассылки';

View File

@ -99,6 +99,7 @@ trait CustomersTrait
public function customersCreate(CustomersCreateRequest $request): ?CustomerChangeResponse
{
$serialized = Serializer::serializeArray($request);
$serialized = $this->setBooleanParameters($serialized);
$response = $this->client->customersCreate($serialized['customer'] ?? [], $request->site);
return Deserializer::deserializeArray($response->getResponseBody(), CustomerChangeResponse::class);
@ -182,4 +183,18 @@ trait CustomersTrait
return Deserializer::deserializeArray($response->getResponseBody(), HistoryResponse::class);
}
/**
* @param array $serializedRequest
* @return array
*/
private function setBooleanParameters($serializedRequest)
{
if (empty($serializedRequest['customer']['subscribed']))
{
$serializedRequest['customer']['subscribed'] = false;
}
return $serializedRequest;
}
}

View File

@ -162,7 +162,7 @@ class CustomerBuilder implements BuilderInterface
$this->customer->externalId = $this->user->getId();
$this->customer->email = $this->user->getEmail();
$this->customer->createdAt = $this->user->getDateRegister();
$this->customer->subscribed = false;
$this->customer->subscribed = !empty($this->user->getSubscribe());
}
/**

View File

@ -101,7 +101,6 @@ class Constants
public const LP_EVENTS = [
['EVENT_NAME' => 'OnSaleOrderSaved', 'FROM_MODULE' => 'sale'],
['EVENT_NAME' => 'OnSaleComponentOrderResultPrepared', 'FROM_MODULE' => 'sale'],
['EVENT_NAME' => 'OnAfterUserRegister', 'FROM_MODULE' => 'main'],
];
public const SITES_AVAILABLE = 'sites_available';
}

View File

@ -214,51 +214,4 @@ class EventsHandlers
Logger::getInstance()->write(GetMessage('CAN_NOT_SAVE_ORDER') . $exception->getMessage(), 'uploadApiErrors');
}
}
/**
* Регистрирует пользователя в CRM системе после регистрации на сайте
*
* @param array $arFields
* @return mixed
* @throws \ReflectionException
*/
public static function OnAfterUserRegisterHandler(array $arFields): void
{
if (isset($arFields['USER_ID']) && $arFields['USER_ID'] > 0) {
$user = UserRepository::getById($arFields['USER_ID']);
if (isset($_POST['REGISTER']['PERSONAL_PHONE'])) {
$phone = htmlspecialchars($_POST['REGISTER']['PERSONAL_PHONE']);
if ($user !== null) {
$user->setPersonalPhone($phone);
$user->save();
}
$arFields['PERSONAL_PHONE'] = $phone;
}
/* @var CustomerService $customerService */
$customerService = ServiceLocator::get(CustomerService::class);
$customer = $customerService->createModel($arFields['USER_ID']);
$customerService->createOrUpdateCustomer($customer);
//Если пользователь выразил желание зарегистрироваться в ПЛ и согласился со всеми правилами
if ((int) $arFields['UF_REG_IN_PL_INTARO'] === 1
&& (int) $arFields['UF_AGREE_PL_INTARO'] === 1
&& (int) $arFields['UF_PD_PROC_PL_INTARO'] === 1
) {
$phone = $arFields['PERSONAL_PHONE'] ?? '';
$card = $arFields['UF_CARD_NUM_INTARO'] ?? '';
$customerId = (string) $arFields['USER_ID'];
/** @var LoyaltyAccountService $service */
$service = ServiceLocator::get(LoyaltyAccountService::class);
$createResponse = $service->createLoyaltyAccount($phone, $card, $customerId);
$service->activateLpUserInBitrix($createResponse, $arFields['USER_ID']);
}
}
}
}

View File

@ -1,16 +1,5 @@
<?php
/**
* PHP version 7.1
*
* @category Integration
* @package Intaro\RetailCrm\Component\Update
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
namespace Intaro\RetailCrm\Component\Installer;
use Bitrix\Main\ArgumentException;
@ -28,12 +17,12 @@ use RCrmActions;
IncludeModuleLangFile(__FILE__);
trait LoyaltyInstallerTrait
trait InstallerTrait
{
/**
* create loyalty program events handlers
* Создание событий для программы лояльности
*/
public function addLPEvents(): void
public function addEvents(): void
{
$eventManager = EventManager::getInstance();
@ -69,7 +58,7 @@ trait LoyaltyInstallerTrait
}
/**
* CamelCase в имени является требованием Bitrix. Изменить на lowerCamelCase нельзя
* Перемещение модульных шаблонов в CMS
*/
public function CopyFiles(): void
{
@ -83,37 +72,45 @@ trait LoyaltyInstallerTrait
false
);
$lpTemplateNames = [
'sale.order.ajax',
'sale.basket.basket',
'main.register',
$templateNames = [
'default_loyalty' => [
0 => [
'name' => 'sale.order.ajax',
'templateDirectory' => '.default'
],
1 => [
'name' => 'sale.basket.basket',
'templateDirectory' => '.default'
],
2 => [
'name' => 'main.register',
'templateDirectory' => '.default'
],
],
'default_subscribe' => [
0 => [
'name' => 'sale.personal.section',
'templateDirectory' => '.default'
],
1 => [
'name' => 'main.register',
'templateDirectory' => '.default_subscribe'
]
]
];
foreach ($lpTemplateNames as $lpTemplateName){
$lpTemplatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $lpTemplateName . '/default_loyalty';
if (!file_exists($lpTemplatePath)) {
$pathFrom = $_SERVER['DOCUMENT_ROOT']
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
. $lpTemplateName
. '/templates/.default';
CopyDirFiles(
$pathFrom,
$lpTemplatePath,
true,
true,
false
);
foreach ($templateNames as $directory => $templates) {
foreach ($templates as $template) {
$this->copy($directory, $template);
}
}
}
/**
* Add USER fields for LP
* Добавление полей пользователя для ПЛ и подписки
*/
public function addLPUserFields(): void
public function addUserFields(): void
{
$this->addCustomUserFields(
[
@ -154,6 +151,10 @@ trait LoyaltyInstallerTrait
'name' => 'UF_EXT_REG_PL_INTARO',
'title' => GetMessage('UF_EXT_REG_PL_INTARO_TITLE'),
],
[
'name' => 'UF_SUBSCRIBE_USER_EMAIL',
'title' => GetMessage('UF_SUBSCRIBE_USER_EMAIL_TITLE')
]
]
);
}
@ -248,4 +249,27 @@ trait LoyaltyInstallerTrait
);
}
}
private function copy($directory, $template): void
{
$templatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/'. $directory
;
if (!file_exists($templatePath)) {
$pathFrom = $_SERVER['DOCUMENT_ROOT']
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
. $template['name']
. '/templates/' . $template['templateDirectory']
;
CopyDirFiles(
$pathFrom,
$templatePath,
true,
true,
false
);
}
}
}

View File

@ -524,6 +524,14 @@ class User extends AbstractSerializableModel
*/
private $loyalty;
/**
* @var bool
*
* @Mapping\Type("boolean")
* @Mapping\SerializedName("UF_SUBSCRIBE_USER_EMAIL")
*/
private $subscribe;
/**
* @return int
*/
@ -1730,4 +1738,24 @@ class User extends AbstractSerializableModel
{
$this->loyalty = $loyalty;
}
/**
* @return bool
*/
public function getSubscribe()
{
return $this->subscribe;
}
/**
* @param bool $subscribe
* @return $this
*/
public function setSubscribe($subscribe)
{
$this->subscribe = $subscribe;
return $this;
}
}

View File

@ -1074,6 +1074,102 @@ class LoyaltyProgramUpdater
}
}
class UpdateSubscribe
{
public function CopyFiles(): self
{
$pathFrom = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/intaro.retailcrm/install';
CopyDirFiles(
$pathFrom . '/export',
$_SERVER['DOCUMENT_ROOT'],
true,
true,
false
);
$templateNames = [
'default_subscribe' => [
0 => [
'name' => 'sale.personal.section',
'templateDirectory' => '.default'
],
1 => [
'name' => 'main.register',
'templateDirectory' => '.default_subscribe'
]
]
];
foreach ($templateNames as $directory => $templates) {
foreach ($templates as $template) {
$templatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/' . $directory
;
if (!file_exists($templatePath)) {
$pathFrom = $_SERVER['DOCUMENT_ROOT']
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
. $template['name']
. '/templates/' . $template['templateDirectory']
;
CopyDirFiles(
$pathFrom,
$templatePath,
true,
true,
false
);
}
}
}
return $this;
}
public function addEvent(): self
{
$eventManager = EventManager::getInstance();
$eventManager->unRegisterEventHandler(
'main',
'OnAfterUserRegister',
'intaro.retailcrm',
'Intaro\RetailCrm\Component\Handlers\EventsHandlers',
'OnAfterUserRegisterHandler'
);
RegisterModuleDependences('main', 'OnAfterUserRegister', 'intaro.retailcrm', 'RetailCrmEvent', 'OnAfterUserRegister');
RegisterModuleDependences('main', 'OnAfterUserAdd', 'intaro.retailcrm', 'RetailCrmEvent', 'OnAfterUserAdd');
return $this;
}
public function addCustomUserField(): self
{
$arProps = [
'ENTITY_ID' => 'USER',
'FIELD_NAME' => 'UF_SUBSCRIBE_USER_EMAIL',
'USER_TYPE_ID' => 'boolean',
'MULTIPLE' => 'N',
'MANDATORY' => 'N',
'EDIT_FORM_LABEL' => ['ru' => 'Подписка на события'],
];
$props = array_merge($arProps, []);
$obUserField = new CUserTypeEntity();
$dbRes = CUserTypeEntity::GetList([], ['FIELD_NAME' => 'UF_SUBSCRIBE_USER_EMAIL'])->fetch();
if (!$dbRes['ID']) {
$obUserField->Add($props);
}
return $this;
}
}
/**
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\ObjectPropertyException
@ -1093,6 +1189,11 @@ function update()
UnRegisterModuleDependences("main", "OnBeforeProlog", 'intaro.retailcrm', "RetailCrmPricePrchase", "add");
UnRegisterModuleDependences("main", "OnBeforeProlog", 'intaro.retailcrm', "RetailCrmDc", "add");
UnRegisterModuleDependences("main", "OnBeforeProlog", 'intaro.retailcrm', "RetailCrmCc", "add");
(new UpdateSubscribe())
->CopyFiles()
->addEvent()
->addCustomUserField();
}
try {