1
0
mirror of synced 2025-02-20 17:03:13 +03:00

Online Consultant

This commit is contained in:
Сергей Чазов 2020-08-05 14:12:06 +03:00 committed by GitHub
parent a3a70707ae
commit c0ff7028f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 1 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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
*

View File

@ -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

Binary file not shown.

Binary file not shown.