| 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 |
// Settings |
| 14 |
Merchant_Admin_Options::create( |
| 15 |
array( |
| 16 |
'title' => __( 'Settings', 'merchant' ), |
| 17 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 18 |
'fields' => array( |
| 19 |
|
| 20 |
// Title. |
| 21 |
array( |
| 22 |
'id' => 'title', |
| 23 |
'type' => 'text', |
| 24 |
'title' => __( 'Title', 'merchant' ), |
| 25 |
'default' => __( 'What our customers are saying', 'merchant' ), |
| 26 |
), |
| 27 |
|
| 28 |
// Title HTML Tag. |
| 29 |
array( |
| 30 |
'id' => 'title_tag', |
| 31 |
'type' => 'select', |
| 32 |
'title' => __( 'Title HTML tag', 'merchant' ), |
| 33 |
'options' => array( |
| 34 |
'h1' => __( 'H1', 'merchant' ), |
| 35 |
'h2' => __( 'H2', 'merchant' ), |
| 36 |
'h3' => __( 'H3', 'merchant' ), |
| 37 |
'h4' => __( 'H4', 'merchant' ), |
| 38 |
'h5' => __( 'H5', 'merchant' ), |
| 39 |
'h6' => __( 'H6', 'merchant' ), |
| 40 |
'div' => __( 'div', 'merchant' ), |
| 41 |
), |
| 42 |
'default' => 'h2', |
| 43 |
), |
| 44 |
|
| 45 |
// Hide Title. |
| 46 |
array( |
| 47 |
'id' => 'hide_title', |
| 48 |
'type' => 'switcher', |
| 49 |
'title' => __( 'Hide title', 'merchant' ), |
| 50 |
'default' => 0, |
| 51 |
), |
| 52 |
|
| 53 |
// Description. |
| 54 |
array( |
| 55 |
'id' => 'description', |
| 56 |
'type' => 'textarea', |
| 57 |
'title' => __( 'Description', 'merchant' ), |
| 58 |
'default' => '', |
| 59 |
), |
| 60 |
|
| 61 |
// Title and Description Alignment. |
| 62 |
array( |
| 63 |
'id' => 'title_desc_align', |
| 64 |
'type' => 'radio', |
| 65 |
'title' => __( 'Title and description alignment', 'merchant' ), |
| 66 |
'options' => array( |
| 67 |
'left' => __( 'Left', 'merchant' ), |
| 68 |
'center' => __( 'Center', 'merchant' ), |
| 69 |
'right' => __( 'Right', 'merchant' ), |
| 70 |
), |
| 71 |
'default' => 'left', |
| 72 |
), |
| 73 |
|
| 74 |
// Default Reviews Sorting. |
| 75 |
array( |
| 76 |
'id' => 'default_sorting', |
| 77 |
'type' => 'select', |
| 78 |
'title' => __( 'Default reviews sorting', 'merchant' ), |
| 79 |
'options' => array( |
| 80 |
'newest' => __( 'Newest', 'merchant' ), |
| 81 |
'oldest' => __( 'Oldest', 'merchant' ), |
| 82 |
'top-rated' => __( 'Top rated', 'merchant' ), |
| 83 |
'low-rated' => __( 'Low rated', 'merchant' ), |
| 84 |
'photo-first' => __( 'Photo first', 'merchant' ), |
| 85 |
), |
| 86 |
'default' => 'newest', |
| 87 |
), |
| 88 |
|
| 89 |
// Pagination Type. |
| 90 |
array( |
| 91 |
'id' => 'pagination_type', |
| 92 |
'type' => 'select', |
| 93 |
'title' => __( 'Pagination type', 'merchant' ), |
| 94 |
'desc' => sprintf( |
| 95 |
/* Translators: 1. Defualt WordPress discussion settings page. */ |
| 96 |
__( '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>', |
| 97 |
'merchant' ), |
| 98 |
admin_url( 'options-discussion.php' ) |
| 99 |
), |
| 100 |
'options' => array( |
| 101 |
'default' => __( 'Default', 'merchant' ), |
| 102 |
'load-more' => __( 'Load more button', 'merchant' ), |
| 103 |
), |
| 104 |
'default' => 'load-more', |
| 105 |
), |
| 106 |
|
| 107 |
// Review options. |
| 108 |
array( |
| 109 |
'id' => 'review_options', |
| 110 |
'type' => 'radio', |
| 111 |
'title' => __( 'Review options', 'merchant' ), |
| 112 |
'options' => array( |
| 113 |
'image_and_text' => __( 'Image and text', 'merchant' ), |
| 114 |
'image' => __( 'Image only', 'merchant' ), |
| 115 |
'text' => __( 'Text only', 'merchant' ), |
| 116 |
), |
| 117 |
'default' => 'image_and_text', |
| 118 |
), |
| 119 |
|
| 120 |
// Photos Upload limit. |
| 121 |
array( |
| 122 |
'id' => 'photos_limit', |
| 123 |
'type' => 'range', |
| 124 |
'title' => __( 'Photos upload limit', 'merchant' ), |
| 125 |
'desc' => __( 'Controls the photos upload limit for a review.', 'merchant' ), |
| 126 |
'min' => 1, |
| 127 |
'max' => '', |
| 128 |
'step' => 1, |
| 129 |
'unit' => '', |
| 130 |
'default' => 6, |
| 131 |
), |
| 132 |
|
| 133 |
// Review images carousel. |
| 134 |
array( |
| 135 |
'id' => 'review_images_carousel', |
| 136 |
'type' => 'switcher', |
| 137 |
'title' => __( 'Review images carousel', 'merchant' ), |
| 138 |
'desc' => __( 'Display the first image from each review in a carousel to engage shoppers and help their decision-making process.', 'merchant' ), |
| 139 |
'default' => 0, |
| 140 |
), |
| 141 |
|
| 142 |
// Number of Images per page. |
| 143 |
array( |
| 144 |
'id' => 'review_images_carousel_total', |
| 145 |
'type' => 'range', |
| 146 |
'title' => __( 'Total images', 'merchant' ), |
| 147 |
'desc' => __( 'Controls the total number of images to be displayed in the slider.', 'merchant' ), |
| 148 |
'min' => 1, |
| 149 |
'step' => 1, |
| 150 |
'unit' => '', |
| 151 |
'default' => 12, |
| 152 |
'condition' => array( 'review_images_carousel', '==', '1' ), |
| 153 |
), |
| 154 |
|
| 155 |
// Number of Columns. |
| 156 |
array( |
| 157 |
'id' => 'review_images_carousel_per_page', |
| 158 |
'type' => 'range', |
| 159 |
'title' => __( 'Columns', 'merchant' ), |
| 160 |
'desc' => __( 'Controls the number of images to be displayed per slide.', 'merchant' ), |
| 161 |
'min' => 1, |
| 162 |
'max' => 6, |
| 163 |
'step' => 1, |
| 164 |
'unit' => '', |
| 165 |
'default' => 3, |
| 166 |
'condition' => array( 'review_images_carousel', '==', '1' ), |
| 167 |
), |
| 168 |
|
| 169 |
// Carousel Title. |
| 170 |
array( |
| 171 |
'id' => 'carousel_title', |
| 172 |
'type' => 'text', |
| 173 |
'title' => __( 'Carousel Title', 'merchant' ), |
| 174 |
'default' => __( 'Review images', 'merchant' ), |
| 175 |
), |
| 176 |
|
| 177 |
// Hook Order. |
| 178 |
array( |
| 179 |
'id' => 'hook_order', |
| 180 |
'type' => 'range', |
| 181 |
'title' => __( 'Hook order', 'merchant' ), |
| 182 |
'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.', |
| 183 |
'merchant' ), |
| 184 |
'min' => 1, |
| 185 |
'max' => 100, |
| 186 |
'step' => 1, |
| 187 |
'unit' => '', |
| 188 |
'default' => 10, |
| 189 |
), |
| 190 |
|
| 191 |
/** |
| 192 |
* Styles |
| 193 |
* |
| 194 |
*/ |
| 195 |
|
| 196 |
// Title color. |
| 197 |
array( |
| 198 |
'id' => 'title_color', |
| 199 |
'type' => 'color', |
| 200 |
'title' => __( 'Title color', 'merchant' ), |
| 201 |
'default' => '#212121', |
| 202 |
), |
| 203 |
|
| 204 |
// Description color. |
| 205 |
array( |
| 206 |
'id' => 'description_color', |
| 207 |
'type' => 'color', |
| 208 |
'title' => __( 'Description color', 'merchant' ), |
| 209 |
'default' => '#777', |
| 210 |
), |
| 211 |
|
| 212 |
// Stars color. |
| 213 |
array( |
| 214 |
'id' => 'stars_color', |
| 215 |
'type' => 'color', |
| 216 |
'title' => __( 'Stars color', 'merchant' ), |
| 217 |
'default' => '#FFA441', |
| 218 |
), |
| 219 |
|
| 220 |
// Stars background color. |
| 221 |
array( |
| 222 |
'id' => 'stars_background_color', |
| 223 |
'type' => 'color', |
| 224 |
'title' => __( 'Stars background color', 'merchant' ), |
| 225 |
'default' => '#757575', |
| 226 |
), |
| 227 |
|
| 228 |
// Progress bar color. |
| 229 |
array( |
| 230 |
'id' => 'progress_bar_color', |
| 231 |
'type' => 'color', |
| 232 |
'title' => __( 'Progress bar color', 'merchant' ), |
| 233 |
'default' => '#212121', |
| 234 |
), |
| 235 |
|
| 236 |
// Progress bar background color. |
| 237 |
array( |
| 238 |
'id' => 'progress_bar_bg_color', |
| 239 |
'type' => 'color', |
| 240 |
'title' => __( 'Progress bar background color', 'merchant' ), |
| 241 |
'default' => '#F5F5F5', |
| 242 |
), |
| 243 |
|
| 244 |
// Dividers color. |
| 245 |
array( |
| 246 |
'id' => 'dividers_color', |
| 247 |
'type' => 'color', |
| 248 |
'title' => __( 'Dividers color', 'merchant' ), |
| 249 |
'default' => '#e9e9e9', |
| 250 |
), |
| 251 |
|
| 252 |
// Button color. |
| 253 |
array( |
| 254 |
'id' => 'button_color', |
| 255 |
'type' => 'color', |
| 256 |
'title' => __( 'Button color', 'merchant' ), |
| 257 |
'default' => '#FFF', |
| 258 |
), |
| 259 |
|
| 260 |
// Button color (hover). |
| 261 |
array( |
| 262 |
'id' => 'button_color_hover', |
| 263 |
'type' => 'color', |
| 264 |
'title' => __( 'Button color (hover)', 'merchant' ), |
| 265 |
'default' => '#FFF', |
| 266 |
), |
| 267 |
|
| 268 |
// Button background color. |
| 269 |
array( |
| 270 |
'id' => 'button_bg_color', |
| 271 |
'type' => 'color', |
| 272 |
'title' => __( 'Button background color', 'merchant' ), |
| 273 |
'default' => '#212121', |
| 274 |
), |
| 275 |
|
| 276 |
// Button background color (hover). |
| 277 |
array( |
| 278 |
'id' => 'button_bg_color_hover', |
| 279 |
'type' => 'color', |
| 280 |
'title' => __( 'Button background color (hover)', 'merchant' ), |
| 281 |
'default' => '#757575', |
| 282 |
), |
| 283 |
|
| 284 |
), |
| 285 |
) |
| 286 |
); |
| 287 |
|
| 288 |
|
| 289 |
Merchant_Admin_Options::create( |
| 290 |
array( |
| 291 |
'title' => __( 'Collect Reviews', 'merchant' ), |
| 292 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 293 |
'fields' => array( |
| 294 |
array( |
| 295 |
'id' => 'auto_emails_toggle', |
| 296 |
'type' => 'checkbox', |
| 297 |
'label' => esc_html__( 'Send automated emails for review requests', 'merchant' ), |
| 298 |
'default' => false, |
| 299 |
), |
| 300 |
array( |
| 301 |
'id' => 'days_after_order_complete', |
| 302 |
'type' => 'number', |
| 303 |
'title' => esc_html__( 'After the order is completed, send the review request after the following number of days', 'merchant' ), |
| 304 |
'desc' => esc_html__( 'The emails will be sent to orders that have been completed.', 'merchant' ), |
| 305 |
'default' => '3', |
| 306 |
), |
| 307 |
array( |
| 308 |
'id' => 'discount_toggle', |
| 309 |
'type' => 'switcher', |
| 310 |
'title' => __( 'Discount for reviews', 'merchant' ), |
| 311 |
'desc' => __( 'An email containing a discount coupon will be sent to the customer after they leave a review on the store. The email will be sent to the address associated with their review.', |
| 312 |
'merchant' ), |
| 313 |
'default' => 0, |
| 314 |
), |
| 315 |
array( |
| 316 |
'id' => 'require_photo_for_discount', |
| 317 |
'type' => 'checkbox', |
| 318 |
'label' => esc_html__( 'Offer a discount specifically for leaving a photo review.', 'merchant' ), |
| 319 |
'default' => false, |
| 320 |
'conditions' => array( |
| 321 |
'terms' => array( |
| 322 |
array( |
| 323 |
'field' => 'discount_toggle', // field ID |
| 324 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 325 |
'value' => true, // can be a single value or an array of string/number/int |
| 326 |
), |
| 327 |
), |
| 328 |
), |
| 329 |
), |
| 330 |
array( |
| 331 |
'id' => 'discount_generation_method', |
| 332 |
'type' => 'radio', |
| 333 |
'title' => esc_html__( 'Discount generation method', 'merchant' ), |
| 334 |
'options' => array( |
| 335 |
'auto' => esc_html__( 'Auto-generated code (different each time)', 'merchant' ), |
| 336 |
'manual' => esc_html__( 'Single discount code', 'merchant' ), |
| 337 |
), |
| 338 |
'default' => 'auto', |
| 339 |
'conditions' => array( |
| 340 |
'terms' => array( |
| 341 |
array( |
| 342 |
'field' => 'discount_toggle', // field ID |
| 343 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 344 |
'value' => true, // can be a single value or an array of string/number/int |
| 345 |
), |
| 346 |
), |
| 347 |
), |
| 348 |
), |
| 349 |
array( |
| 350 |
'id' => 'discount_info', |
| 351 |
'type' => 'info', |
| 352 |
'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.', |
| 353 |
'merchant' ), |
| 354 |
'conditions' => array( |
| 355 |
'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 356 |
'terms' => array( |
| 357 |
array( |
| 358 |
'field' => 'discount_toggle', // field ID |
| 359 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 360 |
'value' => true, // can be a single value or an array of string/number/int |
| 361 |
), |
| 362 |
array( |
| 363 |
'field' => 'discount_generation_method', // field ID |
| 364 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 365 |
'value' => 'auto', // can be a single value or an array of string/number/int |
| 366 |
), |
| 367 |
), |
| 368 |
), |
| 369 |
), |
| 370 |
array( |
| 371 |
'id' => 'discount_type', |
| 372 |
'type' => 'radio', |
| 373 |
'title' => esc_html__( 'Discount', 'merchant' ), |
| 374 |
'options' => array( |
| 375 |
'percent' => esc_html__( 'Percentage', 'merchant' ), |
| 376 |
'fixed_cart' => esc_html__( 'Fixed', 'merchant' ), |
| 377 |
), |
| 378 |
'default' => 'percent', |
| 379 |
'conditions' => array( |
| 380 |
'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 381 |
'terms' => array( |
| 382 |
array( |
| 383 |
'field' => 'discount_toggle', // field ID |
| 384 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 385 |
'value' => true, // can be a single value or an array of string/number/int |
| 386 |
), |
| 387 |
array( |
| 388 |
'field' => 'discount_generation_method', // field ID |
| 389 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 390 |
'value' => 'auto', // can be a single value or an array of string/number/int |
| 391 |
), |
| 392 |
), |
| 393 |
), |
| 394 |
), |
| 395 |
array( |
| 396 |
'id' => 'discount_amount', |
| 397 |
'type' => 'number', |
| 398 |
'step' => 0.01, |
| 399 |
'default' => 10, |
| 400 |
'conditions' => array( |
| 401 |
'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 402 |
'terms' => array( |
| 403 |
array( |
| 404 |
'field' => 'discount_toggle', // field ID |
| 405 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 406 |
'value' => true, // can be a single value or an array of string/number/int |
| 407 |
), |
| 408 |
array( |
| 409 |
'field' => 'discount_generation_method', // field ID |
| 410 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 411 |
'value' => 'auto', // can be a single value or an array of string/number/int |
| 412 |
), |
| 413 |
), |
| 414 |
), |
| 415 |
), |
| 416 |
array( |
| 417 |
'id' => 'discount_expire_after', |
| 418 |
'type' => 'select', |
| 419 |
'title' => esc_html__( 'Discount expires after', 'merchant' ), |
| 420 |
'options' => array( |
| 421 |
'never' => esc_html__( 'Never', 'merchant' ), |
| 422 |
'7' => esc_html__( '7 days', 'merchant' ), |
| 423 |
'14' => esc_html__( '14 days', 'merchant' ), |
| 424 |
'21' => esc_html__( '21 days', 'merchant' ), |
| 425 |
'30' => esc_html__( '30 days', 'merchant' ), |
| 426 |
'60' => esc_html__( '60 days', 'merchant' ), |
| 427 |
'90' => esc_html__( '90 days', 'merchant' ), |
| 428 |
'180' => esc_html__( '180 days', 'merchant' ), |
| 429 |
'365' => esc_html__( '365 days', 'merchant' ), |
| 430 |
), |
| 431 |
'conditions' => array( |
| 432 |
'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 433 |
'terms' => array( |
| 434 |
array( |
| 435 |
'field' => 'discount_toggle', // field ID |
| 436 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 437 |
'value' => true, // can be a single value or an array of string/number/int |
| 438 |
), |
| 439 |
array( |
| 440 |
'field' => 'discount_generation_method', // field ID |
| 441 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 442 |
'value' => 'auto', // can be a single value or an array of string/number/int |
| 443 |
), |
| 444 |
), |
| 445 |
), |
| 446 |
), |
| 447 |
array( |
| 448 |
'id' => 'coupon_campaign_info', |
| 449 |
'type' => 'info_block', |
| 450 |
'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.', |
| 451 |
'merchant' ), |
| 452 |
'button_text' => esc_html__( 'Create discount code', 'merchant' ), |
| 453 |
'button_link' => admin_url( 'edit.php?post_type=shop_coupon' ), |
| 454 |
'conditions' => array( |
| 455 |
'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 456 |
'terms' => array( |
| 457 |
array( |
| 458 |
'field' => 'discount_toggle', // field ID |
| 459 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 460 |
'value' => true, // can be a single value or an array of string/number/int |
| 461 |
), |
| 462 |
array( |
| 463 |
'field' => 'discount_generation_method', // field ID |
| 464 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 465 |
'value' => 'manual', // can be a single value or an array of string/number/int |
| 466 |
), |
| 467 |
), |
| 468 |
), |
| 469 |
), |
| 470 |
array( |
| 471 |
'id' => 'manual_coupon_code', |
| 472 |
'type' => 'wc_coupons', |
| 473 |
'title' => esc_html__( 'Select manually created discount code', 'merchant' ), |
| 474 |
//'desc' => esc_html__( 'The discount code must be created in WooCommerce to work and add here to validate.', 'merchant' ), |
| 475 |
'conditions' => array( |
| 476 |
'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 477 |
'terms' => array( |
| 478 |
array( |
| 479 |
'field' => 'discount_toggle', // field ID |
| 480 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 481 |
'value' => true, // can be a single value or an array of string/number/int |
| 482 |
), |
| 483 |
array( |
| 484 |
'field' => 'discount_generation_method', // field ID |
| 485 |
'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 486 |
'value' => 'manual', // can be a single value or an array of string/number/int |
| 487 |
), |
| 488 |
), |
| 489 |
), |
| 490 |
), |
| 491 |
), |
| 492 |
) |
| 493 |
); |
| 494 |
|
| 495 |
Merchant_Admin_Options::create( |
| 496 |
array( |
| 497 |
'title' => __( 'Collect Reviews', 'merchant' ), |
| 498 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 499 |
'fields' => array( |
| 500 |
array( |
| 501 |
'id' => 'review_request_email', |
| 502 |
'type' => 'fields_group', |
| 503 |
'title' => esc_html__( 'Review request', 'merchant' ), |
| 504 |
'sub-desc' => esc_html__( 'Encourage your customers to leave a review with automated emails.', 'merchant' ), |
| 505 |
'state' => 'open', |
| 506 |
'default' => 'active', |
| 507 |
'accordion' => true, |
| 508 |
'display_status' => true, |
| 509 |
'fields' => array( |
| 510 |
array( |
| 511 |
'id' => 'subject', |
| 512 |
'type' => 'text', |
| 513 |
'title' => __( 'Subject', 'merchant' ), |
| 514 |
'default' => __( 'Enjoying your recent purchase?', 'merchant' ), |
| 515 |
'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ), |
| 516 |
'hidden_desc' => sprintf( |
| 517 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 518 |
__( |
| 519 |
'<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 order id<br><strong>%4$s:</strong> to show the opening order URL<br><strong>%5$s:</strong> to show the closing order URL', |
| 520 |
'merchant' |
| 521 |
), |
| 522 |
'{first_name}', |
| 523 |
'{last_name}', |
| 524 |
'{order_id}', |
| 525 |
'{order_url_open}', |
| 526 |
'{order_url_close}' |
| 527 |
), |
| 528 |
), |
| 529 |
array( |
| 530 |
'id' => 'body', |
| 531 |
'type' => 'textarea_multiline', |
| 532 |
'title' => __( 'Body', 'merchant' ), |
| 533 |
'default' => __( 'Hello {first_name}, We would be grateful if you shared how things look and feel. Your review helps us and the community that supports us, and it only takes a few seconds. |
| 534 |
Check your order {order_url_open}here{order_url_close}.', 'merchant' ), |
| 535 |
'desc' => __( 'You can use these codes in the content.', 'merchant' ), |
| 536 |
'hidden_desc' => sprintf( |
| 537 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 538 |
__( |
| 539 |
'<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 order id<br><strong>%4$s:</strong> to show the opening order URL<br><strong>%5$s:</strong> to show the closing order URL', |
| 540 |
'merchant' |
| 541 |
), |
| 542 |
'{first_name}', |
| 543 |
'{last_name}', |
| 544 |
'{order_id}', |
| 545 |
'{order_url_open}', |
| 546 |
'{order_url_close}' |
| 547 |
), |
| 548 |
), |
| 549 |
// array( |
| 550 |
// 'id' => 'review_btn_type', |
| 551 |
// 'type' => 'select', |
| 552 |
// 'title' => esc_html__( 'Review request button type', 'merchant' ), |
| 553 |
// 'options' => array( |
| 554 |
// 'rating_stars' => esc_html__( 'Rating stars', 'merchant' ), |
| 555 |
// 'custom_button' => esc_html__( 'Custom Button', 'merchant' ), |
| 556 |
// ), |
| 557 |
// 'default' => 'custom_button', |
| 558 |
// ), |
| 559 |
// array( |
| 560 |
// 'id' => 'review_btn_text', |
| 561 |
// 'type' => 'text', |
| 562 |
// 'title' => __( 'Button text', 'merchant' ), |
| 563 |
// 'default' => __( 'Write a review', 'merchant' ), |
| 564 |
// 'conditions' => array( |
| 565 |
// 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 566 |
// 'terms' => array( |
| 567 |
// array( |
| 568 |
// 'field' => 'review_btn_type', // field ID |
| 569 |
// 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 570 |
// 'value' => 'custom_button', // can be a single value or an array of string/number/int |
| 571 |
// ), |
| 572 |
// ), |
| 573 |
// ), |
| 574 |
// ), |
| 575 |
array( |
| 576 |
'id' => 'preview-info', |
| 577 |
'type' => 'info', |
| 578 |
'content' => sprintf( |
| 579 |
/* Translators: 1. docs link */ |
| 580 |
__( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ), |
| 581 |
esc_url( |
| 582 |
add_query_arg( |
| 583 |
array( |
| 584 |
'action' => 'merchant_pro_preview_request_review_email', |
| 585 |
'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ), |
| 586 |
), |
| 587 |
admin_url( 'admin-post.php' ) |
| 588 |
) |
| 589 |
) |
| 590 |
), |
| 591 |
), |
| 592 |
|
| 593 |
), |
| 594 |
), |
| 595 |
array( |
| 596 |
'id' => 'review_request_reminder_email', |
| 597 |
'type' => 'fields_group', |
| 598 |
'title' => esc_html__( 'Review request reminder', 'merchant' ), |
| 599 |
'sub-desc' => esc_html__( 'Send a second review request to customers who did not submit a review yet.', 'merchant' ), |
| 600 |
'state' => 'closed', |
| 601 |
'default' => 'inactive', |
| 602 |
'accordion' => true, |
| 603 |
'display_status' => true, |
| 604 |
'fields' => array( |
| 605 |
array( |
| 606 |
'id' => 'days_after_first_email', |
| 607 |
'type' => 'number', |
| 608 |
'title' => esc_html__( 'After the first email, send the review request reminder after the following number of days', 'merchant' ), |
| 609 |
'default' => '3', |
| 610 |
), |
| 611 |
array( |
| 612 |
'id' => 'subject', |
| 613 |
'type' => 'text', |
| 614 |
'title' => __( 'Subject', 'merchant' ), |
| 615 |
'default' => __( 'Order {order_id}, how did it go?', 'merchant' ), |
| 616 |
'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ), |
| 617 |
'hidden_desc' => sprintf( |
| 618 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 619 |
__( |
| 620 |
'<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 order id<br><strong>%4$s:</strong> to show the opening order URL<br><strong>%5$s:</strong> to show the closing order URL', |
| 621 |
'merchant' |
| 622 |
), |
| 623 |
'{first_name}', |
| 624 |
'{last_name}', |
| 625 |
'{order_id}', |
| 626 |
'{order_url_open}', |
| 627 |
'{order_url_close}' |
| 628 |
), |
| 629 |
), |
| 630 |
array( |
| 631 |
'id' => 'body', |
| 632 |
'type' => 'textarea_multiline', |
| 633 |
'title' => __( 'Body', 'merchant' ), |
| 634 |
'default' => __( 'Hello {first_name}, |
| 635 |
|
| 636 |
We would be grateful if you shared how things look and feel. Your review helps us and the community that supports us, and it only takes a few seconds.', 'merchant' ), |
| 637 |
'desc' => __( 'You can use these codes in the content.', 'merchant' ), |
| 638 |
'hidden_desc' => sprintf( |
| 639 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 640 |
__( |
| 641 |
'<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 order id<br><strong>%4$s:</strong> to show the opening order URL<br><strong>%5$s:</strong> to show the closing order URL', |
| 642 |
'merchant' |
| 643 |
), |
| 644 |
'{first_name}', |
| 645 |
'{last_name}', |
| 646 |
'{order_id}', |
| 647 |
'{order_url_open}', |
| 648 |
'{order_url_close}' |
| 649 |
), |
| 650 |
), |
| 651 |
// array( |
| 652 |
// 'id' => 'review_btn_type', |
| 653 |
// 'type' => 'select', |
| 654 |
// 'title' => esc_html__( 'Review request button type', 'merchant' ), |
| 655 |
// 'options' => array( |
| 656 |
// 'rating_stars' => esc_html__( 'Rating stars', 'merchant' ), |
| 657 |
// 'custom_button' => esc_html__( 'Custom Button', 'merchant' ), |
| 658 |
// ), |
| 659 |
// 'default' => 'custom_button', |
| 660 |
// ), |
| 661 |
// array( |
| 662 |
// 'id' => 'review_btn_text', |
| 663 |
// 'type' => 'text', |
| 664 |
// 'title' => __( 'Button text', 'merchant' ), |
| 665 |
// 'default' => __( 'Write a review', 'merchant' ), |
| 666 |
// 'conditions' => array( |
| 667 |
// 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered |
| 668 |
// 'terms' => array( |
| 669 |
// array( |
| 670 |
// 'field' => 'review_btn_type', // field ID |
| 671 |
// 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains |
| 672 |
// 'value' => 'custom_button', // can be a single value or an array of string/number/int |
| 673 |
// ), |
| 674 |
// ), |
| 675 |
// ), |
| 676 |
// ), |
| 677 |
array( |
| 678 |
'id' => 'preview-info', |
| 679 |
'type' => 'info', |
| 680 |
'content' => sprintf( |
| 681 |
/* Translators: 1. docs link */ |
| 682 |
__( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ), |
| 683 |
esc_url( |
| 684 |
add_query_arg( |
| 685 |
array( |
| 686 |
'action' => 'merchant_pro_preview_request_review_reminder_email', |
| 687 |
'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ), |
| 688 |
), |
| 689 |
admin_url( 'admin-post.php' ) |
| 690 |
) |
| 691 |
) |
| 692 |
), |
| 693 |
), |
| 694 |
|
| 695 |
), |
| 696 |
), |
| 697 |
array( |
| 698 |
'id' => 'discount_for_review_email', |
| 699 |
'type' => 'fields_group', |
| 700 |
'title' => esc_html__( 'Discount for review', 'merchant' ), |
| 701 |
'sub-desc' => esc_html__( 'Send customers a next-purchase code after submitting a review.', 'merchant' ), |
| 702 |
'state' => 'closed', |
| 703 |
'default' => 'active', |
| 704 |
'accordion' => true, |
| 705 |
'display_status' => true, |
| 706 |
'fields' => array( |
| 707 |
array( |
| 708 |
'id' => 'subject', |
| 709 |
'type' => 'text', |
| 710 |
'title' => __( 'Subject', 'merchant' ), |
| 711 |
'default' => __( 'Your discount is ready', 'merchant' ), |
| 712 |
'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ), |
| 713 |
'hidden_desc' => sprintf( |
| 714 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 715 |
__( |
| 716 |
'<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', |
| 717 |
'merchant' |
| 718 |
), |
| 719 |
'{first_name}', |
| 720 |
'{last_name}', |
| 721 |
'{discount_code}' |
| 722 |
), |
| 723 |
), |
| 724 |
array( |
| 725 |
'id' => 'body', |
| 726 |
'type' => 'textarea_multiline', |
| 727 |
'title' => __( 'Body', 'merchant' ), |
| 728 |
'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}.', |
| 729 |
'merchant' ), |
| 730 |
'desc' => __( 'You can use these codes in the content.', 'merchant' ), |
| 731 |
'hidden_desc' => sprintf( |
| 732 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 733 |
__( |
| 734 |
'<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', |
| 735 |
'merchant' |
| 736 |
), |
| 737 |
'{first_name}', |
| 738 |
'{last_name}', |
| 739 |
'{discount_code}' |
| 740 |
), |
| 741 |
), |
| 742 |
array( |
| 743 |
'id' => 'preview-info', |
| 744 |
'type' => 'info', |
| 745 |
'content' => sprintf( |
| 746 |
/* Translators: 1. docs link */ |
| 747 |
__( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ), |
| 748 |
esc_url( |
| 749 |
add_query_arg( |
| 750 |
array( |
| 751 |
'action' => 'merchant_pro_preview_discount_for_review_email', |
| 752 |
'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ), |
| 753 |
), |
| 754 |
admin_url( 'admin-post.php' ) |
| 755 |
) |
| 756 |
) |
| 757 |
), |
| 758 |
), |
| 759 |
|
| 760 |
), |
| 761 |
), |
| 762 |
array( |
| 763 |
'id' => 'discount_for_review_reminder_email', |
| 764 |
'type' => 'fields_group', |
| 765 |
'title' => esc_html__( 'Review discount reminder', 'merchant' ), |
| 766 |
'sub-desc' => esc_html__( 'Remind your customers to use their next-purchase discount if they haven\'t used it yet.', 'merchant' ), |
| 767 |
'state' => 'closed', |
| 768 |
'default' => 'active', |
| 769 |
'accordion' => true, |
| 770 |
'display_status' => true, |
| 771 |
'fields' => array( |
| 772 |
array( |
| 773 |
'id' => 'days_after_first_email', |
| 774 |
'type' => 'number', |
| 775 |
'title' => esc_html__( 'After the first email, send the discount reminder after the following number of days', 'merchant' ), |
| 776 |
'default' => '3', |
| 777 |
), |
| 778 |
array( |
| 779 |
'id' => 'subject', |
| 780 |
'type' => 'text', |
| 781 |
'title' => __( 'Subject', 'merchant' ), |
| 782 |
'default' => __( 'Your discount is waiting for you', 'merchant' ), |
| 783 |
'desc' => __( 'Be concise, avoid CAPS and !s, and use emojis sparingly.', 'merchant' ), |
| 784 |
'hidden_desc' => sprintf( |
| 785 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 786 |
__( |
| 787 |
'<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', |
| 788 |
'merchant' |
| 789 |
), |
| 790 |
'{first_name}', |
| 791 |
'{last_name}', |
| 792 |
'{discount_code}' |
| 793 |
), |
| 794 |
), |
| 795 |
array( |
| 796 |
'id' => 'body', |
| 797 |
'type' => 'textarea_multiline', |
| 798 |
'title' => __( 'Body', 'merchant' ), |
| 799 |
'default' => __( 'Hello {first_name}, |
| 800 |
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' ), |
| 801 |
'desc' => __( 'You can use these codes in the content.', 'merchant' ), |
| 802 |
'hidden_desc' => sprintf( |
| 803 |
/* Translators: %1$s: Discount percentage, %2$s: Discount amount, %3$s: In Stock, %4$s: Total quantity */ |
| 804 |
__( |
| 805 |
'<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', |
| 806 |
'merchant' |
| 807 |
), |
| 808 |
'{first_name}', |
| 809 |
'{last_name}', |
| 810 |
'{discount_code}' |
| 811 |
), |
| 812 |
), |
| 813 |
array( |
| 814 |
'id' => 'preview-info', |
| 815 |
'type' => 'info', |
| 816 |
'content' => sprintf( |
| 817 |
/* Translators: 1. docs link */ |
| 818 |
__( 'Click <a href="%1$s" target="_blank">here</a> to preview the email and see how it will look.', 'merchant' ), |
| 819 |
esc_url( |
| 820 |
add_query_arg( |
| 821 |
array( |
| 822 |
'action' => 'merchant_pro_preview_discount_for_review_reminder_email', |
| 823 |
'nonce' => wp_create_nonce( 'merchant_pro_advanced_reviews_mailer_preview' ), |
| 824 |
), |
| 825 |
admin_url( 'admin-post.php' ) |
| 826 |
) |
| 827 |
) |
| 828 |
), |
| 829 |
), |
| 830 |
|
| 831 |
), |
| 832 |
), |
| 833 |
array( |
| 834 |
'id' => 'sender_name', |
| 835 |
'type' => 'text', |
| 836 |
'title' => esc_html__( 'Sender name', 'merchant' ), |
| 837 |
'desc' => esc_html__( 'Will be displayed in the inbox, in the "From" field.', 'merchant' ), |
| 838 |
'placeholder' => get_bloginfo( 'name' ), |
| 839 |
'default' => get_bloginfo( 'name' ), |
| 840 |
), |
| 841 |
array( |
| 842 |
'id' => 'sender_email', |
| 843 |
'type' => 'text', |
| 844 |
'title' => esc_html__( 'Sender email', 'merchant' ), |
| 845 |
'desc' => esc_html__( 'We recommend using your customer support email so replies from customers are sent to that address.', 'merchant' ), |
| 846 |
'placeholder' => get_bloginfo( 'admin_email' ), |
| 847 |
'default' => get_bloginfo( 'admin_email' ), |
| 848 |
), |
| 849 |
), |
| 850 |
) |
| 851 |
); |
| 852 |
|
| 853 |
// Modal Settings |
| 854 |
Merchant_Admin_Options::create( |
| 855 |
array( |
| 856 |
'title' => __( 'Modal Settings', 'merchant' ), |
| 857 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 858 |
'fields' => array( |
| 859 |
|
| 860 |
/** |
| 861 |
* Styles |
| 862 |
* |
| 863 |
*/ |
| 864 |
|
| 865 |
// Modal Close icon color. |
| 866 |
array( |
| 867 |
'id' => 'modal_close_icon_color', |
| 868 |
'type' => 'color', |
| 869 |
'title' => __( 'Close icon color', 'merchant' ), |
| 870 |
'default' => '#757575', |
| 871 |
), |
| 872 |
|
| 873 |
// Modal Close icon color (hover). |
| 874 |
array( |
| 875 |
'id' => 'modal_close_icon_color_hover', |
| 876 |
'type' => 'color', |
| 877 |
'title' => __( 'Close icon color (hover)', 'merchant' ), |
| 878 |
'default' => '#212121', |
| 879 |
), |
| 880 |
|
| 881 |
// Modal Title color. |
| 882 |
array( |
| 883 |
'id' => 'modal_title_color', |
| 884 |
'type' => 'color', |
| 885 |
'title' => __( 'Title color', 'merchant' ), |
| 886 |
'default' => '#212121', |
| 887 |
), |
| 888 |
|
| 889 |
// Modal Description color. |
| 890 |
array( |
| 891 |
'id' => 'modal_description_color', |
| 892 |
'type' => 'color', |
| 893 |
'title' => __( 'Description color', 'merchant' ), |
| 894 |
'default' => '#777', |
| 895 |
), |
| 896 |
|
| 897 |
// Modal Textarea color. |
| 898 |
array( |
| 899 |
'id' => 'modal_textarea_color', |
| 900 |
'type' => 'color', |
| 901 |
'title' => __( 'Textarea color', 'merchant' ), |
| 902 |
'default' => '#777', |
| 903 |
), |
| 904 |
|
| 905 |
// Modal Textarea background color. |
| 906 |
array( |
| 907 |
'id' => 'modal_textarea_background_color', |
| 908 |
'type' => 'color', |
| 909 |
'title' => __( 'Textarea background color', 'merchant' ), |
| 910 |
'default' => '#FFF', |
| 911 |
), |
| 912 |
|
| 913 |
// Modal background color. |
| 914 |
array( |
| 915 |
'id' => 'modal_background_color', |
| 916 |
'type' => 'color', |
| 917 |
'title' => __( 'Modal background color', 'merchant' ), |
| 918 |
'default' => '#F5F5F5', |
| 919 |
), |
| 920 |
|
| 921 |
), |
| 922 |
) |
| 923 |
); |
| 924 |
|
| 925 |
// Shortcode |
| 926 |
$merchant_module_id = Merchant_Advanced_Reviews::MODULE_ID; |
| 927 |
Merchant_Admin_Options::create( |
| 928 |
array( |
| 929 |
'module' => $merchant_module_id, |
| 930 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 931 |
'fields' => array( |
| 932 |
array( |
| 933 |
'id' => 'use_shortcode', |
| 934 |
'type' => 'switcher', |
| 935 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 936 |
'default' => 0, |
| 937 |
), |
| 938 |
array( |
| 939 |
'type' => 'info', |
| 940 |
'id' => 'shortcode_info', |
| 941 |
'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.', |
| 942 |
'merchant' ), |
| 943 |
), |
| 944 |
array( |
| 945 |
'id' => 'shortcode_text', |
| 946 |
'type' => 'text_readonly', |
| 947 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 948 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 949 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 950 |
), |
| 951 |
), |
| 952 |
) |
| 953 |
); |
| 954 |
|