PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.1
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.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 / side-cart / admin / options.php

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

597 lines 21.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Side Cart Options.
5 *
6 * @package Merchant
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 Merchant_Admin_Options::create( array(
14 'module' => Merchant_Side_Cart::MODULE_ID,
15 'title' => esc_html__( 'Display Settings', 'merchant' ),
16 'fields' => array(
17 array(
18 'id' => 'show_after_add_to_cart',
19 'type' => 'switcher',
20 'title' => __( 'Shop Page', 'merchant' ),
21 'desc' => __( 'Show side cart after adding product to the cart from shop archive page', 'merchant' ),
22 'default' => 1,
23 ),
24 array(
25 'id' => 'show_after_add_to_cart_single_product',
26 'type' => 'switcher',
27 'title' => __( 'Product Page', 'merchant' ),
28 'desc' => __( 'Display side cart after adding product to the cart from product single page', 'merchant' ),
29 'default' => 0,
30 ),
31 array(
32 'id' => 'show_on_cart_url_click',
33 'type' => 'switcher',
34 'title' => __( 'Cart Icons', 'merchant' ),
35 'desc' => __( 'Show side cart when a user clicks on the cart URL or menu items', 'merchant' ),
36 'default' => 1,
37 ),
38 array(
39 'id' => 'slide_direction',
40 'type' => 'radio',
41 'title' => esc_html__( 'Cart position', 'merchant' ),
42 'options' => array(
43 'right' => esc_html__( 'Slide from right', 'merchant' ),
44 'left' => esc_html__( 'Slide from left', 'merchant' ),
45 ),
46 'default' => 'right',
47 ),
48 array(
49 'id' => 'use_discount_codes',
50 'type' => 'switcher',
51 'title' => __( 'Show discount codes input', 'merchant' ),
52 'default' => 0,
53 ),
54 array(
55 'id' => 'show_checkout_btn',
56 'type' => 'switcher',
57 'title' => __( 'Show checkout button', 'merchant' ),
58 'default' => 1,
59 ),
60 array(
61 'id' => 'checkout_btn_text',
62 'type' => 'text',
63 // 'title' => esc_html__( 'Placement', 'merchant' ),
64 'default' => esc_html__( 'Checkout', 'merchant' ),
65 'conditions' => array(
66 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
67 'terms' => array(
68 array(
69 'field' => 'show_checkout_btn', // field ID
70 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
71 'value' => true, // can be a single value or an array of string/number/int
72 ),
73 ),
74 ),
75 ),
76 array(
77 'id' => 'show_view_cart_btn',
78 'type' => 'switcher',
79 'title' => __( 'Show view cart button', 'merchant' ),
80 'default' => 1,
81 ),
82 array(
83 'id' => 'view_cart_btn_text',
84 'type' => 'text',
85 // 'title' => esc_html__( 'Placement', 'merchant' ),
86 'default' => esc_html__( 'View Cart', 'merchant' ),
87 'conditions' => array(
88 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
89 'terms' => array(
90 array(
91 'field' => 'show_view_cart_btn', // field ID
92 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
93 'value' => true, // can be a single value or an array of string/number/int
94 ),
95 ),
96 ),
97 ),
98 array(
99 'id' => 'use_strikethrough_prices',
100 'type' => 'switcher',
101 'title' => __( 'Show strikethrough prices', 'merchant' ),
102 'default' => 0,
103 ),
104 array(
105 'id' => 'show_savings',
106 'type' => 'switcher',
107 'title' => __( 'Show savings at the bottom', 'merchant' ),
108 'default' => 0,
109 ),
110 array(
111 'id' => 'show_on_devices',
112 'type' => 'checkbox_multiple',
113 'title' => esc_html__( 'Show on devices', 'merchant' ),
114 'options' => array(
115 'desktop' => esc_html__( 'Desktop', 'merchant' ),
116 'mobile' => esc_html__( 'Mobile', 'merchant' ),
117 ),
118 'default' => array( 'desktop', 'mobile' ),
119 ),
120 ),
121 ) );
122
123 Merchant_Admin_Options::create( array(
124 'module' => Merchant_Side_Cart::MODULE_ID,
125 'title' => esc_html__( 'Upsells', 'merchant' ),
126 'fields' => array(
127 array(
128 'id' => 'use_upsells',
129 'type' => 'switcher',
130 'title' => __( 'Cart Upsells', 'merchant' ),
131 'desc' => __( 'Enable upsell products in the side cart', 'merchant' ),
132 'default' => 0,
133 ),
134 array(
135 'id' => 'upsells_type',
136 'type' => 'select',
137 //'title' => esc_html__( 'Placement', 'merchant' ),
138 'options' => array(
139 'related_products' => esc_html__( 'Related Products', 'merchant' ),
140 'custom_upsell' => esc_html__( 'Custom Upsell', 'merchant' ),
141 ),
142 'default' => 'related_products',
143 'conditions' => array(
144 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
145 'terms' => array(
146 array(
147 'field' => 'use_upsells', // field ID
148 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
149 'value' => true, // can be a single value or an array of string/number/int
150 ),
151 ),
152 ),
153 ),
154
155 array(
156 'id' => 'custom_upsells',
157 'type' => 'flexible_content',
158 'sorting' => true,
159 'accordion' => true,
160 'duplicate' => false,
161 'style' => Merchant_Side_Cart::MODULE_ID . '-style default',
162 'button_label' => esc_html__( 'Add New Upsell', 'merchant' ),
163 'conditions' => array(
164 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
165 'terms' => array(
166 array(
167 'field' => 'use_upsells', // field ID
168 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
169 'value' => true, // can be a single value or an array of string/number/int
170 ),
171 array(
172 'field' => 'upsells_type', // field ID
173 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
174 'value' => 'custom_upsell', // can be a single value or an array of string/number/int
175 ),
176 ),
177 ),
178 'default' => array(
179 array(
180 'layout' => 'upsell-details',
181 'upsell_based_on' => 'products',
182 'exclude_product_ids' => 0,
183 'custom_upsell_type' => 'products',
184 ),
185 ),
186 'layouts' => array(
187 'upsell-details' => array(
188 'title' => esc_html__( 'Custom Upsells', 'merchant' ),
189 'title-field' => 'offer-title', // text field ID to use as title for the layout
190 'fields' => array(
191 array(
192 'id' => 'upsell_based_on',
193 'type' => 'select',
194 'title' => esc_html__( 'Trigger to add the upsell for', 'merchant' ),
195 'options' => array(
196 'all' => esc_html__( 'All products', 'merchant' ),
197 'products' => esc_html__( 'Specific product', 'merchant' ),
198 'categories' => esc_html__( 'Specific category', 'merchant' ),
199 ),
200 'default' => 'products',
201 ),
202 array(
203 'id' => 'product_ids',
204 'type' => 'products_selector',
205 'title' => esc_html__( 'Select product(s)', 'merchant' ),
206 'multiple' => true,
207 'desc' => esc_html__( 'Select the product(s) that you want to add the upsell for', 'merchant' ),
208 'allowed_types' => array( 'simple', 'variable' ),
209 'conditions' => array(
210 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
211 'terms' => array(
212 array(
213 'field' => 'upsell_based_on', // field ID
214 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
215 'value' => 'products', // can be a single value or an array of string/number/int
216 ),
217 ),
218 ),
219 ),
220 array(
221 'id' => 'category_slugs',
222 'type' => 'select_ajax',
223 'title' => esc_html__( 'Select category(es)', 'merchant' ),
224 'source' => 'options',
225 'multiple' => true,
226 'options' => Merchant_Admin_Options::get_category_select2_choices(),
227 'placeholder' => esc_html__( 'Search category(es)', 'merchant' ),
228 'desc' => esc_html__( 'Select the category(es) that you want to add the upsell for.', 'merchant' ),
229 'conditions' => array(
230 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
231 'terms' => array(
232 array(
233 'field' => 'upsell_based_on', // field ID
234 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
235 'value' => 'categories', // can be a single value or an array of string/number/int
236 ),
237 ),
238 ),
239 ),
240 array(
241 'id' => 'exclusion_toggle',
242 'type' => 'switcher',
243 'title' => __( 'Exclusion List', 'merchant' ),
244 'desc' => __( 'Select products that will not display upsells.', 'merchant' ),
245 'default' => 0,
246 'conditions' => array(
247 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
248 'terms' => array(
249 array(
250 'field' => 'upsell_based_on', // field ID
251 'operator' => 'in', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
252 'value' => array( 'all', 'categories' ), // can be a single value or an array of string/number/int
253 ),
254 ),
255 ),
256 ),
257 array(
258 'id' => 'excluded_product_ids',
259 'type' => 'products_selector',
260 'title' => esc_html__( 'Exclude products', 'merchant' ),
261 'multiple' => true,
262 'desc' => esc_html__( 'Upsell will not be displayed for selected products.', 'merchant' ),
263 'allowed_types' => array( 'simple', 'variable' ),
264 'conditions' => array(
265 'relation' => 'OR', // AND/OR, If not provided, only first term will be considered
266 'terms' => array(
267 array(
268 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
269 'terms' => array(
270 array(
271 'field' => 'upsell_based_on', // field ID
272 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
273 'value' => 'all', // can be a single value or an array of string/number/int
274 ),
275 array(
276 'field' => 'exclusion_toggle', // field ID
277 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
278 'value' => true, // can be a single value or an array of string/number/int
279 ),
280 ),
281 ),
282 array(
283 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
284 'terms' => array(
285 array(
286 'field' => 'upsell_based_on', // field ID
287 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
288 'value' => 'categories', // can be a single value or an array of string/number/int
289 ),
290 array(
291 'field' => 'exclusion_toggle', // field ID
292 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
293 'value' => true, // can be a single value or an array of string/number/int
294 ),
295 ),
296 ),
297 ),
298 ),
299 ),
300 array(
301 'id' => 'excluded_category_slugs',
302 'type' => 'select_ajax',
303 'title' => esc_html__( 'Exclude category(es)', 'merchant' ),
304 'source' => 'options',
305 'multiple' => true,
306 'options' => Merchant_Admin_Options::get_category_select2_choices(),
307 'placeholder' => esc_html__( 'Search category(es)', 'merchant' ),
308 'desc' => esc_html__( 'Upsell will not be displayed for selected category products.', 'merchant' ),
309 'conditions' => array(
310 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
311 'terms' => array(
312 array(
313 'field' => 'upsell_based_on', // field ID
314 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
315 'value' => 'all', // can be a single value or an array of string/number/int
316 ),
317 array(
318 'field' => 'exclusion_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 ),
323 ),
324 ),
325 array(
326 'id' => 'custom_upsell_type',
327 'type' => 'select',
328 'title' => esc_html__( 'Trigger upsells', 'merchant' ),
329 'options' => array(
330 'products' => esc_html__( 'Specific product', 'merchant' ),
331 'categories' => esc_html__( 'Specific category', 'merchant' ),
332 ),
333 'default' => 'products',
334 ),
335 array(
336 'id' => 'upsells_product_ids',
337 'type' => 'products_selector',
338 'title' => esc_html__( 'Select product(s)', 'merchant' ),
339 'multiple' => true,
340 'desc' => esc_html__( 'Select the product(s) that you want to add the upsell for', 'merchant' ),
341 'allowed_types' => array( 'simple', 'variable' ),
342 'conditions' => array(
343 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
344 'terms' => array(
345 array(
346 'field' => 'custom_upsell_type', // field ID
347 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
348 'value' => 'products', // can be a single value or an array of string/number/int
349 ),
350 ),
351 ),
352 ),
353 array(
354 'id' => 'upsells_category_slugs',
355 'type' => 'select_ajax',
356 'title' => esc_html__( 'Select category(es)', 'merchant' ),
357 'source' => 'options',
358 'multiple' => true,
359 'options' => Merchant_Admin_Options::get_category_select2_choices(),
360 'placeholder' => esc_html__( 'Search category(es)', 'merchant' ),
361 'desc' => esc_html__( 'Select the category(es) that you want to display the upsell products form.', 'merchant' ),
362 'conditions' => array(
363 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
364 'terms' => array(
365 array(
366 'field' => 'custom_upsell_type', // field ID
367 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
368 'value' => 'categories', // can be a single value or an array of string/number/int
369 ),
370 ),
371 ),
372 ),
373 ),
374 ),
375 ),
376 ),
377
378
379 array(
380 'id' => 'upsells_products_count_limitation_toggle',
381 'label' => __( 'Limit the number of upsells in the cart', 'merchant' ),
382 'type' => 'checkbox',
383 'default' => 0,
384 'conditions' => array(
385 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
386 'terms' => array(
387 array(
388 'field' => 'use_upsells', // field ID
389 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
390 'value' => true, // can be a single value or an array of string/number/int
391 ),
392 ),
393 ),
394 ),
395 array(
396 'id' => 'upsells_products_count_limitation',
397 'title' => __( 'Maximum number of upsells to display', 'merchant' ),
398 'type' => 'number',
399 'default' => 5,
400 'min' => 1,
401 'step' => 1,
402 'conditions' => array(
403 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
404 'terms' => array(
405 array(
406 'field' => 'use_upsells', // field ID
407 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
408 'value' => true, // can be a single value or an array of string/number/int
409 ),
410 array(
411 'field' => 'upsells_products_count_limitation_toggle', // field ID
412 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
413 'value' => true, // can be a single value or an array of string/number/int
414 ),
415 ),
416 ),
417 ),
418 array(
419 'id' => 'upsells_title',
420 'title' => __( 'Upsell title', 'merchant' ),
421 'type' => 'text',
422 'default' => __( 'You might also like', 'merchant' ),
423 'conditions' => array(
424 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
425 'terms' => array(
426 array(
427 'field' => 'use_upsells', // field ID
428 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
429 'value' => true, // can be a single value or an array of string/number/int
430 ),
431 ),
432 ),
433 ),
434 array(
435 'id' => 'upsells_add_to_cart_text',
436 'title' => __( 'Button text', 'merchant' ),
437 'type' => 'text',
438 'default' => __( 'Add', 'merchant' ),
439 'conditions' => array(
440 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
441 'terms' => array(
442 array(
443 'field' => 'use_upsells', // field ID
444 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
445 'value' => true, // can be a single value or an array of string/number/int
446 ),
447 ),
448 ),
449 ),
450 array(
451 'id' => 'upsells_style',
452 'type' => 'select',
453 'title' => esc_html__( 'Upsell layout', 'merchant' ),
454 'options' => array(
455 'carousel' => esc_html__( 'Carousel', 'merchant' ),
456 'block' => esc_html__( 'List', 'merchant' ),
457 ),
458 'default' => 'block',
459 'conditions' => array(
460 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
461 'terms' => array(
462 array(
463 'field' => 'use_upsells', // field ID
464 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
465 'value' => true, // can be a single value or an array of string/number/int
466 ),
467 ),
468 ),
469 ),
470 ),
471 ) );
472
473 // Side Cart Settings
474 Merchant_Admin_Options::create( array(
475 'title' => esc_html__( 'Look and Feel', 'merchant' ),
476 'module' => 'floating-mini-cart',
477 'fields' => array(
478
479 array(
480 'id' => 'side-cart-width',
481 'type' => 'range',
482 'title' => esc_html__( 'Side cart width', 'merchant' ),
483 'min' => 0,
484 'max' => 2000,
485 'step' => 1,
486 'default' => 380,
487 'unit' => 'px',
488 ),
489
490 array(
491 'id' => 'side-cart-title-color',
492 'type' => 'color',
493 'title' => esc_html__( 'Title color', 'merchant' ),
494 'default' => '#212121',
495 ),
496
497 array(
498 'id' => 'side-cart-title-icon-color',
499 'type' => 'color',
500 'title' => esc_html__( 'Title icon color', 'merchant' ),
501 'default' => '#212121',
502 ),
503
504 array(
505 'id' => 'side-cart-title-background-color',
506 'type' => 'color',
507 'title' => esc_html__( 'Title background color', 'merchant' ),
508 'default' => '#cccccc',
509 ),
510
511 array(
512 'id' => 'side-cart-content-text-color',
513 'type' => 'color',
514 'title' => esc_html__( 'Content text color', 'merchant' ),
515 'default' => '#212121',
516 ),
517
518 array(
519 'id' => 'side-cart-content-background-color',
520 'type' => 'color',
521 'title' => esc_html__( 'Content background color', 'merchant' ),
522 'default' => '#ffffff',
523 ),
524
525 array(
526 'id' => 'side-cart-content-remove-color',
527 'type' => 'color',
528 'title' => esc_html__( 'Content (x) color', 'merchant' ),
529 'default' => '#ffffff',
530 ),
531
532 array(
533 'id' => 'side-cart-content-remove-background-color',
534 'type' => 'color',
535 'title' => esc_html__( 'Content (x) background color', 'merchant' ),
536 'default' => '#212121',
537 ),
538
539 array(
540 'id' => 'side-cart-total-text-color',
541 'type' => 'color',
542 'title' => esc_html__( 'Total text color', 'merchant' ),
543 'default' => '#212121',
544 ),
545
546 array(
547 'id' => 'side-cart-total-background-color',
548 'type' => 'color',
549 'title' => esc_html__( 'Total background color', 'merchant' ),
550 'default' => '#f5f5f5',
551 ),
552
553 array(
554 'id' => 'side-cart-button-color',
555 'type' => 'color',
556 'title' => esc_html__( 'Button color', 'merchant' ),
557 'default' => '#ffffff',
558 ),
559
560 array(
561 'id' => 'side-cart-button-color-hover',
562 'type' => 'color',
563 'title' => esc_html__( 'Button color hover', 'merchant' ),
564 'default' => '#ffffff',
565 ),
566
567 array(
568 'id' => 'side-cart-button-border-color',
569 'type' => 'color',
570 'title' => esc_html__( 'Button border color', 'merchant' ),
571 'default' => '#212121',
572 ),
573
574 array(
575 'id' => 'side-cart-button-border-color-hover',
576 'type' => 'color',
577 'title' => esc_html__( 'Button border color hover', 'merchant' ),
578 'default' => '#313131',
579 ),
580
581 array(
582 'id' => 'side-cart-button-background-color',
583 'type' => 'color',
584 'title' => esc_html__( 'Button background color', 'merchant' ),
585 'default' => '#212121',
586 ),
587
588 array(
589 'id' => 'side-cart-button-background-color-hover',
590 'type' => 'color',
591 'title' => esc_html__( 'Button background color hover', 'merchant' ),
592 'default' => '#313131',
593 ),
594
595 ),
596 ) );
597