From c0ff7028f2913c9e7c99de3aee7664108f0f78ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=A7=D0=B0=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2?= <45812598+Chazovs@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:12:06 +0300 Subject: [PATCH] Online Consultant --- resources/pot/retailcrm-es_ES.pot | 6 +++++ resources/pot/retailcrm-ru_RU.pot | 6 +++++ .../class-wc-retailcrm-abstracts-settings.php | 24 ++++++++++++++++++ src/include/class-wc-retailcrm-base.php | 13 +++++++++- src/languages/retailcrm-es_ES.mo | Bin 6445 -> 6617 bytes src/languages/retailcrm-ru_RU.mo | Bin 7966 -> 8171 bytes 6 files changed, 48 insertions(+), 1 deletion(-) diff --git a/resources/pot/retailcrm-es_ES.pot b/resources/pot/retailcrm-es_ES.pot index 536b254..9c5141c 100644 --- a/resources/pot/retailcrm-es_ES.pot +++ b/resources/pot/retailcrm-es_ES.pot @@ -148,6 +148,12 @@ msgstr "Los métodos de la formalización del pedido" msgid "Catalog settings" msgstr "Ajustes del catálogo" +msgid "Online assistant" +msgstr "Consultor en línea" + +msgid "Insert the Online consultant code here" +msgstr "Inserte el código de consultor en Línea aquí" + msgid "Select API version" msgstr "Selecciona la versión de API" diff --git a/resources/pot/retailcrm-ru_RU.pot b/resources/pot/retailcrm-ru_RU.pot index 30cf233..ad1975e 100644 --- a/resources/pot/retailcrm-ru_RU.pot +++ b/resources/pot/retailcrm-ru_RU.pot @@ -157,6 +157,12 @@ msgstr "Способы оформления заказа" msgid "Catalog settings" msgstr "Настройки каталога" +msgid "Online assistant" +msgstr "Онлайн консультант" + +msgid "Insert the Online consultant code here" +msgstr "Вставьте код Онлайн-консультанта здесь" + msgid "Select API version" msgstr "Выберите версию API" diff --git a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php index c0794e4..41ee36e 100644 --- a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php +++ b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php @@ -147,6 +147,13 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'desc_tip' => true ); + $this->form_fields['online_assistant'] = array( + 'title' => __( 'Online assistant', 'retailcrm' ), + 'type' => 'textarea', + 'id' => 'online_assistant', + 'placeholder' => __( 'Insert the Online consultant code here', 'retailcrm' ) + ); + $this->form_fields[] = array( 'title' => __( 'Catalog settings', 'retailcrm' ), 'type' => 'title', @@ -557,6 +564,23 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration return ob_get_clean(); } + /** + * Returns the original value for the online_consultant field (ignores woocommerce validation) + * @param $key + * @param $value + * @return string + */ + public function validate_online_assistant_field($key, $value) + { + $onlineAssistant = $_POST['woocommerce_integration-retailcrm_online_assistant']; + + if (!empty($onlineAssistant) && is_string($onlineAssistant)) { + return wp_unslash($onlineAssistant); + } + + return ''; + } + /** * Validate API url * diff --git a/src/include/class-wc-retailcrm-base.php b/src/include/class-wc-retailcrm-base.php index acf71c5..85a58b9 100644 --- a/src/include/class-wc-retailcrm-base.php +++ b/src/include/class-wc-retailcrm-base.php @@ -92,6 +92,7 @@ if (!class_exists('WC_Retailcrm_Base')) { add_action('profile_update', array($this, 'update_customer'), 10, 2); add_action('wp_print_scripts', array($this, 'initialize_analytics'), 98); add_action('wp_print_scripts', array($this, 'initialize_daemon_collector'), 99); + add_action('wp_print_scripts', array($this, 'initialize_online_assistant'), 101); add_action('wp_print_footer_scripts', array($this, 'send_analytics'), 99); add_action('woocommerce_new_order', array($this, 'create_order'), 11, 1); @@ -114,7 +115,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $this->init_settings(); } - /** + /** * @param $settings * * @return array @@ -374,6 +375,16 @@ if (!class_exists('WC_Retailcrm_Base')) { echo ''; } } + + /** + * Initialize online consultant + */ + public function initialize_online_assistant() + { + if (!is_admin()) { + echo $this->get_option('online_assistant'); + } + } /** * Get retailcrm api client diff --git a/src/languages/retailcrm-es_ES.mo b/src/languages/retailcrm-es_ES.mo index 8cc5fc41c4c74d645d23e9293fbb2342c192ec81..e180f1af60f9eb8a0737f5ac68ba7bdb1b11a4c9 100644 GIT binary patch delta 1774 zcmX}sTWm~09LMoLE!t9D>R#obtxInx)mGiFEm3#vW7D2cS=)4Xn^Z(LJdlQmN+Wd( zib#Y$up)?rXd*!xJh;W>iF)dbXeuJ&``bNCI_EQU&Ym+f|Nl(8=D#nBd>);6(kPYG z$yEPfGZ!Bua-nPGUt751-&ze2W>_=RHs6qdbpT z9u0k92~NUYI1+<64G&={UdBB9gnKb1$t)L}kz3Y@1$Yhhy?3YueaFR^mTa~OH=rhV z22&Z|uG2{4#y!-^o_hT^IG%nl=HMUH0NI2gAGc#F9!7nz&9l?He+w6I{}GPHejI~I zgiY^dqL1+{mxg{&julvin)zvD@^%Lm!iQe}wdZHlhrVGU_G1=ivkFbH5@%uy?!t?> z0)JvAmhp0ADvfFyq}^JOZ`c9UijE@bvQsz?FQ9UJ2OWHmCHM=KvLY^;=t|V@t1%B7 zk>J@m3=cB9ip;?>e8iu3Z5E?(&x%p0Sc4OA2NE?4p!ULk)BtBuo9QNM0X>+FeaN4s zkBUFfLPcabD#9+##ulu^OQVRtLf6NQAZGHbdDw;;_%W7a4{D&4bh9})2eqko;8r|= zn)nyg%6_00G>C+2fj(4!3Mw-BsBu?EXcW^3V;NpYt*{sQhW+;XK5ia?8q`jM+Nw9D_Ja{m&w={}+&@fDeajps+JF%Ju{ z33uW}T#Ey!6f7lgN>x2-PaQ!;pcS>LJ8%fzMm`;}`!uwvUZFz!19je~a)_1V8e}on zjJ#mSP?5NV+Eg!)J!SK$D$FBRO1Uc6%KyKj6evn7s9MZioqv5q1FfXyQx{U1gB4LL zs47nE8c&g$TA_+kpjE0UpNUj0W)U@)s?(#w9RHW)UQ5x^__0;1t^BahY^gdFg-N+x zPgUr&>KRn+3;jbXrp}_Sp(+I`3#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