PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.2.8
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.2.8
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 2.2.8, at inc/modules/advanced-reviews/admin/options.php

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