diff --git a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php index 69faad47..c9bdd8d6 100644 --- a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php +++ b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php @@ -81,3 +81,4 @@ $MESS["SEC"] = "сек."; $MESS["RESEND_SMS"] = "Отправить смс повторно"; $MESS["RESEND_POSSIBLE"] = "Повторная отправка смс возможна через"; $MESS["LOYALTY_CONNECTION_ERROR"] = "Возникли проблемы с подключением к удаленному серверу. Попробуйте перезагрузить страницу."; +$MESS["SUBSCRIBE_EMAIL"] = "Подписаться на события"; diff --git a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php index 4ae8931c..7f0a9e74 100644 --- a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php +++ b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php @@ -540,6 +540,19 @@ if ($arResult["LOYALTY_CONNECTION_ERROR"] === true) { :* + + + + +
+
+ +
+
+ + SetTitle('Регистрация'); +?> + +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', + ] +); ?> + + diff --git a/intaro.retailcrm/lib/component/builder/api/customerbuilder.php b/intaro.retailcrm/lib/component/builder/api/customerbuilder.php index 0a1c9bbe..2f022fb0 100644 --- a/intaro.retailcrm/lib/component/builder/api/customerbuilder.php +++ b/intaro.retailcrm/lib/component/builder/api/customerbuilder.php @@ -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()); } /** diff --git a/intaro.retailcrm/lib/model/bitrix/user.php b/intaro.retailcrm/lib/model/bitrix/user.php index 757057c3..1fb2ae11 100644 --- a/intaro.retailcrm/lib/model/bitrix/user.php +++ b/intaro.retailcrm/lib/model/bitrix/user.php @@ -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; + } }