This commit is contained in:
parent
a445c3d908
commit
6220dd99dd
@ -450,3 +450,27 @@ msgstr "Descarga de servicios"
|
||||
|
||||
msgid "Goods with the 'virtual' option enabled will be uploaded to Simla as services"
|
||||
msgstr "Los bienes con la opción 'virtual' activada se cargarán en Simla como servicios"
|
||||
|
||||
msgid "Loyalty program"
|
||||
msgstr "Programa de fidelización"
|
||||
|
||||
msgid "Activate program loyalty"
|
||||
msgstr "Activar el programa de fidelización"
|
||||
|
||||
msgid "Enable this setting for activate program loyalty on site"
|
||||
msgstr "Active esta opción para activar el programa de fidelización en el sitio web"
|
||||
|
||||
msgid "Terms of loyalty program"
|
||||
msgstr "Condiciones del programa de fidelidad"
|
||||
|
||||
msgid "Insert the terms and conditions of the loyalty program"
|
||||
msgstr "Inserte las condiciones de participación en el programa de fidelidad"
|
||||
|
||||
msgid "Conditions of personal data processing"
|
||||
msgstr "Condiciones del tratamiento de datos personales"
|
||||
|
||||
msgid "Insert the terms and conditions for processing personal data"
|
||||
msgstr "Inserte las condiciones para el tratamiento de datos personales"
|
||||
|
||||
msgid "To activate the loyalty program it is necessary to activate the <a href='?page=wc-settings'>'enable use of coupons option'</a>"
|
||||
msgstr "Para activar el programa de fidelización es necesario activar la opción <a href='?page=wc-settings'>'habilitar uso de cupones'</a>."
|
||||
|
@ -459,3 +459,27 @@ msgstr "Выгрузка услуг"
|
||||
|
||||
msgid "Goods with the 'virtual' option enabled will be uploaded to Simla as services"
|
||||
msgstr "Товары с включенной опцией 'виртуальные' будут выгружаться в CRM как услуги"
|
||||
|
||||
msgid "Loyalty program"
|
||||
msgstr "Программа лояльности"
|
||||
|
||||
msgid "Activate program loyalty"
|
||||
msgstr "Активировать программу лояльности"
|
||||
|
||||
msgid "Enable this setting for activate program loyalty on site"
|
||||
msgstr "Активируйте эту настройку для активации программы лояльности на сайте"
|
||||
|
||||
msgid "Terms of loyalty program"
|
||||
msgstr "Условия программы лояльности"
|
||||
|
||||
msgid "Insert the terms and conditions of the loyalty program"
|
||||
msgstr "Вставьте условия участия в программе лояльности"
|
||||
|
||||
msgid "Conditions of personal data processing"
|
||||
msgstr "Условия обработки персональных данных"
|
||||
|
||||
msgid "Insert the terms and conditions for processing personal data"
|
||||
msgstr "Вставьте условия обработки персональных данных"
|
||||
|
||||
msgid "To activate the loyalty program it is necessary to activate the <a href='?page=wc-settings'>'enable use of coupons option'</a>"
|
||||
msgstr "Для активации программы лояльности необходимо активировать опцию <a href='?page=wc-settings'>'включить использование купонов'</a>"
|
||||
|
36
src/assets/js/retailcrm-loyalty.js
Normal file
36
src/assets/js/retailcrm-loyalty.js
Normal file
@ -0,0 +1,36 @@
|
||||
jQuery(function() {
|
||||
if (jQuery('#woocommerce_integration-retailcrm_loyalty').is(':checked')) {
|
||||
checkActiveCoupon();
|
||||
}
|
||||
|
||||
jQuery('#woocommerce_integration-retailcrm_loyalty').change(function () {
|
||||
if (this.checked) {
|
||||
checkActiveCoupon();
|
||||
}
|
||||
})
|
||||
|
||||
function checkActiveCoupon()
|
||||
{
|
||||
jQuery.ajax({
|
||||
url: AdminUrl.url + '/admin-ajax.php?action=get_status_coupon',
|
||||
method: 'POST',
|
||||
timeout: 0,
|
||||
data: {ajax: 1},
|
||||
dataType: 'json'
|
||||
})
|
||||
.done(function (response) {
|
||||
if (response.coupon_status !== 'yes') {
|
||||
var checkElement = jQuery('#woocommerce_integration-retailcrm_loyalty');
|
||||
checkElement.parent().css('color', 'red');
|
||||
checkElement.css('border-color', 'red');
|
||||
checkElement.prop('checked', false);
|
||||
|
||||
if (!jQuery('#coupon_warning').length) {
|
||||
checkElement.parent().parent().append(
|
||||
"<p id='coupon_warning' style='color: red'>" + response.translate.coupon_warning + "</p>"
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
@ -117,6 +117,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
|
||||
$this->form_fields['online_assistant'] = [
|
||||
'title' => __('Online assistant', 'retailcrm'),
|
||||
'css' => 'width:400px; height:215px; resize: horizontal;',
|
||||
'type' => 'textarea',
|
||||
'id' => 'online_assistant',
|
||||
'placeholder' => __('Insert the Online consultant code here', 'retailcrm')
|
||||
@ -593,6 +594,41 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
'description' => __('WhatsApp chat will be opened with this contact', 'retailcrm')
|
||||
];
|
||||
|
||||
/**
|
||||
* Loyalty Program
|
||||
*/
|
||||
|
||||
$this->form_fields[] = [
|
||||
'title' => __('Loyalty program', 'retailcrm'),
|
||||
'type' => 'heading',
|
||||
'description' => '',
|
||||
'id' => 'loyalty_options'
|
||||
];
|
||||
|
||||
$this->form_fields['loyalty'] = [
|
||||
'label' => __('Activate program loyalty', 'retailcrm'),
|
||||
'title' => __('Loyalty program', 'retailcrm'),
|
||||
'class' => 'checkbox',
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Enable this setting for activate program loyalty on site', 'retailcrm')
|
||||
];
|
||||
|
||||
$this->form_fields['loyalty_terms'] = [
|
||||
'title' => __('Terms of loyalty program', 'retailcrm'),
|
||||
'css' => 'width:400px; height:215px; resize: horizontal;',
|
||||
'type' => 'textarea',
|
||||
'id' => 'loyalty_terms',
|
||||
'placeholder' => __('Insert the terms and conditions of the loyalty program', 'retailcrm')
|
||||
];
|
||||
|
||||
$this->form_fields['loyalty_personal'] = [
|
||||
'title' => __('Conditions of personal data processing', 'retailcrm'),
|
||||
'css' => 'width:400px; height:215px; resize: horizontal;',
|
||||
'type' => 'textarea',
|
||||
'id' => 'loyalty_personal',
|
||||
'placeholder' => __('Insert the terms and conditions for processing personal data', 'retailcrm')
|
||||
];
|
||||
|
||||
/**
|
||||
* Generate icml file
|
||||
*/
|
||||
|
@ -86,6 +86,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
add_action('wp_ajax_generate_icml', [$this, 'generate_icml']);
|
||||
add_action('wp_ajax_upload_selected_orders', [$this, 'upload_selected_orders']);
|
||||
add_action('wp_ajax_clear_cron_tasks', [$this, 'clear_cron_tasks']);
|
||||
add_action('wp_ajax_get_status_coupon', [$this, 'get_status_coupon']);
|
||||
add_action('admin_print_footer_scripts', [$this, 'ajax_generate_icml'], 99);
|
||||
add_action('woocommerce_update_customer', [$this, 'update_customer'], 10, 1);
|
||||
add_action('user_register', [$this, 'create_customer'], 10, 2);
|
||||
@ -607,6 +608,22 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
$this->include_js_scripts_for_admin();
|
||||
}
|
||||
|
||||
public function get_status_coupon()
|
||||
{
|
||||
echo json_encode(
|
||||
[
|
||||
'coupon_status' => get_option('woocommerce_enable_coupons'),
|
||||
'translate' => [
|
||||
'coupon_warning' => __(
|
||||
"To activate the loyalty program it is necessary to activate the <a href='?page=wc-settings'>'enable use of coupons option'</a>",
|
||||
'retailcrm'
|
||||
)
|
||||
]
|
||||
]);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* In this method we include CSS file
|
||||
*
|
||||
@ -645,6 +662,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
'retailcrm-cron-info',
|
||||
'retailcrm-meta-fields',
|
||||
'retailcrm-module-settings',
|
||||
'retailcrm-loyalty',
|
||||
];
|
||||
|
||||
$wpAdminUrl = ['url' => get_admin_url()];
|
||||
|
Binary file not shown.
Binary file not shown.
@ -44,10 +44,6 @@ class WC_Retailcrm_Loyalty_Client_Test extends WC_Retailcrm_Test_Case_Helper
|
||||
$this->setMockResponse($this->apiMock, 'makeRequest', $this->responseMock);
|
||||
|
||||
$this->clientMock = new \WC_Retailcrm_Client_V5('https://test@retailcrm.ru', 'test', 'test');
|
||||
/* $this->clientMock = $this->getMockBuilder('\WC_Retailcrm_Client_V5')
|
||||
->disableOriginalConstructor()
|
||||
->getMock()
|
||||
;*/
|
||||
|
||||
$reflection = new ReflectionClass($this->clientMock);
|
||||
$reflection_property = $reflection->getProperty('client');
|
||||
|
Loading…
x
Reference in New Issue
Block a user