1
0
Fork 0
mirror of synced 2025-04-06 07:13:33 +03:00
Добавление хука на активацию модуля
This commit is contained in:
Ivan Chaplygin 2023-11-17 12:54:35 +03:00
parent 97cc1c1337
commit 5d43015f5a
2 changed files with 18 additions and 0 deletions

View file

@ -129,6 +129,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
// Deactivate hook
add_action('retailcrm_deactivate', [$this, 'deactivate']);
//Activation of the configured module
add_action('retailcrm_activate', [$this, 'activate']);
}
/**
@ -866,6 +868,20 @@ if (!class_exists('WC_Retailcrm_Base')) {
delete_option('retailcrm_active_in_crm');
}
/**
* @return void
*/
public function activate()
{
$api_client = $this->getApiClient();
$clientId = get_option('retailcrm_client_id');
if ($api_client && $clientId) {
WC_Retailcrm_Plugin::integration_module($api_client, $clientId);
update_option('retailcrm_active_in_crm', true);
}
}
/**
* @param $settings
*

View file

@ -97,6 +97,8 @@ class WC_Retailcrm_Plugin
require_once(WC_Integration_Retailcrm::checkCustomFile('include/class-wc-retailcrm-base.php'));
}
do_action('retailcrm_activate');
$retailcrm_icml = new WC_Retailcrm_Icml();
$retailcrm_icml->generate();
}