PluginProbe
Spoki – Chat Buttons and WooCommerce Notifications / 2.0.8
Spoki – Chat Buttons and WooCommerce Notifications v2.0.8
2.17.4 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.10.0 2.11.0 2.11.1 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.14.0 All 69 releases
spoki / views / html-woocommerce.php

html-woocommerce.php in Spoki – Chat Buttons and WooCommerce Notifications 2.0.8, at views/html-woocommerce.php

664 lines 44.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $has_wc = is_plugin_active('woocommerce/woocommerce.php');
3 $sections = ['order_status', 'single_product', 'product_item', 'cart'];
4 $current_section = isset($_GET['section']) && in_array($_GET['section'], $sections) ? $_GET['section'] : $sections[0];
5 $is_current_tab = $GLOBALS['current_tab'] == 'WooCommerce';
6
7 if (false == $has_wc) : ?>
8 <div class="notice notice-error">
9 <p>
10 <?php _e("Install and activate the <strong>WooCommerce</strong> plugin to enable the Spoki features for WooCommerce.", "spoki") ?>
11 </p>
12 </div>
13 <?php endif ?>
14
15
16 <div <?php if (!$is_current_tab) echo 'style="display:none"' ?>>
17 <ul class="subsubsub">
18 <li><a href="<?php echo "?page=" . urlencode(SPOKI_PLUGIN_NAME) . "&tab=" . urlencode($GLOBALS['current_tab']) ?>&section=order_status" <?php if ($current_section == 'order_status') echo "class='current'" ?>><?php _e('Order status', "spoki") ?></a> |</li>
19 <li><a href="<?php echo "?page=" . urlencode(SPOKI_PLUGIN_NAME) . "&tab=" . urlencode($GLOBALS['current_tab']) ?>&section=product_item" <?php if ($current_section == 'product_item') echo "class='current'" ?>><?php _e('Shop page', "spoki") ?></a> |</li>
20 <li><a href="<?php echo "?page=" . urlencode(SPOKI_PLUGIN_NAME) . "&tab=" . urlencode($GLOBALS['current_tab']) ?>&section=single_product" <?php if ($current_section == 'single_product') echo "class='current'" ?>><?php _e('Product page', "spoki") ?></a> |</li>
21 <li><a href="<?php echo "?page=" . urlencode(SPOKI_PLUGIN_NAME) . "&tab=" . urlencode($GLOBALS['current_tab']) ?>&section=cart" <?php if ($current_section == 'cart') echo "class='current'" ?>><?php _e('Cart page', "spoki") ?></a></li>
22 </ul>
23
24 <div <?php if ($current_section != 'order_status') echo "style='display:none'" ?>>
25 <br/>
26 <br/>
27 <h2><?php _e('Order status', "spoki") ?></h2>
28 <p>
29 <?php _e('Send order notifications via WhatsApp to your customer. Select the order statuses to send to your customer.', "spoki") ?><br/>
30 <?php _e('The Custom fields, eg: <code>[FIRST_NAME]</code> present within the templates, are fields that Spoki will automatically fill with information relating to the store.', "spoki") ?>
31 </p>
32 <img class="cover-image" src="<?php echo plugins_url() . '/' . SPOKI_PLUGIN_NAME . '/assets/images/order-status.png' ?>"/>
33
34 <fieldset <?php if (false == $has_wc) : ?>disabled<?php endif ?>>
35 <div id="notifications-success" class="notifications-status-message" style="display: none">
36 <p><?php _e("Notifications activated succesfully!", "spoki") ?> 🎉</p>
37 <a><?php _e("Disable all", "spoki") ?></a>
38 </div>
39
40 <div id="notifications-warning" class="notifications-status-message bg-danger" style="display: none">
41 <p>⚠️ <?php _e("There are not active notifications.", "spoki") ?></p>
42 <a><?php _e("Enable all", "spoki") ?></a>
43 </div>
44
45 <?php if ($is_current_tab): ?>
46 <table class="form-table">
47 <tr>
48 <th>
49 <label for="single_product_button_position">
50 <b><?php _e('Notifications language', "spoki") ?></b>
51 </label>
52 </th>
53 <td>
54 <?php
55 $language = Spoki()->shop['language'];
56 $is_spanish = spoki_starts_with($language, 'es');
57 $is_italian = spoki_starts_with($language, 'it');
58 $is_portoguese = spoki_starts_with($language, 'pt');
59 $is_english = !$is_italian && !$is_spanish && !$is_portoguese;
60 ?>
61 <select name="<?php echo SPOKI_OPTIONS ?>[language]" id="language" class="regular-text">
62 <option value="en-EN" <?php echo $is_english ? 'selected' : '' ?>><?php echo __('English', "spoki") ?></option>
63 <option value="it-IT" <?php echo $is_italian ? 'selected' : '' ?>><?php echo __('Italian', "spoki") ?></option>
64 <option value="es-ES" <?php echo $is_spanish ? 'selected' : '' ?>><?php echo __('Spanish', "spoki") ?></option>
65 <option value="pt-PT" <?php echo $is_portoguese ? 'selected' : '' ?>><?php echo __('Portuguese', "spoki") ?></option>
66 </select>
67 <p class="description">
68 <?php _e('Your language is not in list?', "spoki") ?> <a target="_blank" href="<?php echo SPOKI_SUGGEST_TEMPLATES_URL ?>"><?php _e('Suggest messages', "spoki") ?></a>
69 </p>
70 </td>
71 </tr>
72 </table>
73 <?php endif; ?>
74
75 <table class="form-table">
76 <tr>
77 <td>
78 <input class="notification-check" type="checkbox" id="check_order_created"
79 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][order_created]"
80 value="1" <?php if (isset($this->options['woocommerce']['order_created'])) echo checked(1, $this->options['woocommerce']['order_created'], false) ?>>
81 <label for="check_order_created"><?php _e('Order created', "spoki") ?></label>
82 <blockquote>
83 <code id="order_created_template">
84 <?php _e("👋 Hi [FIRST_NAME], your order n° \"[ORDER_NUMBER]\" 🛍 for the store [SHOP_NAME] has been created! 👍 Need support? ➡️➡️➡️ [CONTACT_LINK]", "spoki") ?>
85 </code>
86 </blockquote>
87 </td>
88 </tr>
89 <tr>
90 <td>
91 <input class="notification-check" type="checkbox" id="check_order_updated"
92 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][order_updated]"
93 value="1" <?php if (isset($this->options['woocommerce']['order_updated'])) echo checked(1, $this->options['woocommerce']['order_updated'], false) ?>>
94 <label for="check_order_updated"><?php _e('Order updated', "spoki") ?></label>
95 <blockquote>
96 <code id="order_updated_template">
97 <?php _e("👋 Hi [FIRST_NAME], your order n° \"[ORDER_NUMBER]\" 🛍 for the store [SHOP_NAME] has been updated and its status is \"[ORDER_STATUS]\". Need support? ➡️➡️➡️ [CONTACT_LINK]", "spoki") ?>
98 </code>
99 </blockquote>
100 </td>
101 </tr>
102 <tr>
103 <td>
104 <input class="notification-check" type="checkbox" id="check_order_deleted"
105 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][order_deleted]"
106 value="1" <?php if (isset($this->options['woocommerce']['order_deleted'])) echo checked(1, $this->options['woocommerce']['order_deleted'], false) ?>>
107 <label for="check_order_deleted"><?php _e('Order deleted', "spoki") ?></label>
108 <blockquote>
109 <code id="order_deleted_template">
110 <?php _e("👋 Hi [FIRST_NAME], your order n° \"[ORDER_NUMBER]\" 🛍 for the store [SHOP_NAME] has been updated and its status is CANCELED. Need support? ➡️➡️➡️ [CONTACT_LINK]", "spoki") ?>
111 </code>
112 </blockquote>
113 </td>
114 </tr>
115 <tr>
116 <td>
117 <input class="notification-check" type="checkbox" id="check_order_note_added"
118 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][order_note_added]"
119 value="1" <?php if (isset($this->options['woocommerce']['order_note_added'])) echo checked(1, $this->options['woocommerce']['order_note_added'], false) ?>>
120 <label for="check_order_note_added"><?php _e('Tracking number added', "spoki") ?></label>
121 <blockquote>
122 <code id="tracking_template">
123 <?php _e("👋 Hi [FIRST_NAME], your order n° \"[ORDER_NUMBER]\" 🛍 for the store [SHOP_NAME] has been shipped! 🚀 Here the shipping info: [SHIPPING_INFO] Need support? ➡️➡️➡️ [CONTACT_LINK]", "spoki") ?>
124 </code>
125 </blockquote>
126 <p class="description">
127 * <?php _e("All the fields relating to the Tracking Number are automatic except for the [SHIPPING_INFO] field that you will have to fill in by inserting in the note: “[tracking] followed by the tracking number” that you want to insert in the note. GLS integrates automatically!", "spoki") ?></p>
128 <img class="example" src="<?php echo plugins_url() . '/' . SPOKI_PLUGIN_NAME . '/assets/images/tracking_example.png' ?>"/>
129 </td>
130 </tr>
131 <?php /*
132 <tr>
133 <td>
134 <input type="checkbox" id="check_cart_abandoned"
135 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_abandoned]"
136 value="1" <?php if (isset($this->options['woocommerce']['cart_abandoned'])) echo checked(1, $this->options['woocommerce']['cart_abandoned'], false) ?>>
137 <label for="check_cart_abandoned"><?php _e('Cart abandoned', "spoki") ?></label>
138 <blockquote>
139 <code>message here</code>
140 </blockquote>
141 </td>
142 </tr>
143 */ ?>
144 </table>
145 </fieldset>
146 </div>
147
148 <div <?php if ($current_section != 'product_item') echo "style='display:none'" ?> >
149 <br/>
150 <br/>
151 <h2><?php _e('Shop page', "spoki") ?></h2>
152 <p><?php _e('Add a WhatsApp button for every product in the shop page.', "spoki") ?></p>
153 <img class="cover-image" src="<?php echo plugins_url() . '/' . SPOKI_PLUGIN_NAME . '/assets/images/shop-page-button.png' ?>"/>
154
155 <fieldset <?php if (false == $has_wc) : ?>disabled<?php endif ?>>
156 <table class="form-table">
157 <tr>
158 <th>
159 <label for="product_item_listing_button_check">
160 <b><?php _e('Enable', "spoki") ?></b>
161 </label>
162 </th>
163 <td>
164 <input type="checkbox" id="product_item_listing_button_check"
165 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_check]"
166 value="1" <?php if (isset($this->options['woocommerce']['product_item_listing_button_check'])) echo checked(1, $this->options['woocommerce']['product_item_listing_button_check'], false) ?>
167 />
168 <label for="product_item_listing_button_check">
169 <?php _e('Enable the button', "spoki") ?>
170 </label>
171 <p class="description">
172 * <?php _e('If you enable the chat button, you make it visible in the product list', "spoki") ?>
173 </p>
174 </td>
175 </tr>
176 <tr>
177 <th>
178 <label for="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_cta]">
179 <b><?php _e('Button text (CTA)', "spoki") ?></b>
180 </label>
181 </th>
182 <td>
183 <input type="text"
184 id="product_item_listing_button_cta"
185 class="regular-text"
186 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_cta]"
187 value="<?php if (isset($this->options['woocommerce']['product_item_listing_button_cta'])) echo $this->options['woocommerce']['product_item_listing_button_cta'] ?>"
188 placeholder="<?php _e("Request support on WhatsApp", "spoki") ?>"
189 />
190 <p class="description">
191 * <?php _e('Enter the text visible on the button', "spoki") ?>
192 </p>
193 </td>
194 </tr>
195 <tr>
196 <th>
197 <label for="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_text]">
198 <b><?php _e('Customer Message', "spoki") ?></b>
199 </label>
200 </th>
201 <td>
202 <textarea class="regular-text"
203 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_text]"
204 id="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_text]"
205 rows="5"
206 placeholder="<?php _e('Hi, I want to buy:', "spoki") ?>"><?php if (isset($this->options['woocommerce']['product_item_listing_button_text'])) echo $this->options['woocommerce']['product_item_listing_button_text'] ?></textarea>
207 <p class="description">
208 * <?php _e('Preset message in chat that the customer can send via a button to request product information', "spoki") ?>
209 </p>
210 </td>
211 </tr>
212 <tr>
213 <th scope="row">
214 <label for="product_item_listing_button_color">
215 <?php _e('Color', "spoki") ?>
216 </label>
217 </th>
218 <td>
219 <input type="color"
220 id="product_item_listing_button_color"
221 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_color]"
222 value="<?php echo (isset($this->options['woocommerce']['product_item_listing_button_color']) && $this->options['woocommerce']['product_item_listing_button_color'] !== '') ? $this->options['woocommerce']['product_item_listing_button_color'] : '#23D366' ?>"
223 >
224 <p class="description">
225 * <?php _e('Set the background color of the button (Suggested: <i>#23D366</i> - <i>rgb(35, 211, 102)</i>)', "spoki") ?>
226 </p>
227 </td>
228 </tr>
229 <tr>
230 <th>
231 <label for="product_item_listing_button_border">
232 <b><?php _e('Border type', "spoki") ?></b>
233 </label>
234 </th>
235 <td>
236 <?php $product_item_listing_button_border = isset($this->options['woocommerce']['product_item_listing_button_border']) ? $this->options['woocommerce']['product_item_listing_button_border'] : 'rounded' ?>
237 <select name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_border]" id="product_item_listing_button_border" class="regular-text">
238 <option value="rounded" <?php echo $product_item_listing_button_border == 'rounded' ? 'selected' : '' ?>><?php echo __('Rounded', "spoki") ?></option>
239 <option value="squared" <?php echo $product_item_listing_button_border == 'squared' ? 'selected' : '' ?>><?php echo __('Squared', "spoki") ?></option>
240 </select>
241 <p class="description">
242 * <?php _e('Choose the button border type', "spoki"); ?>
243 </p>
244 </td>
245 </tr>
246 <tr>
247 <th scope="row">
248 <label for="product_item_listing_button_margin_top">
249 <?php _e('Spece before button', "spoki") ?>
250 </label>
251 </th>
252 <td>
253 <label>
254 <input type="number" id="product_item_listing_button_margin_top"
255 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_margin_top]"
256 value="<?php echo (isset($this->options['woocommerce']['product_item_listing_button_margin_top']) && $this->options['woocommerce']['product_item_listing_button_margin_top'] !== '') ? $this->options['woocommerce']['product_item_listing_button_margin_top'] : '4' ?>">
257 px
258 </label>
259 <p class="description">
260 * <?php _e('Set the margin top value of the button', "spoki") ?>
261 </p>
262 </td>
263 </tr>
264 <tr>
265 <th scope="row">
266 <label for="product_item_listing_button_margin_bottom">
267 <?php _e('Space after button', "spoki") ?>
268 </label>
269 </th>
270 <td>
271 <label>
272 <input type="number" id="product_item_listing_button_margin_bottom"
273 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][product_item_listing_button_margin_bottom]"
274 value="<?php echo (isset($this->options['woocommerce']['product_item_listing_button_margin_bottom']) && $this->options['woocommerce']['product_item_listing_button_margin_bottom'] !== '') ? $this->options['woocommerce']['product_item_listing_button_margin_bottom'] : '4' ?>">
275 px
276 </label>
277 <p class="description">
278 * <?php _e('Set the margin bottom value of the button', "spoki") ?>
279 </p>
280 </td>
281 </tr>
282 </table>
283 </fieldset>
284 </div>
285
286 <div <?php if ($current_section != 'single_product') echo "style='display:none'" ?>>
287 <br/>
288 <br/>
289 <h2><?php _e('Product page', "spoki") ?></h2>
290 <p><?php _e('Add the WhatsApp button on the product detail page.', "spoki") ?></p>
291 <img class="cover-image" src="<?php echo plugins_url() . '/' . SPOKI_PLUGIN_NAME . '/assets/images/product-page-button.png' ?>"/>
292
293 <fieldset <?php if (false == $has_wc) : ?>disabled<?php endif ?>>
294 <table class="form-table">
295 <tr>
296 <th>
297 <label for="single_product_button_check">
298 <b><?php _e('Enable', "spoki") ?></b>
299 </label>
300 </th>
301 <td>
302 <input type="checkbox" id="single_product_button_check"
303 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_check]"
304 value="1" <?php if (isset($this->options['woocommerce']['single_product_button_check'])) echo checked(1, $this->options['woocommerce']['single_product_button_check'], false) ?>
305 />
306 <label for="single_product_button_check">
307 <?php _e('Enable the button', "spoki") ?>
308 </label>
309 <p class="description">
310 * <?php _e('If you enable the chat button you make it visible in the product detail', "spoki") ?>
311 </p>
312 </td>
313 </tr>
314 <tr>
315 <th>
316 <label for="single_product_button_position">
317 <b><?php _e('Button position', "spoki") ?></b>
318 </label>
319 </th>
320 <td>
321 <?php $single_product_button_position = isset($this->options['woocommerce']['single_product_button_position']) ? $this->options['woocommerce']['single_product_button_position'] : 'after_atc' ?>
322 <select name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_position]" id="single_product_button_position" class="regular-text">
323 <option value="after_atc" <?php echo $single_product_button_position == 'after_atc' ? 'selected' : '' ?>><?php echo __('After Add to Cart Button', "spoki") ?></option>
324 <option value="after_shortdesc" <?php echo $single_product_button_position == 'after_shortdesc' ? 'selected' : '' ?>><?php echo __('After Short Description', "spoki") ?></option>
325 </select>
326 <p class="description">
327 * <?php _e('Choose where to insert the chat button', "spoki"); ?>
328 </p>
329 </td>
330 </tr>
331 <tr>
332 <th>
333 <label for="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_cta]">
334 <b><?php _e('Button text (CTA)', "spoki") ?></b>
335 </label>
336 </th>
337 <td>
338 <input type="text"
339 id="single_product_button_cta"
340 class="regular-text"
341 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_cta]"
342 value="<?php if (isset($this->options['woocommerce']['single_product_button_cta'])) echo $this->options['woocommerce']['single_product_button_cta'] ?>"
343 placeholder="<?php _e("Request support on WhatsApp", "spoki") ?>"
344 />
345 <p class="description">
346 * <?php _e('Enter the text visible on the button', "spoki") ?>
347 </p>
348 </td>
349 </tr>
350 <tr>
351 <th>
352 <label for="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_text]">
353 <b><?php _e('Customer Message', "spoki") ?></b>
354 </label>
355 </th>
356 <td>
357 <textarea class="regular-text"
358 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_text]"
359 id="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_text]"
360 rows="5"
361 placeholder="<?php _e('Hi, I want to buy:', "spoki") ?>"
362 ><?php if (isset($this->options['woocommerce']['single_product_button_text'])) echo $this->options['woocommerce']['single_product_button_text'] ?></textarea>
363 <p class="description">
364 * <?php _e('The customer will send you the following message via WhatsApp whenever press on this button', "spoki") ?>
365 </p>
366 </td>
367 </tr>
368 <tr>
369 <th scope="row">
370 <label for="single_product_button_color">
371 <?php _e('Color', "spoki") ?>
372 </label>
373 </th>
374 <td>
375 <input type="color"
376 id="single_product_button_color"
377 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_color]"
378 value="<?php echo (isset($this->options['woocommerce']['single_product_button_color']) && $this->options['woocommerce']['single_product_button_color'] !== '') ? $this->options['woocommerce']['single_product_button_color'] : '#23D366' ?>"
379 >
380 <p class="description">
381 * <?php _e('Set the background color of the button (Suggested: <i>#23D366</i> - <i>rgb(35, 211, 102)</i>)', "spoki") ?>
382 </p>
383 </td>
384 </tr>
385 <tr>
386 <th>
387 <label for="single_product_button_border">
388 <b><?php _e('Border type', "spoki") ?></b>
389 </label>
390 </th>
391 <td>
392 <?php $single_product_button_border = isset($this->options['woocommerce']['single_product_button_border']) ? $this->options['woocommerce']['single_product_button_border'] : 'rounded' ?>
393 <select name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_border]" id="single_product_button_border" class="regular-text">
394 <option value="rounded" <?php echo $single_product_button_border == 'rounded' ? 'selected' : '' ?>><?php echo __('Rounded', "spoki") ?></option>
395 <option value="squared" <?php echo $single_product_button_border == 'squared' ? 'selected' : '' ?>><?php echo __('Squared', "spoki") ?></option>
396 </select>
397 <p class="description">
398 * <?php _e('Choose the button border type', "spoki"); ?>
399 </p>
400 </td>
401 </tr>
402 <tr>
403 <th scope="row">
404 <label for="single_product_button_margin_top">
405 <?php _e('Spece before button', "spoki") ?>
406 </label>
407 </th>
408 <td>
409 <label>
410 <input type="number" id="single_product_button_margin_top"
411 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_margin_top]"
412 value="<?php echo (isset($this->options['woocommerce']['single_product_button_margin_top']) && $this->options['woocommerce']['single_product_button_margin_top'] !== '') ? $this->options['woocommerce']['single_product_button_margin_top'] : '4' ?>">
413 px
414 </label>
415 <p class="description">
416 * <?php _e('Set the margin top value of the button', "spoki") ?>
417 </p>
418 </td>
419 </tr>
420 <tr>
421 <th scope="row">
422 <label for="single_product_button_margin_bottom">
423 <?php _e('Space after button', "spoki") ?>
424 </label>
425 </th>
426 <td>
427 <label>
428 <input type="number" id="single_product_button_margin_bottom"
429 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][single_product_button_margin_bottom]"
430 value="<?php echo (isset($this->options['woocommerce']['single_product_button_margin_bottom']) && $this->options['woocommerce']['single_product_button_margin_bottom'] !== '') ? $this->options['woocommerce']['single_product_button_margin_bottom'] : '4' ?>">
431 px
432 </label>
433 <p class="description">
434 * <?php _e('Set the margin bottom value of the button', "spoki") ?>
435 </p>
436 </td>
437 </tr>
438 </table>
439 </fieldset>
440 </div>
441
442 <div <?php if ($current_section != 'cart') echo "style='display:none'" ?> >
443 <br/>
444 <br/>
445 <h2><?php _e('Cart page', "spoki") ?></h2>
446 <p><?php _e('Add a WhatsApp button in the cart page.', "spoki") ?></p>
447 <img class="cover-image" src="<?php echo plugins_url() . '/' . SPOKI_PLUGIN_NAME . '/assets/images/cart-page-button.png' ?>"/>
448
449 <fieldset <?php if (false == $has_wc) : ?>disabled<?php endif ?>>
450 <table class="form-table">
451 <tr>
452 <th>
453 <label for="cart_button_check">
454 <b><?php _e('Enable', "spoki") ?></b>
455 </label>
456 </th>
457 <td>
458 <input type="checkbox" id="cart_button_check"
459 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_check]"
460 value="1" <?php if (isset($this->options['woocommerce']['cart_button_check'])) echo checked(1, $this->options['woocommerce']['cart_button_check'], false) ?>
461 />
462 <label for="cart_button_check">
463 <?php _e('Enable the button', "spoki") ?>
464 </label>
465 <p class="description">
466 * <?php _e('If you enable the chat button you make it visible in the cart page', "spoki") ?>
467 </p>
468 </td>
469 </tr>
470 <tr>
471 <th>
472 <label for="cart_button_hide_checkout_button_check">
473 <b><?php _e('Hide "Proceed to Checkout" button', "spoki") ?></b>
474 </label>
475 </th>
476 <td>
477 <input type="checkbox" id="cart_button_hide_checkout_button_check"
478 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_hide_checkout_button_check]"
479 value="1" <?php if (isset($this->options['woocommerce']['cart_button_hide_checkout_button_check'])) echo checked(1, $this->options['woocommerce']['cart_button_hide_checkout_button_check'], false) ?>
480 />
481 <label for="cart_button_hide_checkout_button_check">
482 <?php _e('Hide "Proceed to Checkout" button and show the WhatsApp button only in the cart page', "spoki") ?>
483 </label>
484 </td>
485 </tr>
486 <tr>
487 <th>
488 <label for="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_cta]">
489 <b><?php _e('Button text (CTA)', "spoki") ?></b>
490 </label>
491 </th>
492 <td>
493 <input type="text"
494 id="cart_button_cta"
495 class="regular-text"
496 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_cta]"
497 value="<?php if (isset($this->options['woocommerce']['cart_button_cta'])) echo $this->options['woocommerce']['cart_button_cta'] ?>"
498 placeholder="<?php _e("Order via WhatsApp", "spoki") ?>"
499 />
500 <p class="description">
501 * <?php _e('Enter the text visible on the button', "spoki") ?>
502 </p>
503 </td>
504 </tr>
505 <tr>
506 <th>
507 <label for="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_text]">
508 <b><?php _e('Customer Message', "spoki") ?></b>
509 </label>
510 </th>
511 <td>
512 <textarea class="regular-text"
513 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_text]"
514 id="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_text]"
515 rows="5"
516 placeholder="<?php _e('Hi, I want to buy:', "spoki") ?>"><?php if (isset($this->options['woocommerce']['cart_button_text'])) echo $this->options['woocommerce']['cart_button_text'] ?></textarea>
517 <p class="description">
518 * <?php _e('The customer will send you the following message via WhatsApp whenever press on this button', "spoki") ?>
519 </p>
520 </td>
521 </tr>
522 <tr>
523 <th scope="row">
524 <label for="cart_button_color">
525 <?php _e('Color', "spoki") ?>
526 </label>
527 </th>
528 <td>
529 <input type="color"
530 id="cart_button_color"
531 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_color]"
532 value="<?php echo (isset($this->options['woocommerce']['cart_button_color']) && $this->options['woocommerce']['cart_button_color'] !== '') ? $this->options['woocommerce']['cart_button_color'] : '#23D366' ?>"
533 >
534 <p class="description">
535 * <?php _e('Set the background color of the button (Suggested: <i>#23D366</i> - <i>rgb(35, 211, 102)</i>)', "spoki") ?>
536 </p>
537 </td>
538 </tr>
539 <tr>
540 <th>
541 <label for="cart_button_border">
542 <b><?php _e('Border type', "spoki") ?></b>
543 </label>
544 </th>
545 <td>
546 <?php $cart_button_border = isset($this->options['woocommerce']['cart_button_border']) ? $this->options['woocommerce']['cart_button_border'] : 'rounded' ?>
547 <select name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_border]" id="cart_button_border" class="regular-text">
548 <option value="rounded" <?php echo $cart_button_border == 'rounded' ? 'selected' : '' ?>><?php echo __('Rounded', "spoki") ?></option>
549 <option value="squared" <?php echo $cart_button_border == 'squared' ? 'selected' : '' ?>><?php echo __('Squared', "spoki") ?></option>
550 </select>
551 <p class="description">
552 * <?php _e('Choose the button border type', "spoki"); ?>
553 </p>
554 </td>
555 </tr>
556 <tr>
557 <th scope="row">
558 <label for="cart_button_margin_top">
559 <?php _e('Spece before button', "spoki") ?>
560 </label>
561 </th>
562 <td>
563 <label>
564 <input type="number" id="cart_button_margin_top"
565 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_margin_top]"
566 value="<?php echo (isset($this->options['woocommerce']['cart_button_margin_top']) && $this->options['woocommerce']['cart_button_margin_top'] !== '') ? $this->options['woocommerce']['cart_button_margin_top'] : '4' ?>">
567 px
568 </label>
569 <p class="description">
570 * <?php _e('Set the margin top value of the button', "spoki") ?>
571 </p>
572 </td>
573 </tr>
574 <tr>
575 <th scope="row">
576 <label for="cart_button_margin_bottom">
577 <?php _e('Space after button', "spoki") ?>
578 </label>
579 </th>
580 <td>
581 <label>
582 <input type="number" id="cart_button_margin_bottom"
583 name="<?php echo SPOKI_OPTIONS ?>[woocommerce][cart_button_margin_bottom]"
584 value="<?php echo (isset($this->options['woocommerce']['cart_button_margin_bottom']) && $this->options['woocommerce']['cart_button_margin_bottom'] !== '') ? $this->options['woocommerce']['cart_button_margin_bottom'] : '4' ?>">
585 px
586 </label>
587 <p class="description">
588 * <?php _e('Set the margin bottom value of the button', "spoki") ?>
589 </p>
590 </td>
591 </tr>
592 </table>
593 </fieldset>
594 </div>
595
596 <?php if (true == $has_wc) : submit_button(null, 'primary', 'submit-templates'); else : ?>
597 <p>
598 <?php _e("Install and activate the <strong>WooCommerce</strong> plugin to enable the Spoki features for WooCommerce.", "spoki") ?>
599 </p>
600 <?php endif ?>
601 </div>
602
603 <?php if ($is_current_tab): ?>
604 <script>
605 document.addEventListener("DOMContentLoaded", function () {
606
607 // Handle templates
608 const templates = {
609 "order_created": {
610 "en": "👋 Hi [FIRST_NAME], your order n° [ORDER_NUMBER] 🛍 for the store [SHOP_NAME] has been created! 👍 Do you need support? ➡️➡️➡️ [CONTACT_LINK] <i>do not reply to this message</i>",
611 "it": "👋 Ciao [FIRST_NAME], il tuo ordine n°[ORDER_NUMBER] 🛍 del negozio [SHOP_NAME] è stato creato! 👍 Hai bisogno di aiuto? ➡️➡️➡️ [CONTACT_LINK] <i>non rispondere a questo messaggio</i>",
612 "es": "👋 Hola [FIRST_NAME], tu número de pedido [ORDER_NUMBER] 🛍 de la tienda [SHOP_NAME] se ha creado 👍 ¿Necesitas ayuda? ➡️➡️➡️ [CONTACT_LINK] <i>no contestes a este mensaje</i>",
613 "pt": "👋 Olá [FIRST_NAME], o número do pedido [ORDER_NUMBER] 🛍 da loja [SHOP_NAME] foi criado 👍 Precisa de ajuda? ➡️➡️➡️ [CONTACT_LINK] <i>não responda a essa mensagem</i>",
614 },
615 "order_updated": {
616 "en": "👋 Hi [FIRST_NAME], your order n° [ORDER_NUMBER] 🛍 for the store [SHOP_NAME] has been updated and its status is [ORDER_STATUS]! 👍 Do you need support? ➡️➡️➡️ [CONTACT_LINK] <i>do not reply to this message</i>",
617 "it": "👋 Ciao [FIRST_NAME], il tuo ordine n°[ORDER_NUMBER] 🛍 del negozio [SHOP_NAME] è stato aggiornato e il suo stato è [ORDER_STATUS]. Hai bisogno di aiuto? ➡️➡️➡️ [CONTACT_LINK] <i>non rispondere a questo messaggio</i>",
618 "es": "👋 Hola [FIRST_NAME], tu número de pedido [ORDER_NUMBER] 🛍 de la tienda [SHOP_NAME] ha sido actualizado y su estado es [ORDER_STATUS]. 👍 ¿Necesitas ayuda? ➡️➡️➡️ [CONTACT_LINK] <i>no contestes a este mensaje</i>",
619 "pt": "👋 Olá [FIRST_NAME], o número do pedido [ORDER_NUMBER] 🛍 da loja [SHOP_NAME] foi atualizado e seu status é [ORDER_STATUS].👍 Precisa de ajuda? ➡️➡️➡️ [CONTACT_LINK] <i>não responda a essa mensagem</i>",
620 },
621 "order_deleted": {
622 "en": "👋 Hi [FIRST_NAME], your order n° [ORDER_NUMBER] 🛍 for the store [SHOP_NAME] has been updated and its status is Cancelled! 👍 Do you need support? ➡️➡️➡️ [CONTACT_LINK] <i>do not reply to this message</i>",
623 "it": "👋 Ciao [FIRST_NAME], il tuo ordine n°[ORDER_NUMBER] 🛍 del negozio [SHOP_NAME] è stato aggiornato e il suo stato è Annullato. Hai bisogno di aiuto? ➡️➡️➡️ [CONTACT_LINK] <i>non rispondere a questo messaggio</i>",
624 "es": "👋 Hola [FIRST_NAME], tu número de pedido [ORDER_NUMBER] 🛍 de la tienda [SHOP_NAME] ha sido actualizado y su estado es Cancelado. 👍 ¿Necesitas ayuda? ➡️➡️➡️ [CONTACT_LINK] <i>no contestes a este mensaje</i>",
625 "pt": "👋 Olá [FIRST_NAME], o número do pedido [ORDER_NUMBER] 🛍 da loja [SHOP_NAME] foi atualizado e seu status é Cancelled.👍 Precisa de ajuda? ➡️➡️➡️ [CONTACT_LINK] <i>não responda a essa mensagem</i>",
626 },
627 "tracking": {
628 "en": "👋 Hi [FIRST_NAME], we have some news about your order n° [ORDER_NUMBER] 🛍 for the store [SHOP_NAME]! Here the shipping info: [SHIPPING_INFO]👍 Do you need support? ➡️➡️➡️ [CONTACT_LINK] <i>do not reply to this message</i>",
629 "it": "👋 Ciao [FIRST_NAME],abbiamo delle novità sul tracciamento del tuo ordine n°[ORDER_NUMBER] 🛍 del negozio [SHOP_NAME] 🚀 Ecco le informazioni sulla spedizione: [SHIPPING_INFO]. Hai bisogno di aiuto? ➡️➡️➡️ [CONTACT_LINK] <i>non rispondere a questo messaggio</i>",
630 "es": "👋 Hola [FIRST_NAME], tu número de pedido [ORDER_NUMBER] 🛍 de la tienda [SHOP_NAME] ha sido enviado 🚀 Aquí está la información de envío: [SHIPPING_INFO]. 👍 ¿Necesitas ayuda? ➡️➡️➡️ [CONTACT_LINK] <i>no contestes a este mensaje</i>",
631 "pt": "👋 Olá [FIRST_NAME], temos notícias sobre o rastreamento de seu pedido nº [ORDER_NUMBER] 🛍 da loja [SHOP_NAME] 🚀 Aqui estão as informações de envio: [SHIPPING_INFO]. Precisa de ajuda? ➡️➡️➡️ [CONTACT_LINK] <i>não responda a essa mensagem</i>",
632 },
633 };
634
635 function setTemplates(lan) {
636 const language = lan.substr(0, 2);
637 Object.keys(templates).forEach(key => {
638 document.getElementById(`${key}_template`).innerHTML = templates[key][language] || templates[key]['en'];
639 });
640 }
641
642 setTemplates("<?php echo Spoki()->shop['language'] ?>");
643 document.getElementById('language').addEventListener('change', e => setTemplates(e.target.value));
644
645 // Check notifications status
646 const hasActiveNotification = !!Array.from(document.querySelectorAll('.notification-check[checked]')).length;
647 document.getElementById(`notifications-${hasActiveNotification ? 'success' : 'warning'}`).style = '';
648
649 function onCheckTemplates(check) {
650 Array.from(document.querySelectorAll('.notification-check')).forEach(el => {
651 if (check) {
652 el.setAttribute('checked', 'checked');
653 } else {
654 el.removeAttribute('checked');
655 }
656 });
657 document.getElementsByName('submit-templates')[0].click();
658 }
659
660 document.querySelector('#notifications-success a').addEventListener('click', () => onCheckTemplates(false));
661 document.querySelector('#notifications-warning a').addEventListener('click', () => onCheckTemplates(true));
662 });
663 </script>
664 <?php endif; ?>