Changeset 3295364
- Timestamp:
- 05/17/2025 05:42:12 PM (11 months ago)
- Location:
- ilachat/trunk
- Files:
-
- 1 added
- 6 edited
-
assets/css/ilachat-admin.css (modified) (1 diff)
-
assets/js/ilachat-editor-sync.js (added)
-
assets/js/ilachat-woocommerce.js (modified) (1 diff)
-
languages/ilachat.pot (modified) (4 diffs)
-
src/Admin/Connection.php (modified) (1 diff)
-
src/Integrations/Woocommerce.php (modified) (7 diffs)
-
src/Integrations/Wordpress.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ilachat/trunk/assets/css/ilachat-admin.css
r3295270 r3295364 40 40 border: 1px solid #c3c4c7; 41 41 margin: 0 0.25em; 42 } 43 44 a.ilachat-plan-name { 45 text-decoration: none; 46 background-color: #06f; 47 border-color: #005cd4; 48 color: #fff; 49 } 50 51 a.ilachat-plan-name:hover { 52 background-color: #005cd4; 53 border-color: #005cd4; 42 54 } 43 55 -
ilachat/trunk/assets/js/ilachat-woocommerce.js
r3295270 r3295364 205 205 if (data.success) { 206 206 const responseData = data.data; 207 // Check for limit_message and show admin error notice 208 if (responseData.limit_message) { 209 // Stop further syncing 210 this.resetSync(); 211 // Show an admin error notice after the page header 212 const header = document.querySelector('.ilachat-wrap h1'); 213 if (header) { 214 const notice = document.createElement('div'); 215 notice.className = 'notice notice-error is-dismissible'; 216 notice.innerHTML = '<p>' + responseData.limit_message + '</p>'; 217 header.insertAdjacentElement('afterend', notice); 218 } 219 return; 220 } 207 221 this.updateMessage(responseData.success, responseData.error); 208 222 -
ilachat/trunk/languages/ilachat.pot
r3295270 r3295364 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-05-17T1 5:34:04+02:00\n"12 "POT-Creation-Date: 2025-05-17T19:27:57+02:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 84 84 msgstr "" 85 85 86 #: src/Admin/Connection.php:16 786 #: src/Admin/Connection.php:169 87 87 msgid "Ilachat has been successfully connected." 88 88 msgstr "" 89 89 90 #: src/Integrations/Woocommerce.php:14991 90 #: src/Integrations/Woocommerce.php:150 92 #: src/Integrations/Woocommerce.php:175 91 #: src/Integrations/Woocommerce.php:151 92 #: src/Integrations/Woocommerce.php:176 93 93 #: templates/admin/wc-integration-page.php:51 94 94 msgid "WooCommerce Integration" 95 95 msgstr "" 96 96 97 #: src/Integrations/Woocommerce.php:3 2997 #: src/Integrations/Woocommerce.php:330 98 98 msgid "Order tracking is disabled" 99 99 msgstr "" 100 100 101 #: src/Integrations/Woocommerce.php:33 7101 #: src/Integrations/Woocommerce.php:338 102 102 msgid "Order ID is required" 103 103 msgstr "" 104 104 105 #: src/Integrations/Woocommerce.php:34 2105 #: src/Integrations/Woocommerce.php:343 106 106 msgid "Order not found" 107 107 msgstr "" 108 108 109 #: src/Integrations/Woocommerce.php:34 7109 #: src/Integrations/Woocommerce.php:348 110 110 msgid "Invalid phone number" 111 111 msgstr "" 112 112 113 #: src/Integrations/Woocommerce.php:35 2113 #: src/Integrations/Woocommerce.php:353 114 114 msgid "Invalid email address" 115 115 msgstr "" 116 116 117 #: src/Integrations/Woocommerce.php:55 7118 #: src/Integrations/Woocommerce.php:63 1117 #: src/Integrations/Woocommerce.php:558 118 #: src/Integrations/Woocommerce.php:632 119 119 msgid "Please enter a note." 120 120 msgstr "" 121 121 122 #: src/Integrations/Woocommerce.php:55 8122 #: src/Integrations/Woocommerce.php:559 123 123 msgid "An error occurred while doing the request." 124 124 msgstr "" 125 125 126 #: src/Integrations/Woocommerce.php:5 59126 #: src/Integrations/Woocommerce.php:560 127 127 #: templates/admin/wc-order-notes.php:38 128 128 msgid "Delete note" 129 129 msgstr "" 130 130 131 #: src/Integrations/Woocommerce.php:56 0131 #: src/Integrations/Woocommerce.php:561 132 132 msgid "Are you sure you want to delete this note? This action cannot be undone." 133 133 msgstr "" 134 134 135 #: src/Integrations/Woocommerce.php:56 1135 #: src/Integrations/Woocommerce.php:562 136 136 msgid "Pause sync" 137 137 msgstr "" 138 138 139 #: src/Integrations/Woocommerce.php:56 2139 #: src/Integrations/Woocommerce.php:563 140 140 msgid "Resume sync" 141 141 msgstr "" 142 142 143 #: src/Integrations/Woocommerce.php:56 3143 #: src/Integrations/Woocommerce.php:564 144 144 msgid "Sync Products" 145 145 msgstr "" 146 146 147 #: src/Integrations/Woocommerce.php:58 3147 #: src/Integrations/Woocommerce.php:584 148 148 msgid "Ilachat Order Notes" 149 149 msgstr "" 150 150 151 #: src/Integrations/Woocommerce.php:62 6151 #: src/Integrations/Woocommerce.php:627 152 152 msgid "Invalid order." 153 153 msgstr "" 154 154 155 #: src/Integrations/Woocommerce.php:63 5156 #: src/Integrations/Woocommerce.php:71 2155 #: src/Integrations/Woocommerce.php:636 156 #: src/Integrations/Woocommerce.php:713 157 157 msgid "You do not have permission to add notes to this order." 158 158 msgstr "" 159 159 160 #: src/Integrations/Woocommerce.php:64 0160 #: src/Integrations/Woocommerce.php:641 161 161 msgid "Failed to add note." 162 162 msgstr "" 163 163 164 #: src/Integrations/Woocommerce.php:70 8164 #: src/Integrations/Woocommerce.php:709 165 165 msgid "Invalid comment ID." 166 166 msgstr "" 167 167 168 #: src/Integrations/Woocommerce.php:71 7168 #: src/Integrations/Woocommerce.php:718 169 169 msgid "Failed to delete note." 170 170 msgstr "" 171 171 172 #: src/Integrations/Woocommerce.php:999173 172 #: src/Integrations/Woocommerce.php:1014 173 #: src/Integrations/Woocommerce.php:1029 174 174 #: src/Integrations/Wordpress.php:289 175 175 #: src/Integrations/Wordpress.php:304 176 #: assets/js/ editor-sync.js:19177 #: assets/js/ editor-sync.js:21178 #: assets/js/ editor-sync.js:48176 #: assets/js/ilachat-editor-sync.js:19 177 #: assets/js/ilachat-editor-sync.js:21 178 #: assets/js/ilachat-editor-sync.js:48 179 179 msgid "Sync with Ilachat" 180 180 msgstr "" 181 181 182 #: src/Integrations/Woocommerce.php:10 01182 #: src/Integrations/Woocommerce.php:1016 183 183 #: src/Integrations/Wordpress.php:291 184 #: assets/js/ editor-sync.js:14185 #: assets/js/ editor-sync.js:38184 #: assets/js/ilachat-editor-sync.js:14 185 #: assets/js/ilachat-editor-sync.js:38 186 186 msgid "Last synced:" 187 187 msgstr "" 188 188 189 189 #. translators: %s is the number of products successfully synced with Ilachat. 190 #: src/Integrations/Woocommerce.php:10 80190 #: src/Integrations/Woocommerce.php:1096 191 191 msgid "Synced %s product with Ilachat." 192 192 msgid_plural "Synced %s products with Ilachat." … … 195 195 196 196 #. translators: %s is the number of products that failed to sync with Ilachat. 197 #: src/Integrations/Woocommerce.php:1 094197 #: src/Integrations/Woocommerce.php:1110 198 198 msgid "Failed to sync %s product with Ilachat." 199 199 msgid_plural "Failed to sync %s products with Ilachat." 200 200 msgstr[0] "" 201 201 msgstr[1] "" 202 203 #: src/Integrations/Woocommerce.php:1174 204 msgid "Product data limit reached. Please upgrade your plan." 205 msgstr "" 202 206 203 207 #: src/Integrations/Wordpress.php:182 … … 410 414 msgstr "" 411 415 412 #: assets/js/ editor-sync.js:15413 #: assets/js/ editor-sync.js:39416 #: assets/js/ilachat-editor-sync.js:15 417 #: assets/js/ilachat-editor-sync.js:39 414 418 msgid "This post will be synced with Ilachat when you save it." 415 419 msgstr "" -
ilachat/trunk/src/Admin/Connection.php
r3295270 r3295364 163 163 self::set_bot_details($validated_token); 164 164 165 do_action('ilachat_after_connect'); 166 165 167 self::flush_page_cache(); 166 168 -
ilachat/trunk/src/Integrations/Woocommerce.php
r3295270 r3295364 35 35 add_action('ilachat_settings_page_after_buttons', [$this, 'add_settings_page_buttons']); 36 36 add_action('updated_option', [$this, 'sync_variable_links_after_update'], 10, 3); 37 add_action('ilachat_after_connect', [$this, 'sync_variable_links'], 10); 37 38 38 39 if (get_option('ilachat_woocommerce_integration_enabled', 1)) { … … 820 821 * 821 822 * @param object $product 822 * @return bool 823 * @return bool|void 823 824 */ 824 825 public static function sync_product($product) 825 826 { 826 827 if (! $product) { 827 return false;828 return; 828 829 } 829 830 830 831 if ('publish' !== $product->get_status()) { 831 return false;832 return; 832 833 } 833 834 834 835 if (! apply_filters('ilachat_should_sync_product', true, $product)) { 835 return false;836 return; 836 837 } 837 838 838 839 $token = get_option('ilachat_token', ''); 839 840 if (empty($token)) { 840 return false;841 return; 841 842 } 842 843 … … 918 919 } 919 920 921 if (empty($body['variations'])) { 922 return; 923 } 924 920 925 $body = apply_filters('ilachat_woocommerce_sync_product_data', $body, $product); 921 926 … … 927 932 928 933 if (empty($response['status']) || 'success' !== $response['status']) { 934 if (defined('WP_DEBUG') && WP_DEBUG === true) { 935 // phpcs:disable WordPress.PHP.DevelopmentFunctions 936 error_log('Ilachat Sync Product Error: ' . $response['message']); 937 // phpcs:enable 938 } 939 940 if (isset($response['code']) && 403 == $response['code']) { 941 set_transient('ilachat_product_limit_reached', true, 5 * MINUTE_IN_SECONDS); 942 } 943 929 944 return false; 930 945 } … … 1034 1049 $product = wc_get_product($post_id); 1035 1050 if ($product) { 1036 if (self::sync_product($product)) { 1051 $result = self::sync_product($product); 1052 if ($result === true) { 1037 1053 $update_status['success']++; 1038 } else {1054 } elseif ($result === false) { 1039 1055 $update_status['error']++; 1040 1056 } … … 1138 1154 continue; 1139 1155 } 1140 if (self::sync_product($product)) { 1156 if (get_transient('ilachat_product_limit_reached')) { 1157 break; 1158 } 1159 $result = self::sync_product($product); 1160 if ($result === true) { 1141 1161 $success++; 1142 } else {1162 } elseif ($result === false) { 1143 1163 $error++; 1144 1164 } … … 1148 1168 1149 1169 $response = [ 1150 'success' => $success, 1151 'error' => $error, 1152 'offset' => $offset, 1153 'total' => $total_products, 1170 'success' => $success, 1171 'error' => $error, 1172 'offset' => $offset, 1173 'total' => $total_products, 1174 'limit_message' => get_transient('ilachat_product_limit_reached') ? esc_html__('Product data limit reached. Please upgrade your plan.', 'ilachat') : '', 1154 1175 ]; 1155 1176 -
ilachat/trunk/src/Integrations/Wordpress.php
r3295270 r3295364 98 98 wp_enqueue_script( 99 99 'ilachat-editor-sync', 100 ILACHAT_URL . 'assets/js/ editor-sync.js',100 ILACHAT_URL . 'assets/js/ilachat-editor-sync.js', 101 101 ['wp-plugins', 'wp-edit-post', 'wp-element', 'wp-components', 'wp-data', 'wp-core-data', 'wp-i18n'], 102 102 ILACHAT_VERSION,
Note: See TracChangeset
for help on using the changeset viewer.