Fix fatal error when using API without api_key
This commit is contained in:
parent
e1e7331f89
commit
c9294d62a1
@ -1,3 +1,11 @@
|
|||||||
|
## 2022-05-26 4.4.4
|
||||||
|
* Add product description to ICML
|
||||||
|
* Fix fatal error using API without api_key
|
||||||
|
* Add priceType processing to CRM order by history
|
||||||
|
* Add method in API V5 and delete use another version
|
||||||
|
* Fix error with integration payments
|
||||||
|
* Fix bug with changing order status by history
|
||||||
|
|
||||||
## 2022-03-24 4.4.3
|
## 2022-03-24 4.4.3
|
||||||
* Fix bug in updating order number by history
|
* Fix bug in updating order number by history
|
||||||
* Add multiple image transfer in ICML
|
* Add multiple image transfer in ICML
|
||||||
|
@ -67,9 +67,6 @@ msgstr "Introduce la llave API correcta"
|
|||||||
msgid "Enter the correct URL of Simla.com"
|
msgid "Enter the correct URL of Simla.com"
|
||||||
msgstr "Introduce el enlace del Simla.com correcto"
|
msgstr "Introduce el enlace del Simla.com correcto"
|
||||||
|
|
||||||
msgid "The selected API version is unavailable"
|
|
||||||
msgstr "La versión de API elegida no está disponible"
|
|
||||||
|
|
||||||
msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com"
|
msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com"
|
||||||
msgstr "Esta función permite generar los catálogos de pedidos ICML para subida al Simla.com"
|
msgstr "Esta función permite generar los catálogos de pedidos ICML para subida al Simla.com"
|
||||||
|
|
||||||
|
@ -76,9 +76,6 @@ msgstr "Введите корректный API ключ"
|
|||||||
msgid "Enter the correct URL of Simla.com"
|
msgid "Enter the correct URL of Simla.com"
|
||||||
msgstr "Введите корректный адрес Simla.com"
|
msgstr "Введите корректный адрес Simla.com"
|
||||||
|
|
||||||
msgid "The selected API version is unavailable"
|
|
||||||
msgstr "Выбранная версия API недоступна"
|
|
||||||
|
|
||||||
msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com"
|
msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com"
|
||||||
msgstr "Эта функция позволяет сгенерировать ICML каталог товаров для выгрузки в Simla.com"
|
msgstr "Эта функция позволяет сгенерировать ICML каталог товаров для выгрузки в Simla.com"
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
isset($_GET['page']) && $_GET['page'] == 'wc-settings'
|
isset($_GET['page']) && $_GET['page'] == 'wc-settings'
|
||||||
&& isset($_GET['tab']) && $_GET['tab'] == 'integration'
|
&& isset($_GET['tab']) && $_GET['tab'] == 'integration'
|
||||||
) {
|
) {
|
||||||
add_action('init', array($this, 'init_settings_fields'), 99);
|
add_action('init', [$this, 'init_settings_fields'], 99);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,24 +67,24 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
*/
|
*/
|
||||||
public function init_form_fields()
|
public function init_form_fields()
|
||||||
{
|
{
|
||||||
$this->form_fields = array(
|
$this->form_fields = [
|
||||||
array( 'title' => __('Main settings', 'retailcrm'), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ),
|
[ 'title' => __('Main settings', 'retailcrm'), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ],
|
||||||
|
|
||||||
'api_url' => array(
|
'api_url' => [
|
||||||
'title' => __('API of URL', 'retailcrm'),
|
'title' => __('API of URL', 'retailcrm'),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __( 'Enter API of URL (https://yourdomain.simla.com)', 'retailcrm' ),
|
'description' => __( 'Enter API of URL (https://yourdomain.simla.com)', 'retailcrm' ),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'default' => ''
|
'default' => ''
|
||||||
),
|
],
|
||||||
'api_key' => array(
|
'api_key' => [
|
||||||
'title' => __('API key', 'retailcrm'),
|
'title' => __('API key', 'retailcrm'),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __('Enter your API key. You can find it in the administration section of Simla.com', 'retailcrm'),
|
'description' => __('Enter your API key. You can find it in the administration section of Simla.com', 'retailcrm'),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'default' => ''
|
'default' => ''
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
|
|
||||||
$post = $this->get_post_data();
|
$post = $this->get_post_data();
|
||||||
$apiUrl = !empty($post[$this->plugin_id . $this->id . '_api_url']) ? $post[$this->plugin_id . $this->id . '_api_url'] : null;
|
$apiUrl = !empty($post[$this->plugin_id . $this->id . '_api_url']) ? $post[$this->plugin_id . $this->id . '_api_url'] : null;
|
||||||
@ -95,37 +95,37 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
isset($_GET['page']) && $_GET['page'] == 'wc-settings'
|
isset($_GET['page']) && $_GET['page'] == 'wc-settings'
|
||||||
&& isset($_GET['tab']) && $_GET['tab'] == 'integration'
|
&& isset($_GET['tab']) && $_GET['tab'] == 'integration'
|
||||||
) {
|
) {
|
||||||
add_action('admin_print_footer_scripts', array($this, 'show_blocks'), 99);
|
add_action('admin_print_footer_scripts', [$this, 'show_blocks'], 99);
|
||||||
|
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('API settings', 'retailcrm'),
|
'title' => __('API settings', 'retailcrm'),
|
||||||
'type' => 'title',
|
'type' => 'title',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'api_options'
|
'id' => 'api_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['corporate_enabled'] = array(
|
$this->form_fields['corporate_enabled'] = [
|
||||||
'title' => __('Corporate customers support', 'retailcrm'),
|
'title' => __('Corporate customers support', 'retailcrm'),
|
||||||
'label' => __('Enabled'),
|
'label' => __('Enabled'),
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'desc_tip' => true
|
'desc_tip' => true
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['online_assistant'] = array(
|
$this->form_fields['online_assistant'] = [
|
||||||
'title' => __('Online assistant', 'retailcrm'),
|
'title' => __('Online assistant', 'retailcrm'),
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'id' => 'online_assistant',
|
'id' => 'online_assistant',
|
||||||
'placeholder' => __('Insert the Online consultant code here', 'retailcrm')
|
'placeholder' => __('Insert the Online consultant code here', 'retailcrm')
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Catalog settings', 'retailcrm'),
|
'title' => __('Catalog settings', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'catalog_options'
|
'id' => 'catalog_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['product_description'] = [
|
$this->form_fields['product_description'] = [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -143,20 +143,21 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach (get_post_statuses() as $status_key => $status_value) {
|
foreach (get_post_statuses() as $status_key => $status_value) {
|
||||||
$this->form_fields['p_' . $status_key] = array(
|
$this->form_fields['p_' . $status_key] = [
|
||||||
'title' => $status_value,
|
'title' => $status_value,
|
||||||
'label' => ' ',
|
'label' => ' ',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
);
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order methods options
|
* Order methods options
|
||||||
*/
|
*/
|
||||||
$order_methods_option = array();
|
$order_methods_option = [];
|
||||||
$order_methods_list = $this->apiClient->orderMethodsList();
|
$order_methods_list = $this->apiClient->orderMethodsList();
|
||||||
|
|
||||||
if (!empty($order_methods_list) && $order_methods_list->isSuccessful()) {
|
if (!empty($order_methods_list) && $order_methods_list->isSuccessful()) {
|
||||||
@ -168,23 +169,26 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
$order_methods_option[$order_method['code']] = $order_method['name'];
|
$order_methods_option[$order_method['code']] = $order_method['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Order methods', 'retailcrm'),
|
'title' => __('Order methods', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'order_methods_options'
|
'id' => 'order_methods_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['order_methods'] = array(
|
$this->form_fields['order_methods'] = [
|
||||||
'label' => ' ',
|
'label' => ' ',
|
||||||
'title' => __('Order methods available for uploading from Simla.com', 'retailcrm'),
|
'title' => __('Order methods available for uploading from Simla.com', 'retailcrm'),
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'type' => 'multiselect',
|
'type' => 'multiselect',
|
||||||
'description' => __('Select order methods which will be uploaded from Simla.com to the website', 'retailcrm'),
|
|
||||||
'options' => $order_methods_option,
|
'options' => $order_methods_option,
|
||||||
'css' => 'min-height:100px;',
|
'css' => 'min-height:100px;',
|
||||||
'select_buttons' => true
|
'select_buttons' => true,
|
||||||
);
|
'description' => __(
|
||||||
|
'Select order methods which will be uploaded from Simla.com to the website',
|
||||||
|
'retailcrm'
|
||||||
|
),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,7 +217,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
|
|
||||||
foreach ($wc_shipping_list as $shipping_code => $shipping) {
|
foreach ($wc_shipping_list as $shipping_code => $shipping) {
|
||||||
if (isset($shipping['enabled']) && $shipping['enabled'] == static::YES) {
|
if (isset($shipping['enabled']) && $shipping['enabled'] == static::YES) {
|
||||||
$this->form_fields[$shipping_code] = array(
|
$this->form_fields[$shipping_code] = [
|
||||||
'title' => __($shipping['title'], 'woocommerce'),
|
'title' => __($shipping['title'], 'woocommerce'),
|
||||||
'description' => __($shipping['description'], 'woocommerce'),
|
'description' => __($shipping['description'], 'woocommerce'),
|
||||||
'css' => 'min-width:350px;',
|
'css' => 'min-width:350px;',
|
||||||
@ -221,7 +225,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'options' => $shipping_option_list,
|
'options' => $shipping_option_list,
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,236 +331,242 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
/**
|
/**
|
||||||
* Meta data options
|
* Meta data options
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Custom fields', 'retailcrm'),
|
'title' => __('Custom fields', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'class' => 'meta-fields'
|
'class' => 'meta-fields'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['order-meta-data-retailcrm'] = array(
|
$this->form_fields['order-meta-data-retailcrm'] = [
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'class' => 'order-meta-data-retailcrm',
|
'class' => 'order-meta-data-retailcrm',
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['customer-meta-data-retailcrm'] = array(
|
$this->form_fields['customer-meta-data-retailcrm'] = [
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'class' => 'customer-meta-data-retailcrm',
|
'class' => 'customer-meta-data-retailcrm',
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inventories options
|
* Inventories options
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Setting of the stock balance', 'retailcrm'),
|
'title' => __('Setting of the stock balance', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'invent_options'
|
'id' => 'invent_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['sync'] = array(
|
$this->form_fields['sync'] = [
|
||||||
'label' => __('Synchronization of the stock balance', 'retailcrm'),
|
'label' => __('Synchronization of the stock balance', 'retailcrm'),
|
||||||
'title' => __('Stock balance', 'retailcrm'),
|
'title' => __('Stock balance', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'description' => __('Enable this setting if you would like to get information on leftover stocks from Simla.com to the website', 'retailcrm')
|
'description' => __('Enable this setting if you would like to get information on leftover stocks from Simla.com to the website', 'retailcrm')
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UA options
|
* UA options
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('UA settings', 'retailcrm'),
|
'title' => __('UA settings', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'ua_options'
|
'id' => 'ua_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['ua'] = array(
|
$this->form_fields['ua'] = [
|
||||||
'label' => __('Activate UA', 'retailcrm'),
|
'label' => __('Activate UA', 'retailcrm'),
|
||||||
'title' => __('UA', 'retailcrm'),
|
'title' => __('UA', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'description' => __('Enable this setting for uploading data to UA', 'retailcrm')
|
'description' => __('Enable this setting for uploading data to UA', 'retailcrm')
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['ua_code'] = array(
|
$this->form_fields['ua_code'] = [
|
||||||
'title' => __('UA tracking code', 'retailcrm'),
|
'title' => __('UA tracking code', 'retailcrm'),
|
||||||
'class' => 'input',
|
'class' => 'input',
|
||||||
'type' => 'input'
|
'type' => 'input'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['ua_custom'] = array(
|
$this->form_fields['ua_custom'] = [
|
||||||
'title' => __('User parameter', 'retailcrm'),
|
'title' => __('User parameter', 'retailcrm'),
|
||||||
'class' => 'input',
|
'class' => 'input',
|
||||||
'type' => 'input'
|
'type' => 'input'
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Daemon collector settings
|
* Daemon collector settings
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Daemon Collector settings', 'retailcrm'),
|
'title' => __('Daemon Collector settings', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'invent_options'
|
'id' => 'invent_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['daemon_collector'] = array(
|
$this->form_fields['daemon_collector'] = [
|
||||||
'label' => __('Activate Daemon Collector', 'retailcrm'),
|
'label' => __('Activate Daemon Collector', 'retailcrm'),
|
||||||
'title' => __('Daemon Collector', 'retailcrm'),
|
'title' => __('Daemon Collector', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'description' => __('Enable this setting for activate Daemon Collector on site', 'retailcrm')
|
'description' => __('Enable this setting for activate Daemon Collector on site', 'retailcrm')
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['daemon_collector_key'] = array(
|
$this->form_fields['daemon_collector_key'] = [
|
||||||
'title' => __('Site key', 'retailcrm'),
|
'title' => __('Site key', 'retailcrm'),
|
||||||
'class' => 'input',
|
'class' => 'input',
|
||||||
'type' => 'input'
|
'type' => 'input'
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uploads options
|
* Uploads options
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Settings of uploading', 'retailcrm'),
|
'title' => __('Settings of uploading', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'upload_options'
|
'id' => 'upload_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['upload-button'] = array(
|
$this->form_fields['upload-button'] = [
|
||||||
'label' => __('Upload', 'retailcrm'),
|
'label' => __('Upload', 'retailcrm'),
|
||||||
'title' => __('Uploading all customers and orders', 'retailcrm'),
|
'title' => __('Uploading all customers and orders', 'retailcrm'),
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'description' => __('You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open', 'retailcrm'),
|
'description' => __('You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open', 'retailcrm'),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'id' => 'export-orders-submit'
|
'id' => 'export-orders-submit'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['export_selected_orders_ids'] = array(
|
$this->form_fields['export_selected_orders_ids'] = [
|
||||||
'label' => __('Orders identifiers', 'retailcrm'),
|
'label' => __('Orders identifiers', 'retailcrm'),
|
||||||
'title' => __('Orders identifiers', 'retailcrm'),
|
'title' => __('Orders identifiers', 'retailcrm'),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __('Enter orders identifiers separated by a comma, but no more than 50', 'retailcrm'),
|
'description' => __('Enter orders identifiers separated by a comma, but no more than 50', 'retailcrm'),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'id' => 'export_selected_orders_ids'
|
'id' => 'export_selected_orders_ids'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['export_selected_orders_btn'] = array(
|
$this->form_fields['export_selected_orders_btn'] = [
|
||||||
'label' => __('Upload', 'retailcrm'),
|
'label' => __('Upload', 'retailcrm'),
|
||||||
'title' => __('Uploading orders by identifiers', 'retailcrm'),
|
'title' => __('Uploading orders by identifiers', 'retailcrm'),
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'description' => __('This functionality allows to upload orders to Simla.com differentially', 'retailcrm'),
|
'description' => __('This functionality allows to upload orders to Simla.com differentially', 'retailcrm'),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'id' => 'export_selected_orders_btn'
|
'id' => 'export_selected_orders_btn'
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WhatsApp options
|
* WhatsApp options
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Settings of WhatsApp', 'retailcrm'),
|
'title' => __('Settings of WhatsApp', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'whatsapp_options'
|
'id' => 'whatsapp_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['whatsapp_active'] = array(
|
$this->form_fields['whatsapp_active'] = [
|
||||||
'label' => __('Activate WhatsApp', 'retailcrm'),
|
'label' => __('Activate WhatsApp', 'retailcrm'),
|
||||||
'title' => __('WhatsApp', 'retailcrm'),
|
'title' => __('WhatsApp', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'description' => __('Activate this setting to activate WhatsApp on the website', 'retailcrm')
|
'description' => __('Activate this setting to activate WhatsApp on the website', 'retailcrm')
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['whatsapp_location_icon'] = array(
|
$this->form_fields['whatsapp_location_icon'] = [
|
||||||
'label' => __('Place in the lower right corner of the website', 'retailcrm'),
|
'label' => __('Place in the lower right corner of the website', 'retailcrm'),
|
||||||
'title' => __('WhatsApp icon location', 'retailcrm'),
|
'title' => __('WhatsApp icon location', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'description' => __('By default, WhatsApp icon is located in the lower left corner of the website', 'retailcrm')
|
'description' => __(
|
||||||
);
|
'By default, WhatsApp icon is located in the lower left corner of the website',
|
||||||
|
'retailcrm'
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
$this->form_fields['whatsapp_number'] = array(
|
$this->form_fields['whatsapp_number'] = [
|
||||||
'title' => __('Enter your phone number', 'retailcrm'),
|
'title' => __('Enter your phone number', 'retailcrm'),
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __('WhatsApp chat will be opened with this contact', 'retailcrm')
|
'description' => __('WhatsApp chat will be opened with this contact', 'retailcrm')
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate icml file
|
* Generate icml file
|
||||||
*/
|
*/
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Generating ICML catalog', 'retailcrm'),
|
'title' => __('Generating ICML catalog', 'retailcrm'),
|
||||||
'type' => 'title',
|
'type' => 'title',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'icml_options'
|
'id' => 'icml_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'label' => __('Generate now', 'retailcrm'),
|
'label' => __('Generate now', 'retailcrm'),
|
||||||
'title' => __('Generating ICML', 'retailcrm'),
|
'title' => __('Generating ICML', 'retailcrm'),
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'description' => __('This functionality allows to generate ICML products catalog for uploading to Simla.com', 'retailcrm'),
|
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'id' => 'icml-retailcrm'
|
'id' => 'icml-retailcrm',
|
||||||
);
|
'description' => __(
|
||||||
|
'This functionality allows to generate ICML products catalog for uploading to Simla.com',
|
||||||
|
'retailcrm'
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
$this->form_fields['icml'] = array(
|
$this->form_fields['icml'] = [
|
||||||
'label' => __('Generating ICML', 'retailcrm'),
|
'label' => __('Generating ICML', 'retailcrm'),
|
||||||
'title' => __('Generating ICML catalog by wp-cron', 'retailcrm'),
|
'title' => __('Generating ICML catalog by wp-cron', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox'
|
'type' => 'checkbox'
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
$this->form_fields['history'] = array(
|
$this->form_fields['history'] = [
|
||||||
'label' => __('Activate history uploads', 'retailcrm'),
|
'label' => __('Activate history uploads', 'retailcrm'),
|
||||||
'title' => __('Upload data from Simla.com', 'retailcrm'),
|
'title' => __('Upload data from Simla.com', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox'
|
'type' => 'checkbox'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['deactivate_update_order'] = array(
|
$this->form_fields['deactivate_update_order'] = [
|
||||||
'label' => __('Disable data editing in Simla.com', 'retailcrm'),
|
'label' => __('Disable data editing in Simla.com', 'retailcrm'),
|
||||||
'title' => __('Data updating in Simla.com', 'retailcrm'),
|
'title' => __('Data updating in Simla.com', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox'
|
'type' => 'checkbox'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['bind_by_sku'] = array(
|
$this->form_fields['bind_by_sku'] = [
|
||||||
'label' => __('Activate the binding via sku (xml)', 'retailcrm'),
|
'label' => __('Activate the binding via sku (xml)', 'retailcrm'),
|
||||||
'title' => __('Stock synchronization and link between products', 'retailcrm'),
|
'title' => __('Stock synchronization and link between products', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox'
|
'type' => 'checkbox'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['update_number'] = array(
|
$this->form_fields['update_number'] = [
|
||||||
'label' => __('Enable transferring the number to Simla.com', 'retailcrm'),
|
'label' => __('Enable transferring the number to Simla.com', 'retailcrm'),
|
||||||
'title' => __('Transferring the order number', 'retailcrm'),
|
'title' => __('Transferring the order number', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox'
|
'type' => 'checkbox'
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->form_fields['debug_mode'] = array(
|
$this->form_fields['debug_mode'] = [
|
||||||
'label' => __('Enable debug mode in module', 'retailcrm'),
|
'label' => __('Enable debug mode in module', 'retailcrm'),
|
||||||
'title' => __('Debug mode', 'retailcrm'),
|
'title' => __('Debug mode', 'retailcrm'),
|
||||||
'description' => __('Is required to enable debug mode for advanced logs', 'retailcrm'),
|
'description' => __('Is required to enable debug mode for advanced logs', 'retailcrm'),
|
||||||
'class' => 'checkbox',
|
'class' => 'checkbox',
|
||||||
'type' => 'checkbox'
|
'type' => 'checkbox'
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug information
|
* Debug information
|
||||||
*/
|
*/
|
||||||
$this->form_fields['debug-info'] = array(
|
$this->form_fields['debug-info'] = [
|
||||||
'title' => __('Debug information', 'retailcrm'),
|
'title' => __('Debug information', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'class' => 'debug_info_options'
|
'class' => 'debug_info_options'
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
} elseif (empty($apiUrl) === false && empty($apiKey) === false) {
|
} elseif (empty($apiUrl) === false && empty($apiKey) === false) {
|
||||||
$api = new WC_Retailcrm_Proxy(
|
$api = new WC_Retailcrm_Proxy(
|
||||||
@ -586,14 +596,14 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
public function generate_button_html($key, $data)
|
public function generate_button_html($key, $data)
|
||||||
{
|
{
|
||||||
$field = $this->plugin_id . $this->id . '_' . $key;
|
$field = $this->plugin_id . $this->id . '_' . $key;
|
||||||
$defaults = array(
|
$defaults = [
|
||||||
'class' => 'button-secondary',
|
'class' => 'button-secondary',
|
||||||
'css' => '',
|
'css' => '',
|
||||||
'custom_attributes' => array(),
|
'custom_attributes' => [],
|
||||||
'desc_tip' => false,
|
'desc_tip' => false,
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'title' => '',
|
'title' => '',
|
||||||
);
|
];
|
||||||
|
|
||||||
$data = wp_parse_args($data, $defaults);
|
$data = wp_parse_args($data, $defaults);
|
||||||
|
|
||||||
@ -629,12 +639,8 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
public function generate_heading_html($key, $data)
|
public function generate_heading_html($key, $data)
|
||||||
{
|
{
|
||||||
$field_key = $this->get_field_key($key);
|
$field_key = $this->get_field_key($key);
|
||||||
$defaults = array(
|
$defaults = ['title' => '', 'class' => ''];
|
||||||
'title' => '',
|
$data = wp_parse_args($data, $defaults);
|
||||||
'class' => '',
|
|
||||||
);
|
|
||||||
|
|
||||||
$data = wp_parse_args($data, $defaults);
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
@ -680,21 +686,14 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
*/
|
*/
|
||||||
public function validate_api_url_field($key, $value)
|
public function validate_api_url_field($key, $value)
|
||||||
{
|
{
|
||||||
$post = $this->get_post_data();
|
$crmUrl = validateUrl($value);
|
||||||
$api = new WC_Retailcrm_Proxy(
|
|
||||||
$value,
|
|
||||||
$post[$this->plugin_id . $this->id . '_api_key'],
|
|
||||||
$this->get_option('corporate_enabled', 'no') === 'yes'
|
|
||||||
);
|
|
||||||
|
|
||||||
$response = $api->apiVersions();
|
if (validateUrl($crmUrl) == '') {
|
||||||
|
WC_Admin_Settings::add_error(esc_html__('Enter the correct URL of Simla.com', 'retailcrm'));
|
||||||
if ($response == null) {
|
header("Refresh:3");
|
||||||
WC_Admin_Settings::add_error(esc_html__('Enter the correct URL of CRM', 'retailcrm'));
|
|
||||||
$value = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $crmUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -709,9 +708,15 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
*/
|
*/
|
||||||
public function validate_api_key_field($key, $value)
|
public function validate_api_key_field($key, $value)
|
||||||
{
|
{
|
||||||
$post = $this->get_post_data();
|
$crmUrl = $_POST['woocommerce_integration-retailcrm_api_url'];
|
||||||
|
|
||||||
|
// If entered the wrong URL, don't need to validate the API key.
|
||||||
|
if (validateUrl($crmUrl) == '') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
$api = new WC_Retailcrm_Proxy(
|
$api = new WC_Retailcrm_Proxy(
|
||||||
$post[$this->plugin_id . $this->id . '_api_url'],
|
$crmUrl,
|
||||||
$value,
|
$value,
|
||||||
$this->get_option('corporate_enabled', 'no') === 'yes'
|
$this->get_option('corporate_enabled', 'no') === 'yes'
|
||||||
);
|
);
|
||||||
@ -724,6 +729,8 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
|
|
||||||
if (empty($response) || !$response->isSuccessful()) {
|
if (empty($response) || !$response->isSuccessful()) {
|
||||||
WC_Admin_Settings::add_error(esc_html__('Enter the correct API key', 'retailcrm'));
|
WC_Admin_Settings::add_error(esc_html__('Enter the correct API key', 'retailcrm'));
|
||||||
|
header("Refresh:3");
|
||||||
|
|
||||||
$value = '';
|
$value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,30 +807,30 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_menu(
|
||||||
array(
|
[
|
||||||
'id' => 'retailcrm_top_menu',
|
'id' => 'retailcrm_top_menu',
|
||||||
'title' => __('Simla.com', 'retailcrm')
|
'title' => __('Simla.com', 'retailcrm')
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_menu(
|
||||||
array(
|
[
|
||||||
'id' => 'retailcrm_ajax_generate_icml',
|
'id' => 'retailcrm_ajax_generate_icml',
|
||||||
'title' => __('Generating ICML catalog', 'retailcrm'),
|
'title' => __('Generating ICML catalog', 'retailcrm'),
|
||||||
'href' => '#',
|
'href' => '#',
|
||||||
'parent' => 'retailcrm_top_menu',
|
'parent' => 'retailcrm_top_menu',
|
||||||
'class' => 'retailcrm_ajax_generate_icml'
|
'class' => 'retailcrm_ajax_generate_icml'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_menu(
|
||||||
array(
|
[
|
||||||
'id' => 'retailcrm_ajax_generate_setings',
|
'id' => 'retailcrm_ajax_generate_setings',
|
||||||
'title' => __('Settings', 'retailcrm'),
|
'title' => __('Settings', 'retailcrm'),
|
||||||
'href' => get_site_url() . '/wp-admin/admin.php?page=wc-settings&tab=integration§ion=integration-retailcrm',
|
'href' => get_site_url() . '/wp-admin/admin.php?page=wc-settings&tab=integration§ion=integration-retailcrm',
|
||||||
'parent' => 'retailcrm_top_menu',
|
'parent' => 'retailcrm_top_menu',
|
||||||
'class' => 'retailcrm_ajax_settings'
|
'class' => 'retailcrm_ajax_settings'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,41 +69,41 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
$this->uploader = new WC_Retailcrm_Uploader($this->apiClient, $this->orders, $this->customers);
|
$this->uploader = new WC_Retailcrm_Uploader($this->apiClient, $this->orders, $this->customers);
|
||||||
|
|
||||||
// Actions.
|
// Actions.
|
||||||
add_action('woocommerce_update_options_integration_' . $this->id, array($this, 'process_admin_options'));
|
add_action('woocommerce_update_options_integration_' . $this->id, [$this, 'process_admin_options']);
|
||||||
add_filter('woocommerce_settings_api_sanitized_fields_' . $this->id, array($this, 'api_sanitized'));
|
add_filter('woocommerce_settings_api_sanitized_fields_' . $this->id, [$this, 'api_sanitized']);
|
||||||
add_action('admin_bar_menu', array($this, 'add_retailcrm_button'), 100);
|
add_action('admin_bar_menu', [$this, 'add_retailcrm_button'], 100);
|
||||||
add_action('woocommerce_checkout_order_processed', array($this, 'retailcrm_process_order'), 10, 1);
|
add_action('woocommerce_checkout_order_processed', [$this, 'retailcrm_process_order'], 10, 1);
|
||||||
add_action('retailcrm_history', array($this, 'retailcrm_history_get'));
|
add_action('retailcrm_history', [$this, 'retailcrm_history_get']);
|
||||||
add_action('retailcrm_icml', array($this, 'generate_icml'));
|
add_action('retailcrm_icml', [$this, 'generate_icml']);
|
||||||
add_action('retailcrm_inventories', array($this, 'load_stocks'));
|
add_action('retailcrm_inventories', [$this, 'load_stocks']);
|
||||||
add_action('wp_ajax_do_upload', array($this, 'upload_to_crm'));
|
add_action('wp_ajax_do_upload', [$this, 'upload_to_crm']);
|
||||||
add_action('wp_ajax_cron_info', array($this, 'get_cron_info'), 99);
|
add_action('wp_ajax_cron_info', [$this, 'get_cron_info'], 99);
|
||||||
add_action('wp_ajax_set_meta_fields', array($this, 'set_meta_fields'), 99);
|
add_action('wp_ajax_set_meta_fields', [$this, 'set_meta_fields'], 99);
|
||||||
add_action('wp_ajax_content_upload', array($this, 'count_upload_data'), 99);
|
add_action('wp_ajax_content_upload', [$this, 'count_upload_data'], 99);
|
||||||
add_action('wp_ajax_generate_icml', array($this, 'generate_icml'));
|
add_action('wp_ajax_generate_icml', [$this, 'generate_icml']);
|
||||||
add_action('wp_ajax_upload_selected_orders', array($this, 'upload_selected_orders'));
|
add_action('wp_ajax_upload_selected_orders', [$this, 'upload_selected_orders']);
|
||||||
add_action('admin_print_footer_scripts', array($this, 'ajax_generate_icml'), 99);
|
add_action('admin_print_footer_scripts', [$this, 'ajax_generate_icml'], 99);
|
||||||
add_action('woocommerce_update_customer', array($this, 'update_customer'), 10, 1);
|
add_action('woocommerce_update_customer', [$this, 'update_customer'], 10, 1);
|
||||||
add_action('user_register', array($this, 'create_customer'), 10, 2);
|
add_action('user_register', [$this, 'create_customer'], 10, 2);
|
||||||
add_action('profile_update', array($this, 'update_customer'), 10, 2);
|
add_action('profile_update', [$this, 'update_customer'], 10, 2);
|
||||||
add_action('wp_print_scripts', array($this, 'initialize_analytics'), 98);
|
add_action('wp_print_scripts', [$this, 'initialize_analytics'], 98);
|
||||||
add_action('wp_print_scripts', array($this, 'initialize_daemon_collector'), 99);
|
add_action('wp_print_scripts', [$this, 'initialize_daemon_collector'], 99);
|
||||||
add_action('wp_print_scripts', array($this, 'initialize_online_assistant'), 101);
|
add_action('wp_print_scripts', [$this, 'initialize_online_assistant'], 101);
|
||||||
add_action('wp_enqueue_scripts', array($this, 'include_whatsapp_icon_style'), 101);
|
add_action('wp_enqueue_scripts', [$this, 'include_whatsapp_icon_style'], 101);
|
||||||
add_action('wp_print_footer_scripts', array($this, 'initialize_whatsapp'), 101);
|
add_action('wp_print_footer_scripts', [$this, 'initialize_whatsapp'], 101);
|
||||||
add_action('wp_print_footer_scripts', array($this, 'send_analytics'), 99);
|
add_action('wp_print_footer_scripts', [$this, 'send_analytics'], 99);
|
||||||
add_action('admin_enqueue_scripts', array($this, 'include_files_for_admin'), 101);
|
add_action('admin_enqueue_scripts', [$this, 'include_files_for_admin'], 101);
|
||||||
add_action('woocommerce_new_order', array($this, 'create_order'), 11, 1);
|
add_action('woocommerce_new_order', [$this, 'create_order'], 11, 1);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!$this->get_option('deactivate_update_order')
|
!$this->get_option('deactivate_update_order')
|
||||||
|| $this->get_option('deactivate_update_order') == static::NO
|
|| $this->get_option('deactivate_update_order') == static::NO
|
||||||
) {
|
) {
|
||||||
add_action('woocommerce_update_order', array($this, 'update_order'), 11, 1);
|
add_action('woocommerce_update_order', [$this, 'update_order'], 11, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deactivate hook
|
// Deactivate hook
|
||||||
add_action('retailcrm_deactivate', array($this, 'deactivate'));
|
add_action('retailcrm_deactivate', [$this, 'deactivate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +115,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
$this->init_settings();
|
$this->init_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $settings
|
* @param $settings
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@ -166,6 +166,10 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
* This solution checks the url specified to the ICML file and updates it if necessary.
|
* This solution checks the url specified to the ICML file and updates it if necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!$this->apiClient instanceof WC_Retailcrm_Proxy) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$codeSite = '';
|
$codeSite = '';
|
||||||
$infoApiKey = $this->apiClient->credentials();
|
$infoApiKey = $this->apiClient->credentials();
|
||||||
|
|
||||||
@ -498,19 +502,19 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
*/
|
*/
|
||||||
public function count_upload_data()
|
public function count_upload_data()
|
||||||
{
|
{
|
||||||
$translate = array(
|
$translate = [
|
||||||
'tr_order' => __('Orders', 'retailcrm'),
|
'tr_order' => __('Orders', 'retailcrm'),
|
||||||
'tr_customer' => __('Customers', 'retailcrm'),
|
'tr_customer' => __('Customers', 'retailcrm'),
|
||||||
'tr_empty_field' => __('The field cannot be empty, enter the order ID', 'retailcrm'),
|
'tr_empty_field' => __('The field cannot be empty, enter the order ID', 'retailcrm'),
|
||||||
'tr_successful' => __('Orders were uploaded', 'retailcrm'),
|
'tr_successful' => __('Orders were uploaded', 'retailcrm'),
|
||||||
);
|
];
|
||||||
|
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
array(
|
[
|
||||||
'count_orders' => $this->uploader->getCountOrders(),
|
'count_orders' => $this->uploader->getCountOrders(),
|
||||||
'count_users' => $this->uploader->getCountUsers(),
|
'count_users' => $this->uploader->getCountUsers(),
|
||||||
'translate' => $translate,
|
'translate' => $translate,
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
wp_die();
|
wp_die();
|
||||||
@ -524,12 +528,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
$icml = $defaultValue;
|
$icml = $defaultValue;
|
||||||
$history = $defaultValue;
|
$history = $defaultValue;
|
||||||
$inventories = $defaultValue;
|
$inventories = $defaultValue;
|
||||||
$translate = array(
|
$translate = [
|
||||||
'tr_td_cron' => __('Cron launches', 'retailcrm'),
|
'tr_td_cron' => __('Cron launches', 'retailcrm'),
|
||||||
'tr_td_icml' => __('Generation ICML', 'retailcrm'),
|
'tr_td_icml' => __('Generation ICML', 'retailcrm'),
|
||||||
'tr_td_history' => __('Syncing history', 'retailcrm'),
|
'tr_td_history' => __('Syncing history', 'retailcrm'),
|
||||||
'tr_td_inventories' => __('Syncing inventories', 'retailcrm'),
|
'tr_td_inventories' => __('Syncing inventories', 'retailcrm'),
|
||||||
);
|
];
|
||||||
|
|
||||||
if (isset($this->settings['history']) && $this->settings['history'] == static::YES) {
|
if (isset($this->settings['history']) && $this->settings['history'] == static::YES) {
|
||||||
$history = date( 'H:i:s d-m-Y', wp_next_scheduled('retailcrm_history'));
|
$history = date( 'H:i:s d-m-Y', wp_next_scheduled('retailcrm_history'));
|
||||||
@ -544,12 +548,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
array(
|
[
|
||||||
'history' => $history,
|
'history' => $history,
|
||||||
'icml' => $icml,
|
'icml' => $icml,
|
||||||
'inventories' => $inventories,
|
'inventories' => $inventories,
|
||||||
'translate' => $translate,
|
'translate' => $translate,
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
wp_die();
|
wp_die();
|
||||||
@ -560,23 +564,27 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
*/
|
*/
|
||||||
public function set_meta_fields()
|
public function set_meta_fields()
|
||||||
{
|
{
|
||||||
|
if (!$this->apiClient instanceof WC_Retailcrm_Proxy) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$orderMetaData = $this->getMetaData('order');
|
$orderMetaData = $this->getMetaData('order');
|
||||||
$customerMetaData = $this->getMetaData('user');
|
$customerMetaData = $this->getMetaData('user');
|
||||||
$orderCustomFields = $this->getCustomFields('order');
|
$orderCustomFields = $this->getCustomFields('order');
|
||||||
$customerCustomFields = $this->getCustomFields('customer');
|
$customerCustomFields = $this->getCustomFields('customer');
|
||||||
|
|
||||||
$translate = array(
|
$translate = [
|
||||||
'tr_lb_order' => __('Custom fields for order', 'retailcrm'),
|
'tr_lb_order' => __('Custom fields for order', 'retailcrm'),
|
||||||
'tr_lb_customer' => __('Custom fields for customer', 'retailcrm'),
|
'tr_lb_customer' => __('Custom fields for customer', 'retailcrm'),
|
||||||
'tr_btn' => __('Add new select for order', 'retailcrm'),
|
'tr_btn' => __('Add new select for order', 'retailcrm'),
|
||||||
);
|
];
|
||||||
|
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
array(
|
[
|
||||||
'order' => array('custom' => $orderCustomFields, 'meta' => $orderMetaData),
|
'order' => ['custom' => $orderCustomFields, 'meta' => $orderMetaData],
|
||||||
'customer' => array('custom' => $customerCustomFields, 'meta' => $customerMetaData),
|
'customer' => ['custom' => $customerCustomFields, 'meta' => $customerMetaData],
|
||||||
'translate' => $translate,
|
'translate' => $translate,
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
wp_die();
|
wp_die();
|
||||||
@ -589,8 +597,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
*/
|
*/
|
||||||
private function getCustomFields($entity)
|
private function getCustomFields($entity)
|
||||||
{
|
{
|
||||||
$customFields = array('default_retailcrm' => __('Select value', 'retailcrm'));
|
$customFields = ['default_retailcrm' => __('Select value', 'retailcrm')];
|
||||||
$getCustomFields = $this->apiClient->customFieldsList(array('entity' => $entity), 100);
|
$getCustomFields = $this->apiClient->customFieldsList(['entity' => $entity], 100);
|
||||||
|
|
||||||
if (!empty($getCustomFields['customFields']) && $getCustomFields->isSuccessful()) {
|
if (!empty($getCustomFields['customFields']) && $getCustomFields->isSuccessful()) {
|
||||||
foreach ($getCustomFields['customFields'] as $field) {
|
foreach ($getCustomFields['customFields'] as $field) {
|
||||||
@ -614,7 +622,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
|
|
||||||
$table = $entity === 'order' ? $wpdb->postmeta : $wpdb->usermeta;
|
$table = $entity === 'order' ? $wpdb->postmeta : $wpdb->usermeta;
|
||||||
|
|
||||||
$metaData = array('default_retailcrm' => __('Select value', 'retailcrm'));
|
$metaData = ['default_retailcrm' => __('Select value', 'retailcrm')];
|
||||||
$sqlQuery = "SELECT DISTINCT `meta_key` FROM $table ORDER BY `meta_key`";
|
$sqlQuery = "SELECT DISTINCT `meta_key` FROM $table ORDER BY `meta_key`";
|
||||||
$defaultMetaFields = file(
|
$defaultMetaFields = file(
|
||||||
__DIR__ . '/../assets/default/default_meta_fields.txt',
|
__DIR__ . '/../assets/default/default_meta_fields.txt',
|
||||||
|
@ -91,6 +91,10 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||||||
*/
|
*/
|
||||||
protected function customersHistory()
|
protected function customersHistory()
|
||||||
{
|
{
|
||||||
|
if (!$this->retailcrm instanceof WC_Retailcrm_Proxy) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$sinceId = get_option('retailcrm_customers_history_since_id');
|
$sinceId = get_option('retailcrm_customers_history_since_id');
|
||||||
$pagination = 1;
|
$pagination = 1;
|
||||||
|
|
||||||
@ -193,6 +197,10 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||||||
*/
|
*/
|
||||||
protected function ordersHistory()
|
protected function ordersHistory()
|
||||||
{
|
{
|
||||||
|
if (!$this->retailcrm instanceof WC_Retailcrm_Proxy) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$options = array_flip(array_filter($this->retailcrmSettings));
|
$options = array_flip(array_filter($this->retailcrmSettings));
|
||||||
$sinceId = get_option('retailcrm_orders_history_since_id');
|
$sinceId = get_option('retailcrm_orders_history_since_id');
|
||||||
$pagination = 1;
|
$pagination = 1;
|
||||||
|
@ -136,3 +136,17 @@ function is_wplogin()
|
|||||||
|| $_SERVER['PHP_SELF'] == '/wp-login.php'
|
|| $_SERVER['PHP_SELF'] == '/wp-login.php'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate API url.
|
||||||
|
*
|
||||||
|
* @param string $url URL of Simla.com.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function validateUrl(string $url)
|
||||||
|
{
|
||||||
|
return (preg_match("/https:\/\/(.*).(retailcrm.(pro|ru|es)|simla.com)/", $url)) ? $url : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
|||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Requires at least: 5.3
|
Requires at least: 5.3
|
||||||
Tested up to: 5.9
|
Tested up to: 5.9
|
||||||
Stable tag: 4.4.3
|
Stable tag: 4.4.4
|
||||||
License: GPLv1 or later
|
License: GPLv1 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
||||||
|
|
||||||
@ -82,6 +82,14 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
|
|||||||
|
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 4.4.4 =
|
||||||
|
* Add product description to ICML
|
||||||
|
* Fix fatal error using API without api_key
|
||||||
|
* Add priceType processing to CRM order by history
|
||||||
|
* Add method in API V5 and delete use another version
|
||||||
|
* Fix error with integration payments
|
||||||
|
* Fix bug with changing order status by history
|
||||||
|
|
||||||
= 4.4.3 =
|
= 4.4.3 =
|
||||||
* Fix bug in updating order number by history
|
* Fix bug in updating order number by history
|
||||||
* Add multiple image transfer in ICML
|
* Add multiple image transfer in ICML
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
* Description: Integration plugin for WooCommerce & Simla.com
|
* Description: Integration plugin for WooCommerce & Simla.com
|
||||||
* Author: RetailDriver LLC
|
* Author: RetailDriver LLC
|
||||||
* Author URI: http://retailcrm.pro/
|
* Author URI: http://retailcrm.pro/
|
||||||
* Version: 4.4.3
|
* Version: 4.4.4
|
||||||
* Tested up to: 5.9
|
* Tested up to: 5.9
|
||||||
* WC requires at least: 5.4
|
* WC requires at least: 5.4
|
||||||
* WC tested up to: 6.2
|
* WC tested up to: 6.5
|
||||||
* Text Domain: retailcrm
|
* Text Domain: retailcrm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||||
*
|
*
|
||||||
* @version 4.4.3
|
* @version 4.4.4
|
||||||
*
|
*
|
||||||
* @package RetailCRM
|
* @package RetailCRM
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user