PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.11.1
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.11.1
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / modules / advanced-reviews / admin / options.php

options.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.11.1, at inc/modules/advanced-reviews/admin/options.php

1,156 lines 42.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Advanced Reviews Options.
5 *
6 * @package Merchant
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 /**
14 * Hook functionality before including modules options.
15 *
16 * @since 1.9.8
17 */
18 do_action( 'merchant_admin_before_include_modules_options', Merchant_Advanced_Reviews::MODULE_ID );
19
20 // Settings
21 Merchant_Admin_Options::create(
22 array(
23 'title' => __( 'Content', 'merchant' ),
24 'module' => Merchant_Advanced_Reviews::MODULE_ID,
25 'fields' => array(
26
27 // Review options.
28 array(
29 'id' => 'review_options',
30 'type' => 'radio',
31 'title' => __( 'Review options', 'merchant' ),
32 'options' => array(
33 'image_and_text' => __( 'Image and text', 'merchant' ),
34 'image' => __( 'Image only', 'merchant' ),
35 'text' => __( 'Text only', 'merchant' ),
36 ),
37 'default' => 'image_and_text',
38 ),
39
40 // Photos Upload limit.
41 array(
42 'id' => 'photos_limit',
43 'type' => 'range',
44 'title' => __( 'Photos upload limit', 'merchant' ),
45 'desc' => __( 'Controls the photos upload limit for a review.', 'merchant' ),
46 'min' => 1,
47 'max' => '',
48 'step' => 1,
49 'unit' => '',
50 'default' => 6,
51 'condition' => array( 'review_options', 'any', 'image_and_text|image' ),
52 ),
53
54 // Default Reviews Sorting.
55 array(
56 'id' => 'default_sorting',
57 'type' => 'select',
58 'title' => __( 'Default reviews sorting', 'merchant' ),
59 'options' => array(
60 'newest' => __( 'Newest', 'merchant' ),
61 'oldest' => __( 'Oldest', 'merchant' ),
62 'top-rated' => __( 'Top rated', 'merchant' ),
63 'low-rated' => __( 'Low rated', 'merchant' ),
64 'photo-first' => __( 'Photo first', 'merchant' ),
65 ),
66 'default' => 'newest',
67 ),
68
69 // Pagination Type.
70 array(
71 'id' => 'pagination_type',
72 'type' => 'select',
73 'title' => __( 'Pagination type', 'merchant' ),
74 'desc' => sprintf(
75 /* Translators: 1. Defualt WordPress discussion settings page. */
76 __( 'This option works only if you have pagination for comments enabled. By default, WordPress doesn\'t have pagination enabled for comments/reviews. You can change it from: <a href="%1$s" target="_blank">Settings > Discusson</a>',
77 'merchant' ),
78 admin_url( 'options-discussion.php' )
79 ),
80 'options' => array(
81 'default' => __( 'Default', 'merchant' ),
82 'load-more' => __( 'Load more button', 'merchant' ),
83 ),
84 'default' => 'load-more',
85 ),
86
87 // Title.
88 array(
89 'id' => 'title',
90 'type' => 'text',
91 'title' => __( 'Title', 'merchant' ),
92 'default' => __( 'What our customers are saying', 'merchant' ),
93 ),
94
95 // Title HTML Tag.
96 array(
97 'id' => 'title_tag',
98 'type' => 'select',
99 'title' => __( 'Title HTML tag', 'merchant' ),
100 'options' => array(
101 'h1' => __( 'H1', 'merchant' ),
102 'h2' => __( 'H2', 'merchant' ),
103 'h3' => __( 'H3', 'merchant' ),
104 'h4' => __( 'H4', 'merchant' ),
105 'h5' => __( 'H5', 'merchant' ),
106 'h6' => __( 'H6', 'merchant' ),
107 'div' => __( 'div', 'merchant' ),
108 ),
109 'default' => 'h2',
110 ),
111
112 // Hide Title.
113 array(
114 'id' => 'hide_title',
115 'type' => 'switcher',
116 'title' => __( 'Hide title', 'merchant' ),
117 'default' => 0,
118 ),
119
120 // Description.
121 array(
122 'id' => 'description',
123 'type' => 'textarea',
124 'title' => __( 'Description', 'merchant' ),
125 'default' => '',
126 ),
127
128 // Title and Description Alignment.
129 array(
130 'id' => 'title_desc_align',
131 'type' => 'radio',
132 'title' => __( 'Title and description alignment', 'merchant' ),
133 'options' => array(
134 'left' => __( 'Left', 'merchant' ),
135 'center' => __( 'Center', 'merchant' ),
136 'right' => __( 'Right', 'merchant' ),
137 ),
138 'default' => 'left',
139 ),
140
141 // Review images carousel.
142 array(
143 'id' => 'review_images_carousel',
144 'type' => 'switcher',
145 'title' => __( 'Review images carousel', 'merchant' ),
146 'desc' => __( 'Display the first image from each review in a carousel to engage shoppers and help their decision-making process.', 'merchant' ),
147 'default' => 0,
148 ),
149
150 // Number of Images per page.
151 array(
152 'id' => 'review_images_carousel_total',
153 'type' => 'range',
154 'title' => __( 'Total images', 'merchant' ),
155 'desc' => __( 'Controls the total number of images to be displayed in the slider.', 'merchant' ),
156 'min' => 1,
157 'step' => 1,
158 'unit' => '',
159 'default' => 12,
160 'condition' => array( 'review_images_carousel', '==', '1' ),
161 ),
162
163 // Number of Columns.
164 array(
165 'id' => 'review_images_carousel_per_page',
166 'type' => 'range',
167 'title' => __( 'Columns', 'merchant' ),
168 'desc' => __( 'Controls the number of images to be displayed per slide.', 'merchant' ),
169 'min' => 1,
170 'max' => 6,
171 'step' => 1,
172 'unit' => '',
173 'default' => 3,
174 'condition' => array( 'review_images_carousel', '==', '1' ),
175 ),
176
177 // Carousel Title.
178 array(
179 'id' => 'carousel_title',
180 'type' => 'text',
181 'title' => __( 'Carousel title', 'merchant' ),
182 'default' => __( 'Reviews with Photos', 'merchant' ),
183 ),
184
185 // Hook Order.
186 array(
187 'id' => 'hook_order',
188 'type' => 'range',
189 'title' => __( 'Hook order', 'merchant' ),
190 'desc' => __( 'Controls the display position for the entire advanced reviews section. Lower values will move the section towards the top, while higher values will move the section towards the bottom.',
191 'merchant' ),
192 'min' => 1,
193 'max' => 100,
194 'step' => 1,
195 'unit' => '',
196 'default' => 10,
197 ),
198 ),
199 )
200 );
201
202
203 Merchant_Admin_Options::create(
204 array(
205 'title' => __( 'Collect Reviews', 'merchant' ),
206 'module' => Merchant_Advanced_Reviews::MODULE_ID,
207 'fields' => array(
208 array(
209 'id' => 'auto_emails_toggle',
210 'type' => 'checkbox',
211 'label' => esc_html__( 'Send automated emails for review requests', 'merchant' ),
212 'default' => false,
213 ),
214 array(
215 'id' => 'days_after_order_complete',
216 'type' => 'number',
217 'title' => esc_html__( 'After the order is completed, send the review request after the following number of days', 'merchant' ),
218 'desc' => esc_html__( 'The emails will be sent for orders that have been completed.', 'merchant' ),
219 'default' => 7,
220 ),
221 array(
222 'id' => 'discount_toggle',
223 'type' => 'switcher',
224 'title' => __( 'Discount for reviews', 'merchant' ),
225 'desc' => __( 'After a customer leaves a review on the store, an email containing a discount coupon will be sent to the email address associated with their order.',
226 'merchant' ),
227 'default' => 0,
228 ),
229 array(
230 'id' => 'require_photo_for_discount',
231 'type' => 'checkbox',
232 'label' => esc_html__( 'Offer a discount specifically for leaving a photo review.', 'merchant' ),
233 'default' => false,
234 'conditions' => array(
235 'terms' => array(
236 array(
237 'field' => 'discount_toggle', // field ID
238 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
239 'value' => true, // can be a single value or an array of string/number/int
240 ),
241 ),
242 ),
243 ),
244 array(
245 'id' => 'discount_generation_method',
246 'type' => 'radio',
247 'title' => esc_html__( 'Discount generation method', 'merchant' ),
248 'options' => array(
249 'auto' => esc_html__( 'Auto-generated code (different each time)', 'merchant' ),
250 'manual' => esc_html__( 'Single discount code', 'merchant' ),
251 ),
252 'default' => 'auto',
253 'conditions' => array(
254 'terms' => array(
255 array(
256 'field' => 'discount_toggle', // field ID
257 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
258 'value' => true, // can be a single value or an array of string/number/int
259 ),
260 ),
261 ),
262 ),
263 array(
264 'id' => 'discount_info',
265 'type' => 'info',
266 'content' => esc_html__( 'A unique, single-use coupon code will be generated for each customer who leaves a review. This code can only be redeemed by the customer associated with the review.',
267 'merchant' ),
268 'conditions' => array(
269 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
270 'terms' => array(
271 array(
272 'field' => 'discount_toggle', // field ID
273 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
274 'value' => true, // can be a single value or an array of string/number/int
275 ),
276 array(
277 'field' => 'discount_generation_method', // field ID
278 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
279 'value' => 'auto', // can be a single value or an array of string/number/int
280 ),
281 ),
282 ),
283 ),
284 array(
285 'id' => 'discount_type',
286 'type' => 'radio',
287 'title' => esc_html__( 'Discount', 'merchant' ),
288 'options' => array(
289 'percent' => esc_html__( 'Percentage', 'merchant' ),
290 'fixed_cart' => esc_html__( 'Fixed', 'merchant' ),
291 ),
292 'default' => 'percent',
293 'conditions' => array(
294 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
295 'terms' => array(
296 array(
297 'field' => 'discount_toggle', // field ID
298 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
299 'value' => true, // can be a single value or an array of string/number/int
300 ),
301 array(
302 'field' => 'discount_generation_method', // field ID
303 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
304 'value' => 'auto', // can be a single value or an array of string/number/int
305 ),
306 ),
307 ),
308 ),
309 array(
310 'id' => 'discount_amount',
311 'type' => 'number',
312 'step' => 0.01,
313 'default' => 10,
314 'conditions' => array(
315 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
316 'terms' => array(
317 array(
318 'field' => 'discount_toggle', // field ID
319 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
320 'value' => true, // can be a single value or an array of string/number/int
321 ),
322 array(
323 'field' => 'discount_generation_method', // field ID
324 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
325 'value' => 'auto', // can be a single value or an array of string/number/int
326 ),
327 ),
328 ),
329 ),
330 array(
331 'id' => 'discount_expire_after',
332 'type' => 'select',
333 'title' => esc_html__( 'Discount expires after', 'merchant' ),
334 'options' => array(
335 'never' => esc_html__( 'Never', 'merchant' ),
336 '7' => esc_html__( '7 days', 'merchant' ),
337 '14' => esc_html__( '14 days', 'merchant' ),
338 '21' => esc_html__( '21 days', 'merchant' ),
339 '30' => esc_html__( '30 days', 'merchant' ),
340 '60' => esc_html__( '60 days', 'merchant' ),
341 '90' => esc_html__( '90 days', 'merchant' ),
342 '180' => esc_html__( '180 days', 'merchant' ),
343 '365' => esc_html__( '365 days', 'merchant' ),
344 ),
345 'conditions' => array(
346 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
347 'terms' => array(
348 array(
349 'field' => 'discount_toggle', // field ID
350 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
351 'value' => true, // can be a single value or an array of string/number/int
352 ),
353 array(
354 'field' => 'discount_generation_method', // field ID
355 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
356 'value' => 'auto', // can be a single value or an array of string/number/int
357 ),
358 ),
359 ),
360 ),
361 array(
362 'id' => 'coupon_campaign_info',
363 'type' => 'info_block',
364 'description' => esc_html__( 'You need to create the discount code in WooCommerce by navigating to Marketing > Coupons. The same discount code will be sent to all customers.',
365 'merchant' ),
366 'button_text' => esc_html__( 'Create discount code', 'merchant' ),
367 'button_link' => admin_url( 'edit.php?post_type=shop_coupon' ),
368 'conditions' => array(
369 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
370 'terms' => array(
371 array(
372 'field' => 'discount_toggle', // field ID
373 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
374 'value' => true, // can be a single value or an array of string/number/int
375 ),
376 array(
377 'field' => 'discount_generation_method', // field ID
378 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
379 'value' => 'manual', // can be a single value or an array of string/number/int
380 ),
381 ),
382 ),
383 ),
384 array(
385 'id' => 'manual_coupon_code',
386 'type' => 'wc_coupons',
387 'title' => esc_html__( 'Select manually created discount code', 'merchant' ),
388 //'desc' => esc_html__( 'The discount code must be created in WooCommerce to work and add here to validate.', 'merchant' ),
389 'conditions' => array(
390 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
391 'terms' => array(
392 array(
393 'field' => 'discount_toggle', // field ID
394 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
395 'value' => true, // can be a single value or an array of string/number/int
396 ),
397 array(
398 'field' => 'discount_generation_method', // field ID
399 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
400 'value' => 'manual', // can be a single value or an array of string/number/int
401 ),
402 ),
403 ),
404 ),
405 ),
406 )
407 );
408
409 Merchant_Admin_Options::create(
410 array(
411 'title' => __( 'Emails', 'merchant' ),
412 'module' => Merchant_Advanced_Reviews::MODULE_ID,
413 'fields' => array(
414 array(
415 'id' => 'review_request_email',
416 'type' => 'fields_group',
417 'title' => esc_html__( 'Review request', 'merchant' ),
418 'sub-desc' => esc_html__( 'Encourage your customers to leave a review with automated emails.', 'merchant' ),
419 'state' => 'open',
420 'default' => 'inactive',
421 'accordion' => true,
422 'display_status' => true,
423 'fields' => array(
424 array(
425 'id' => 'subject',
426 'type' => 'text',
427 'title' => __( 'Subject', 'merchant' ),
428 'default' => __( 'How did we do?', 'merchant' ),
429 'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ),
430 'hidden_desc' => sprintf(
431 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
432 __(
433 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays the customer’s order id<br><strong>%4$s</strong> and <strong>%5$s:</strong> These tags are used together to create a clickable link that directs the customer to their order page, where they can submit a review.<br><br><strong>Example usage:</strong><br>Please click {order_url_open}here{order_url_close} to leave a review for your recent order.',
434 'merchant'
435 ),
436 '{first_name}',
437 '{last_name}',
438 '{order_id}',
439 '{order_url_open}',
440 '{order_url_close}'
441 ),
442 ),
443 array(
444 'id' => 'body',
445 'type' => 'textarea_multiline',
446 'title' => __( 'Body', 'merchant' ),
447 'default' => __( 'Hello {first_name},
448
449 We hope you’re enjoying your recent purchase from us.
450
451 We would be grateful if you could take a moment to share your experience by leaving a review.
452
453 Your feedback helps us improve and provides valuable insights for other customers. Please click {order_url_open}here{order_url_close} to submit your review.
454
455 Best regards,', 'merchant' ),
456 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
457 'hidden_desc' => sprintf(
458 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
459 __(
460 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays the customer’s order id<br><strong>%4$s</strong> and <strong>%5$s:</strong> These tags are used together to create a clickable link that directs the customer to their order page, where they can submit a review.<br><br><strong>Example usage:</strong><br>Please click {order_url_open}here{order_url_close} to leave a review for your recent order.',
461 'merchant'
462 ),
463 '{first_name}',
464 '{last_name}',
465 '{order_id}',
466 '{order_url_open}',
467 '{order_url_close}'
468 ),
469 ),
470 // array(
471 // 'id' => 'review_btn_type',
472 // 'type' => 'select',
473 // 'title' => esc_html__( 'Review request button type', 'merchant' ),
474 // 'options' => array(
475 // 'rating_stars' => esc_html__( 'Rating stars', 'merchant' ),
476 // 'custom_button' => esc_html__( 'Custom Button', 'merchant' ),
477 // ),
478 // 'default' => 'custom_button',
479 // ),
480 // array(
481 // 'id' => 'review_btn_text',
482 // 'type' => 'text',
483 // 'title' => __( 'Button text', 'merchant' ),
484 // 'default' => __( 'Write a review', 'merchant' ),
485 // 'conditions' => array(
486 // 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
487 // 'terms' => array(
488 // array(
489 // 'field' => 'review_btn_type', // field ID
490 // 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
491 // 'value' => 'custom_button', // can be a single value or an array of string/number/int
492 // ),
493 // ),
494 // ),
495 // ),
496 array(
497 'id' => 'preview-info',
498 'type' => 'info',
499 'content' => sprintf(
500 /* Translators: 1. docs link */
501 __( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ),
502 esc_url(
503 add_query_arg(
504 array(
505 'action' => 'merchant_pro_preview_request_review_email',
506 'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ),
507 ),
508 admin_url( 'admin-post.php' )
509 )
510 )
511 ),
512 ),
513
514 ),
515 ),
516 array(
517 'id' => 'review_request_reminder_email',
518 'type' => 'fields_group',
519 'title' => esc_html__( 'Review request reminder', 'merchant' ),
520 'sub-desc' => esc_html__( 'Send a second review request to customers who did not submit a review yet.', 'merchant' ),
521 'state' => 'closed',
522 'default' => 'inactive',
523 'accordion' => true,
524 'display_status' => true,
525 'fields' => array(
526 array(
527 'id' => 'days_after_first_email',
528 'type' => 'number',
529 'title' => esc_html__( 'After the first email, send the review request reminder after the following number of days', 'merchant' ),
530 'default' => 7,
531 ),
532 array(
533 'id' => 'subject',
534 'type' => 'text',
535 'title' => __( 'Subject', 'merchant' ),
536 'default' => __( 'We value your feedback', 'merchant' ),
537 'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ),
538 'hidden_desc' => sprintf(
539 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
540 __(
541 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays the customer’s order id<br><strong>%4$s</strong> and <strong>%5$s:</strong> These tags are used together to create a clickable link that directs the customer to their order page, where they can submit a review.<br><br><strong>Example usage:</strong><br>Please click {order_url_open}here{order_url_close} to leave a review for your recent order.',
542 'merchant'
543 ),
544 '{first_name}',
545 '{last_name}',
546 '{order_id}',
547 '{order_url_open}',
548 '{order_url_close}'
549 ),
550 ),
551 array(
552 'id' => 'body',
553 'type' => 'textarea_multiline',
554 'title' => __( 'Body', 'merchant' ),
555 'default' => __( 'Hello {first_name},
556
557 We hope you’re enjoying your recent purchase from us.
558
559 We would be grateful if you could take a moment to share your experience by leaving a review.
560
561 Your feedback helps us improve and provides valuable insights for other customers. Please click {order_url_open}here{order_url_close} to submit your review.
562
563 Best regards,', 'merchant' ),
564 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
565 'hidden_desc' => sprintf(
566 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
567 __(
568 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays the customer’s order id<br><strong>%4$s</strong> and <strong>%5$s:</strong> These tags are used together to create a clickable link that directs the customer to their order page, where they can submit a review.<br><br><strong>Example usage:</strong><br>Please click {order_url_open}here{order_url_close} to leave a review for your recent order.',
569 'merchant'
570 ),
571 '{first_name}',
572 '{last_name}',
573 '{order_id}',
574 '{order_url_open}',
575 '{order_url_close}'
576 ),
577 ),
578 // array(
579 // 'id' => 'review_btn_type',
580 // 'type' => 'select',
581 // 'title' => esc_html__( 'Review request button type', 'merchant' ),
582 // 'options' => array(
583 // 'rating_stars' => esc_html__( 'Rating stars', 'merchant' ),
584 // 'custom_button' => esc_html__( 'Custom Button', 'merchant' ),
585 // ),
586 // 'default' => 'custom_button',
587 // ),
588 // array(
589 // 'id' => 'review_btn_text',
590 // 'type' => 'text',
591 // 'title' => __( 'Button text', 'merchant' ),
592 // 'default' => __( 'Write a review', 'merchant' ),
593 // 'conditions' => array(
594 // 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
595 // 'terms' => array(
596 // array(
597 // 'field' => 'review_btn_type', // field ID
598 // 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
599 // 'value' => 'custom_button', // can be a single value or an array of string/number/int
600 // ),
601 // ),
602 // ),
603 // ),
604 array(
605 'id' => 'preview-info',
606 'type' => 'info',
607 'content' => sprintf(
608 /* Translators: 1. docs link */
609 __( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ),
610 esc_url(
611 add_query_arg(
612 array(
613 'action' => 'merchant_pro_preview_request_review_reminder_email',
614 'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ),
615 ),
616 admin_url( 'admin-post.php' )
617 )
618 )
619 ),
620 ),
621
622 ),
623 ),
624 array(
625 'id' => 'discount_for_review_email',
626 'type' => 'fields_group',
627 'title' => esc_html__( 'Discount for review', 'merchant' ),
628 'sub-desc' => esc_html__( 'Send customers a next-purchase code after submitting a review.', 'merchant' ),
629 'state' => 'closed',
630 'default' => 'inactive',
631 'accordion' => true,
632 'display_status' => true,
633 'fields' => array(
634 array(
635 'id' => 'subject',
636 'type' => 'text',
637 'title' => __( 'Subject', 'merchant' ),
638 'default' => __( 'Your discount code is inside', 'merchant' ),
639 'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ),
640 'hidden_desc' => sprintf(
641 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
642 __(
643 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays discount code',
644 'merchant'
645 ),
646 '{first_name}',
647 '{last_name}',
648 '{discount_code}'
649 ),
650 ),
651 array(
652 'id' => 'body',
653 'type' => 'textarea_multiline',
654 'title' => __( 'Body', 'merchant' ),
655 'default' => __( 'Hello {first_name}, We would like to let you know that you are eligible to receive a discount on your next purchase. Here is your discount code: {discount_code}.',
656 'merchant' ),
657 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
658 'hidden_desc' => sprintf(
659 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
660 __(
661 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays discount code',
662 'merchant'
663 ),
664 '{first_name}',
665 '{last_name}',
666 '{discount_code}'
667 ),
668 ),
669 array(
670 'id' => 'preview-info',
671 'type' => 'info',
672 'content' => sprintf(
673 /* Translators: 1. docs link */
674 __( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ),
675 esc_url(
676 add_query_arg(
677 array(
678 'action' => 'merchant_pro_preview_discount_for_review_email',
679 'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ),
680 ),
681 admin_url( 'admin-post.php' )
682 )
683 )
684 ),
685 ),
686
687 ),
688 ),
689 array(
690 'id' => 'discount_for_review_reminder_email',
691 'type' => 'fields_group',
692 'title' => esc_html__( 'Review discount reminder', 'merchant' ),
693 'sub-desc' => esc_html__( 'Remind your customers to use their next-purchase discount if they haven\'t used it yet.', 'merchant' ),
694 'state' => 'closed',
695 'default' => 'inactive',
696 'accordion' => true,
697 'display_status' => true,
698 'fields' => array(
699 array(
700 'id' => 'days_after_first_email',
701 'type' => 'number',
702 'title' => esc_html__( 'After the first email, send the discount reminder after the following number of days', 'merchant' ),
703 'default' => 7,
704 ),
705 array(
706 'id' => 'subject',
707 'type' => 'text',
708 'title' => __( 'Subject', 'merchant' ),
709 'default' => __( 'A reminder to to use your discount', 'merchant' ),
710 'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ),
711 'hidden_desc' => sprintf(
712 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
713 __(
714 '<strong>%1$s:</strong> displays the customer’s first name<br><strong>%2$s:</strong> displays the customer’s last name<br><strong>%3$s:</strong> displays discount code',
715 'merchant'
716 ),
717 '{first_name}',
718 '{last_name}',
719 '{discount_code}'
720 ),
721 ),
722 array(
723 'id' => 'body',
724 'type' => 'textarea_multiline',
725 'title' => __( 'Body', 'merchant' ),
726 'default' => __( 'Hello {first_name},
727 This is a reminder to let you know that you are eligible to receive a discount on your next purchase. Here is your discount code: {discount_code}', 'merchant' ),
728 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
729 'hidden_desc' => sprintf(
730 /* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */
731 __(
732 '<strong>%1$s:</strong> to show customer first name<br><strong>%2$s:</strong> to show customer last name<br><strong>%3$s:</strong> to show the discount code',
733 'merchant'
734 ),
735 '{first_name}',
736 '{last_name}',
737 '{discount_code}'
738 ),
739 ),
740 array(
741 'id' => 'preview-info',
742 'type' => 'info',
743 'content' => sprintf(
744 /* Translators: 1. docs link */
745 __( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ),
746 esc_url(
747 add_query_arg(
748 array(
749 'action' => 'merchant_pro_preview_discount_for_review_reminder_email',
750 'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ),
751 ),
752 admin_url( 'admin-post.php' )
753 )
754 )
755 ),
756 ),
757
758 ),
759 ),
760 array(
761 'id' => 'sender_name',
762 'type' => 'text',
763 'title' => esc_html__( 'Sender name', 'merchant' ),
764 'desc' => esc_html__( 'Will be displayed in the inbox, in the "From" field.', 'merchant' ),
765 'placeholder' => get_bloginfo( 'name' ),
766 'default' => get_bloginfo( 'name' ),
767 ),
768 array(
769 'id' => 'sender_email',
770 'type' => 'text',
771 'title' => esc_html__( 'Sender email', 'merchant' ),
772 'desc' => esc_html__( 'We recommend using your customer support email so replies from customers are sent to that address.', 'merchant' ),
773 'placeholder' => get_bloginfo( 'admin_email' ),
774 'default' => get_bloginfo( 'admin_email' ),
775 ),
776 ),
777 )
778 );
779
780 // Shortcode
781 $merchant_module_id = Merchant_Advanced_Reviews::MODULE_ID;
782 Merchant_Admin_Options::create(
783 array(
784 'module' => $merchant_module_id,
785 'title' => esc_html__( 'Review Carousels', 'merchant' ),
786 'fields' => array(
787 array(
788 'id' => 'carousel_toggle',
789 'type' => 'switcher',
790 'title' => esc_html__( 'Use reviews carousel', 'merchant' ),
791 'default' => 0,
792 ),
793 array(
794 'id' => 'carousels',
795 'type' => 'flexible_content',
796 'sorting' => true,
797 'accordion' => true,
798 'duplicate' => true,
799 'style' => Merchant_Advanced_Reviews::MODULE_ID . '-style default',
800 'button_label' => esc_html__( 'Add New Carousel', 'merchant' ),
801 'conditions' => array(
802 'terms' => array(
803 array(
804 'field' => 'carousel_toggle', // field ID
805 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
806 'value' => true, // can be a single value or an array of string/number/int
807 ),
808 ),
809 ),
810 'layouts' => array(
811 'carousels' => array(
812 'title' => esc_html__( 'Reviews', 'merchant' ),
813 'fields' => array(
814 array(
815 'id' => 'enable',
816 'type' => 'switcher',
817 'title' => esc_html__( 'Show/hide carousel', 'merchant' ),
818 'default' => 1,
819 ),
820 array(
821 'id' => 'carousel_title',
822 'type' => 'text',
823 'title' => __( 'Testimonial title', 'merchant' ),
824 'desc' => __( 'This title will be displayed above the carousel.', 'merchant' ),
825 'default' => __( 'Happy Customers', 'merchant' ),
826 ),
827 array(
828 'id' => 'carousel_description',
829 'type' => 'text',
830 'title' => __( 'Description', 'merchant' ),
831 'desc' => __( 'This description will be displayed below the carousel title.', 'merchant' ),
832 'default' => __( 'Customers from all over the world love our products!', 'merchant' ),
833 ),
834 array(
835 'id' => 'reviews',
836 'type' => 'reviews_selector',
837 'title' => __( 'Reviews', 'merchant' ),
838 ),
839 array(
840 'id' => 'visible_slides_at_once',
841 'type' => 'radio',
842 'title' => esc_html__( 'Number of reviews at once', 'merchant' ),
843 'options' => array(
844 // The numbers only are not working as expected, added a string to make it work and will be replaced inside the template.
845 'slide_1' => esc_html__( '1', 'merchant' ),
846 'slide_2' => esc_html__( '2', 'merchant' ),
847 'slide_3' => esc_html__( '3', 'merchant' ),
848 ),
849 'default' => 'slide_3',
850 'desc' => esc_html__( 'Controls the number of reviews to be displayed in a single view', 'merchant' ),
851 ),
852 array(
853 'id' => 'centred_content',
854 'type' => 'checkbox',
855 'label' => esc_html__( 'Centered review alignment', 'merchant' ),
856 'default' => true,
857 ),
858 array(
859 'id' => 'show_as_boxed',
860 'type' => 'checkbox',
861 'label' => esc_html__( 'Show as boxed', 'merchant' ),
862 'default' => 0,
863 ),
864 array(
865 'id' => 'border_width',
866 'type' => 'range',
867 'title' => esc_html__( 'Border size', 'merchant' ),
868 'min' => 0,
869 'max' => 20,
870 'step' => 1,
871 'unit' => 'px',
872 'default' => 1,
873 'condition' => array( 'show_as_boxed', '==', '1' ),
874 ),
875 array(
876 'id' => 'border_radius',
877 'type' => 'range',
878 'title' => esc_html__( 'Corner radius', 'merchant' ),
879 'min' => 0,
880 'max' => 200,
881 'step' => 1,
882 'unit' => 'px',
883 'default' => 0,
884 'condition' => array( 'show_as_boxed', '==', '1' ),
885 ),
886 array(
887 'id' => 'border_color',
888 'type' => 'color',
889 'title' => esc_html__( 'Border color', 'merchant' ),
890 'default' => '#000000',
891 'condition' => array( 'show_as_boxed', '==', '1' ),
892 ),
893 array(
894 'id' => 'show_product_image',
895 'type' => 'switcher',
896 'title' => esc_html__( 'Show product image', 'merchant' ),
897 'default' => 0,
898 ),
899 array(
900 'id' => 'show_on',
901 'type' => 'radio',
902 'title' => esc_html__( 'Show on', 'merchant' ),
903 'options' => array(
904 'shop_page' => esc_html__( 'Shop page', 'merchant' ),
905 'shortcode' => esc_html__( 'Shortcode', 'merchant' ),
906 ),
907 'default' => 'shortcode',
908 ),
909 array(
910 'id' => 'placement',
911 'type' => 'select',
912 'title' => esc_html__( 'Placement', 'merchant' ),
913 'options' => array(
914 'woocommerce_before_main_content' => esc_html__( 'Before Main Content', 'merchant' ),
915 'woocommerce_after_shop_loop' => esc_html__( 'After Main Content', 'merchant' ),
916 ),
917 'default' => 'woocommerce_before_main_content',
918 'conditions' => array(
919 'terms' => array(
920 array(
921 'field' => 'show_on', // field ID
922 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
923 'value' => 'shop_page', // can be a single value or an array of string/number/int
924 ),
925 ),
926 ),
927 ),
928 array(
929 'id' => 'shortcode_info',
930 'type' => 'info',
931 'content' => sprintf(
932 /* Translators: 1. Link open tag 2. Link close tag */
933 __(
934 'Use this shortcode %s to showcase the reviews carousel, and include the instance number in the shortcode ID.',
935 'merchant'
936 ),
937 '<strong>[merchant_reviews_carousel id="1"]</strong>'
938 ),
939 'conditions' => array(
940 'terms' => array(
941 array(
942 'field' => 'show_on', // field ID
943 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
944 'value' => 'shortcode', // can be a single value or an array of string/number/int
945 ),
946 ),
947 ),
948 ),
949 ),
950 ),
951 ),
952 'default' => array(
953 array(
954 'layout' => 'carousels',
955 'label' => esc_html__( 'Reviews carousels', 'merchant' ),
956 ),
957 ),
958 ),
959
960 ),
961 )
962 );
963
964 // Modal Settings
965 Merchant_Admin_Options::create(
966 array(
967 'title' => __( 'Look and Feel', 'merchant' ),
968 'module' => Merchant_Advanced_Reviews::MODULE_ID,
969 'fields' => array(
970
971 /**
972 * Styles
973 *
974 */
975
976 // Title color.
977 array(
978 'id' => 'title_color',
979 'type' => 'color',
980 'title' => __( 'Title color', 'merchant' ),
981 'default' => '#212121',
982 ),
983
984 // Description color.
985 array(
986 'id' => 'description_color',
987 'type' => 'color',
988 'title' => __( 'Description color', 'merchant' ),
989 'default' => '#777',
990 ),
991
992 // Stars color.
993 array(
994 'id' => 'stars_color',
995 'type' => 'color',
996 'title' => __( 'Stars color', 'merchant' ),
997 'default' => '#FFA441',
998 ),
999
1000 // Stars background color.
1001 array(
1002 'id' => 'stars_background_color',
1003 'type' => 'color',
1004 'title' => __( 'Stars background color', 'merchant' ),
1005 'default' => '#757575',
1006 ),
1007
1008 // Progress bar color.
1009 array(
1010 'id' => 'progress_bar_color',
1011 'type' => 'color',
1012 'title' => __( 'Progress bar color', 'merchant' ),
1013 'default' => '#212121',
1014 ),
1015
1016 // Progress bar background color.
1017 array(
1018 'id' => 'progress_bar_bg_color',
1019 'type' => 'color',
1020 'title' => __( 'Progress bar background color', 'merchant' ),
1021 'default' => '#F5F5F5',
1022 ),
1023
1024 // Dividers color.
1025 array(
1026 'id' => 'dividers_color',
1027 'type' => 'color',
1028 'title' => __( 'Dividers color', 'merchant' ),
1029 'default' => '#e9e9e9',
1030 ),
1031
1032 // Button color.
1033 array(
1034 'id' => 'button_color',
1035 'type' => 'color',
1036 'title' => __( 'Button color', 'merchant' ),
1037 'default' => '#FFF',
1038 ),
1039
1040 // Button color (hover).
1041 array(
1042 'id' => 'button_color_hover',
1043 'type' => 'color',
1044 'title' => __( 'Button color (hover)', 'merchant' ),
1045 'default' => '#FFF',
1046 ),
1047
1048 // Button background color.
1049 array(
1050 'id' => 'button_bg_color',
1051 'type' => 'color',
1052 'title' => __( 'Button background color', 'merchant' ),
1053 'default' => '#212121',
1054 ),
1055
1056 // Button background color (hover).
1057 array(
1058 'id' => 'button_bg_color_hover',
1059 'type' => 'color',
1060 'title' => __( 'Button background color (hover)', 'merchant' ),
1061 'default' => '#757575',
1062 ),
1063
1064
1065
1066 /**
1067 * Styles
1068 *
1069 */
1070 // Modal Close icon color.
1071 array(
1072 'id' => 'modal_close_icon_color',
1073 'type' => 'color',
1074 'title' => __( 'Modal close icon color', 'merchant' ),
1075 'default' => '#757575',
1076 ),
1077
1078 // Modal Close icon color (hover).
1079 array(
1080 'id' => 'modal_close_icon_color_hover',
1081 'type' => 'color',
1082 'title' => __( 'Modal close icon color (hover)', 'merchant' ),
1083 'default' => '#212121',
1084 ),
1085
1086 // Modal Title color.
1087 array(
1088 'id' => 'modal_title_color',
1089 'type' => 'color',
1090 'title' => __( 'Modal title color', 'merchant' ),
1091 'default' => '#212121',
1092 ),
1093
1094 // Modal Description color.
1095 array(
1096 'id' => 'modal_description_color',
1097 'type' => 'color',
1098 'title' => __( 'Modal description color', 'merchant' ),
1099 'default' => '#777',
1100 ),
1101
1102 // Modal Textarea color.
1103 array(
1104 'id' => 'modal_textarea_color',
1105 'type' => 'color',
1106 'title' => __( 'Modal textarea color', 'merchant' ),
1107 'default' => '#777',
1108 ),
1109
1110 // Modal Textarea background color.
1111 array(
1112 'id' => 'modal_textarea_background_color',
1113 'type' => 'color',
1114 'title' => __( 'Modal textarea background color', 'merchant' ),
1115 'default' => '#FFF',
1116 ),
1117
1118 // Modal background color.
1119 array(
1120 'id' => 'modal_background_color',
1121 'type' => 'color',
1122 'title' => __( 'Modal background color', 'merchant' ),
1123 'default' => '#F5F5F5',
1124 ),
1125 ),
1126 )
1127 );
1128
1129 Merchant_Admin_Options::create(
1130 array(
1131 'module' => $merchant_module_id,
1132 'title' => esc_html__( 'Use shortcode', 'merchant' ),
1133 'fields' => array(
1134 array(
1135 'id' => 'use_shortcode',
1136 'type' => 'switcher',
1137 'title' => __( 'Use shortcode', 'merchant' ),
1138 'default' => 0,
1139 ),
1140 array(
1141 'type' => 'info',
1142 'id' => 'shortcode_info',
1143 'content' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings. Note that the shortcodes can only be used on single product pages.',
1144 'merchant' ),
1145 ),
1146 array(
1147 'id' => 'shortcode_text',
1148 'type' => 'text_readonly',
1149 'title' => esc_html__( 'Shortcode text', 'merchant' ),
1150 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']',
1151 'condition' => array( 'use_shortcode', '==', '1' ),
1152 ),
1153 ),
1154 )
1155 );
1156