From d8a51cdfbce09dde85c3f8df879df161297eac8d Mon Sep 17 00:00:00 2001 From: Sergey Chazov Date: Fri, 10 Jul 2020 15:36:09 +0300 Subject: [PATCH] task #67192 incubator --- resources/pot/retailcrm-es_ES.pot | 6 +++++ resources/pot/retailcrm-ru_RU.pot | 6 +++++ .../class-wc-retailcrm-abstracts-settings.php | 23 ++++++++++++++++++ src/include/class-wc-retailcrm-base.php | 13 +++++++++- src/languages/retailcrm-es_ES.mo | Bin 6445 -> 6470 bytes 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/resources/pot/retailcrm-es_ES.pot b/resources/pot/retailcrm-es_ES.pot index 536b254..41bc44c 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 javascript from the Retailcrm admin panel" +msgstr "Inserte javascript desde el panel de administración de Retailcrm" + 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..e723852 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 javascript from the retailCRM admin panel" +msgstr "Вставьте javascript из административной панели retailCRM" + 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..97c75f9 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 javascript from the retailCRM admin panel', 'retailcrm' ) + ); + $this->form_fields[] = array( 'title' => __( 'Catalog settings', 'retailcrm' ), 'type' => 'title', @@ -557,6 +564,22 @@ 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..ad6925f 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 @@ -375,6 +376,16 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** + * 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..a19d6a804652835f3f505627d279acbadf06a9f0 100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