ICML catalog settings updating
This commit is contained in:
parent
6ad9fc2661
commit
4ef67f595e
@ -107,6 +107,16 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
)
|
||||
);
|
||||
|
||||
$post = $this->get_post_data();
|
||||
$apiUrl = !empty($post[$this->plugin_id . $this->id . '_api_url']) ? $post[$this->plugin_id . $this->id . '_api_url'] : null;
|
||||
$apiKey = !empty($post[$this->plugin_id . $this->id . '_api_key']) ? $post[$this->plugin_id . $this->id . '_api_key'] : null;
|
||||
|
||||
if ($this->apiClient) {
|
||||
if (isset($_GET['page']) && $_GET['page'] == 'wc-settings'
|
||||
&& isset($_GET['tab']) && $_GET['tab'] == 'integration'
|
||||
) {
|
||||
add_action('admin_print_footer_scripts', array($this, 'show_blocks'), 99);
|
||||
|
||||
$this->form_fields[] = array(
|
||||
'title' => __( 'API settings', 'retailcrm' ),
|
||||
'type' => 'title',
|
||||
@ -141,7 +151,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
|
||||
$this->form_fields[] = array(
|
||||
'title' => __( 'Catalog settings', 'retailcrm' ),
|
||||
'type' => 'title',
|
||||
'type' => 'heading',
|
||||
'description' => '',
|
||||
'id' => 'catalog_options'
|
||||
);
|
||||
@ -157,12 +167,6 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->apiClient) {
|
||||
if (isset($_GET['page']) && $_GET['page'] == 'wc-settings'
|
||||
&& isset($_GET['tab']) && $_GET['tab'] == 'integration'
|
||||
) {
|
||||
add_action('admin_print_footer_scripts', array($this, 'show_blocks'), 99);
|
||||
|
||||
/**
|
||||
* Client roles options
|
||||
*/
|
||||
@ -550,6 +554,18 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
'class' => 'debug_info_options'
|
||||
);
|
||||
}
|
||||
} elseif (empty($apiUrl) === false && empty($apiKey) === false) {
|
||||
$api = new WC_Retailcrm_Proxy(
|
||||
$apiUrl,
|
||||
$apiKey,
|
||||
$this->get_option('corporate_enabled', 'no') === 'yes'
|
||||
);
|
||||
|
||||
$response = $api->apiVersions();
|
||||
|
||||
if ($response->isSuccessful()) {
|
||||
header("Refresh:0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user