Skip to content

Commit 142fb3b

Browse files
Implemented chat binding to customers in the CRM via the _rcco object of the online consultant (retailcrm#385)
1 parent 1bcaf84 commit 142fb3b

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2025-09-02 5.0.1
2+
* Implemented chat binding to customers in the CRM via the _rcco object of the online consultant
3+
14
## 2025-09-01 5.0.0
25
* Plugin update for WordPress compliance
36
* Starting with this version, changes have been made to the customization mechanism and core functions that are not compatible with earlier versions. Before updating, review the module structure and function names to make the necessary adjustments to custom files.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
5.0.1

src/include/class-wc-retailcrm-base.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public function __construct($retailcrm = false)
107107
add_action('wp_print_scripts', [$this, 'initialize_online_assistant'], 101);
108108
add_action('wp_enqueue_scripts', [$this, 'include_whatsapp_icon_style'], 101);
109109
add_action('wp_enqueue_scripts', [$this, 'include_js_script_for_tracker'], 101);
110+
add_action('wp_enqueue_scripts', [$this, 'enqueue_online_consultant_script_for_user'], 99);
110111
add_action('wp_print_footer_scripts', [$this, 'initialize_whatsapp'], 101);
111112
add_action('wp_print_footer_scripts', [$this, 'send_analytics'], 99);
112113
add_action('admin_enqueue_scripts', [$this, 'include_files_for_admin'], 101);
@@ -1163,6 +1164,27 @@ private function include_js_scripts_for_admin()
11631164
$this->include_js_translates_for_tracker();
11641165
}
11651166

1167+
public function enqueue_online_consultant_script_for_user()
1168+
{
1169+
if ($this->get_option('online_assistant') !== '' && is_user_logged_in()) {
1170+
$user = wp_get_current_user();
1171+
1172+
// wp_localize_script() can only be applied to a script that is registered and enqueued.
1173+
// Since we don't have an actual JS file, we register and enqueue a "dummy" script.
1174+
wp_register_script('retailcrm-widget', false, [], '1.0.0', false);
1175+
wp_enqueue_script('retailcrm-widget');
1176+
1177+
// '_rcco' is an external variable used by Online Consult. We cannot rename it to 'retailcrm_rcco'
1178+
// because it must match the expected global variable name in the Online Consultant widget.
1179+
wp_localize_script('retailcrm-widget', '_rcco', [
1180+
'customer' => [
1181+
'name' => $user->display_name,
1182+
'customer_id' => $user->ID,
1183+
]
1184+
]);
1185+
}
1186+
}
1187+
11661188
public function include_js_script_for_tracker()
11671189
{
11681190
$scriptName = 'retailcrm-tracker';

src/readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: crm, marketing, e-com
44
Requires PHP: 7.1
55
Requires at least: 5.3
66
Tested up to: 6.8
7-
Stable tag: 5.0.0
7+
Stable tag: 5.0.1
88
License: MIT
99
License URI: https://github.com/retailcrm/woocommerce-module/blob/master/LICENSE
1010

@@ -83,6 +83,9 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
8383

8484

8585
== Changelog ==
86+
= 5.0.1 =
87+
* Implemented chat binding to customers in the CRM via the _rcco object of the online consultant
88+
8689
= 5.0.0 =
8790
* Plugin update for WordPress compliance
8891
* Starting with this version, changes have been made to the customization mechanism and core functions that are not compatible with earlier versions. Before updating, review the module structure and function names to make the necessary adjustments to custom files.

src/uninstall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @link https://wordpress.org/plugins/woo-retailcrm/
1818
*
19-
* @version 5.0.0
19+
* @version 5.0.1
2020
*
2121
* @package RetailCRM
2222
*/

src/woo-retailcrm.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
* Author URI: http://retailcrm.pro/
88
* License: MIT
99
* License URI: https://github.com/retailcrm/woocommerce-module/blob/master/LICENSE
10-
* Version: 5.0.0
10+
* Version: 5.0.1
1111
* Tested up to: 6.8
1212
* Requires Plugins: woocommerce
1313
* WC requires at least: 5.4
1414
* WC tested up to: 10.0
1515
* Text Domain: woo-retailcrm
16+
* Domain Path: /languages
1617
*/
1718

1819
if ( ! defined( 'ABSPATH' ) ) {
@@ -29,7 +30,7 @@
2930
class WC_Integration_Retailcrm {
3031
const WOOCOMMERCE_SLUG = 'woocommerce';
3132
const WOOCOMMERCE_PLUGIN_PATH = 'woocommerce/woocommerce.php';
32-
const MODULE_VERSION = '5.0.0';
33+
const MODULE_VERSION = '5.0.1';
3334

3435
private static $instance;
3536

0 commit comments

Comments
 (0)