Created
September 30, 2021 06:12
-
-
Save DariaUshaeva/ee4efc63c5a8cc475609c8e48a8de018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/design/themes/responsive/templates/common/product_data.tpl b/design/themes/responsive/templates/common/product_data.tpl | |
index e1e5847efa..923014792c 100644 | |
--- a/design/themes/responsive/templates/common/product_data.tpl | |
+++ b/design/themes/responsive/templates/common/product_data.tpl | |
@@ -162,7 +162,7 @@ | |
<input type="hidden" name="product_id" value="{$product.product_id}" disabled /> | |
<label id="product_notify_email_label" for="product_notify_email_{$obj_prefix}{$obj_id}" class="cm-required cm-email hidden">{__("email")}</label> | |
- <input type="text" name="email" id="product_notify_email_{$obj_prefix}{$obj_id}" size="20" value="{$product_notification_email|default:__("enter_email")}" class="ty-product-notify-email__input cm-hint" title="{__("enter_email")}" disabled /> | |
+ <input type="text" name="email" id="product_notify_email_{$obj_prefix}{$obj_id}" size="20" value="{$product_notification_email}" placeholder="{__("enter_email")}" class="ty-product-notify-email__input cm-hint" title="{__("enter_email")}" disabled /> | |
<button class="ty-btn-go cm-ajax" type="submit" name="dispatch[products.product_notifications]" title="{__("go")}"><i class="ty-btn-go__icon ty-icon-right-dir"></i></button> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/core/src/core/Tygh/plugins/back_in_stock_notification_switcher/index.js b/js/core/src/core/Tygh/plugins/back_in_stock_notification_switcher/index.js | |
index 27f998adaa..578855a9fb 100644 | |
--- a/js/core/src/core/Tygh/plugins/back_in_stock_notification_switcher/index.js | |
+++ b/js/core/src/core/Tygh/plugins/back_in_stock_notification_switcher/index.js | |
@@ -12,14 +12,28 @@ export const methods = { | |
objPrefix = $self.data('caProductObjectPrefix'), | |
objId = $self.data('caProductId'), | |
isChecked = $self.prop('checked'); | |
- | |
+ let email = ''; | |
+ | |
+ if (!authUserId) { | |
+ const $emailFiled = $(`#product_notify_email_${objPrefix}${objId}`); | |
+ | |
+ if ($emailFiled.length) { | |
+ const placeholderEmail = $emailFiled.attr('placeholder'), | |
+ emailVal = $emailFiled.val(); | |
+ | |
+ email = (emailVal.length && (emailVal !== placeholderEmail)) ? '&email=' + emailVal : email; | |
+ | |
+ if (!email.length) { | |
+ return; | |
+ } | |
+ } | |
+ } | |
+ | |
if (authUserId || !isChecked) { | |
- const isValidForm = $(`[name="product_form_${objPrefix}${objId}"]`).ceFormValidator('checkFields', true, false, true); | |
- | |
+ const isValidForm = $(`[name="product_form_${objPrefix}${objId}"]`).ceFormValidator('checkFields', true, false, true), | |
+ checked = isChecked ? 'Y' : 'N'; | |
+ | |
if (isValidForm) { | |
- const checked = isChecked ? 'Y' : 'N', | |
- email = $(`#product_notify_email_${objPrefix}${objId}`).length ? '&email=' + $(`#product_notify_email_${objPrefix}${objId}`).val() : ''; | |
- | |
$.ceAjax('request', fn_url(`products.product_notifications?enable=${checked}&product_id=${objId}${email}`), { | |
caching: false, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment