diff --git a/resources/pot/retailcrm-ru_RU.pot b/resources/pot/retailcrm-ru_RU.pot index cadd305..0d17715 100644 --- a/resources/pot/retailcrm-ru_RU.pot +++ b/resources/pot/retailcrm-ru_RU.pot @@ -474,3 +474,6 @@ msgstr "Условия обработки персональных данных" msgid "Insert the terms and conditions for processing personal data" msgstr "Вставьте условия обработки персональных данных" + +msgid "To activate the loyalty program it is necessary to activate the work with coupons!" +msgstr "Для активации программы лояльности необходимо активировать работу с купонами!" diff --git a/src/assets/js/retailcrm-loyalty.js b/src/assets/js/retailcrm-loyalty.js index 84006e2..c043d51 100644 --- a/src/assets/js/retailcrm-loyalty.js +++ b/src/assets/js/retailcrm-loyalty.js @@ -20,12 +20,16 @@ jQuery(function() { }) .done(function (response) { if (response.coupon_status !== 'yes') { - alert('lol'); var checkElement = jQuery('#woocommerce_integration-retailcrm_loyalty'); checkElement.parent().css('color', 'red'); checkElement.css('border-color', 'red'); - checkElement.parent().parent().append("

Test

"); checkElement.prop('checked', false); + + if (!jQuery('#coupon_warning').length) { + checkElement.parent().parent().append( + "

" + response.translate.coupon_warning + "

" + ); + } } }) } diff --git a/src/include/class-wc-retailcrm-base.php b/src/include/class-wc-retailcrm-base.php index 42b9258..2d8843b 100644 --- a/src/include/class-wc-retailcrm-base.php +++ b/src/include/class-wc-retailcrm-base.php @@ -604,7 +604,16 @@ if (!class_exists('WC_Retailcrm_Base')) { public function get_status_coupon() { - echo json_encode(['coupon_status' => get_option('woocommerce_enable_coupons')]); + echo json_encode( + [ + 'coupon_status' => get_option('woocommerce_enable_coupons'), + 'translate' => [ + 'coupon_warning' => __( + 'To activate the loyalty program it is necessary to activate the work with coupons!', + 'retailcrm' + ) + ] + ]); wp_die(); }