-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAdmin.php
2030 lines (1843 loc) · 85.2 KB
/
Admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php namespace Wc1c\Main\Schemas\Productscml;
defined('ABSPATH') || exit;
use Wc1c\Main\Traits\CoreTrait;
use Wc1c\Main\Traits\SingletonTrait;
use Wc1c\Main\Traits\UtilityTrait;
/**
* Admin
*
* @package Wc1c\Main\Schemas\Productscml
*/
class Admin
{
use SingletonTrait;
use UtilityTrait;
use CoreTrait;
/**
* @return void
*/
public function initConfigurationsFields()
{
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsReceiver'], 10, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProducts'], 20, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsSync'], 30, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsSku'], 60, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsCategories'], 60, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsNames'], 60, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsDescriptions'], 60, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsImages'], 60, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsAttributes'], 60, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsPrices'], 70, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsInventories'], 71, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsTaxes'], 73, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsDimensions'], 74, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsOther'], 79, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsProductsWithCharacteristics'], 80, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsCategories'], 80, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsAttributes'], 90, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsMediaLibrary'], 100, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsLogs'], 110, 1);
add_filter('wc1c_configurations-update_form_load_fields', [$this, 'configurationsFieldsOther'], 120, 1);
}
/**
* Configurations fields: receiver
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsReceiver(array $fields): array
{
$fields['title_receiver'] =
[
'title' => __('Receiving requests from 1C', 'wc1c-main'),
'type' => 'title',
'description' => __('Authorization of requests and regulation of algorithms for receiving requests for the Receiver from the 1C programs by CommerceML protocol.', 'wc1c-main'),
];
$lazy_sign = $this->core()->configuration()->getMeta('receiver_lazy_sign');
if(empty($lazy_sign))
{
$lazy_sign = md5($this->core()->configuration()->getId() . time());
$this->core()->configuration()->addMetaData('receiver_lazy_sign', $lazy_sign, true);
$this->core()->configuration()->saveMetaData();
}
$url_raw = trim(get_site_url(null, '/?wc1c-receiver=' . $this->core()->configuration()->getId() . '&lazysign=' . $lazy_sign . '&get_param'));
$url_raw = '<span class="d-block input-text mt-0 p-2 bg-light regular-input wc1c_urls">' . esc_url($url_raw) . '</span>';
$fields['url_requests'] =
[
'title' => __('Website address', 'wc1c-main'),
'type' => 'raw',
'raw' => $url_raw,
'description' => sprintf(
'%s<hr>%s',
__('Specified in the exchange settings on the 1C side. The Recipient is located at this address, which will receive requests from 1C.', 'wc1c-main'),
__('When copying, you need to get rid of whitespace characters, if they are present.', 'wc1c-main')
)
];
$fields['user_login'] =
[
'title' => __('Username', 'wc1c-main'),
'type' => 'text',
'description' => sprintf(
'%s<hr>%s',
__('Specified when setting up an exchange with a site on the 1C side. Any name can be specified, except for an empty value.', 'wc1c-main'),
__('Work with data on the site is performed on behalf of the configuration owner, and not on behalf of the specified username.', 'wc1c-main')
),
'default' => '',
'css' => 'min-width: 377px;',
];
$fields['user_password'] =
[
'title' => __('User password', 'wc1c-main'),
'type' => 'password',
'description' => __('Specified in pair with the username when setting up on the 1C side. It is advisable not to specify a password for the current WordPress user.', 'wc1c-main'),
'default' => '',
'css' => 'min-width: 377px;',
];
return $fields;
}
/**
* Configuration fields: other
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsOther(array $fields): array
{
$fields['title_other'] =
[
'title' => __('Other parameters', 'wc1c-main'),
'type' => 'title',
'description' => __('Change of data processing behavior for environment compatibility and so on.', 'wc1c-main'),
];
$fields['php_post_max_size'] =
[
'title' => __('Maximum size of accepted requests', 'wc1c-main'),
'type' => 'text',
'description' => sprintf
(
'%s<br />%s <b>%s</b><hr>%s',
__('Enter the maximum size of accepted requests from 1C at a time in bytes. May be specified with a dimension suffix, such as 7M, where M = megabyte, K = kilobyte, G - gigabyte.', 'wc1c-main'),
__('Current WC1C limit:', 'wc1c-main'),
wc1c()->settings()->get('php_post_max_size', wc1c()->environment()->get('php_post_max_size')),
__('Can only decrease the value, because it must not exceed the limits from the WC1C settings.', 'wc1c-main')
),
'default' => wc1c()->settings()->get('php_post_max_size', wc1c()->environment()->get('php_post_max_size')),
'css' => 'min-width: 100px;',
];
$fields['php_max_execution_time'] =
[
'title' => __('Maximum time for execution PHP', 'wc1c-main'),
'type' => 'text',
'description' => sprintf
(
'%s <br /> %s <b>%s</b> <br /> %s',
__('Value is seconds. Algorithms of current configuration will run until a time limit is end.', 'wc1c-main'),
__('Current WC1C limit:', 'wc1c-main'),
wc1c()->settings()->get('php_max_execution_time', wc1c()->environment()->get('php_max_execution_time')),
__('If specify 0, the time limit will be disabled. Specifying 0 is not recommended, it is recommended not to exceed the WC1C limit.', 'wc1c-main')
),
'default' => wc1c()->settings()->get('php_max_execution_time', wc1c()->environment()->get('php_max_execution_time')),
'css' => 'min-width: 100px;',
];
$fields['browser_debug'] =
[
'title' => __('Browser debug mode', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('The setting is required only for debugging activities and must be turned off when such activities are completed.', 'wc1c-main'),
__('Only used in debug mode.', 'wc1c-main')
),
'default' => 'no'
];
$response_options =
[
'no' => __('Do not use', 'wc1c-main'),
'standard' => __('Standard', 'wc1c-main'),
];
$fields['directory_clean_mode'] =
[
'title' => __('Cleaning up a directory', 'wc1c-main'),
'type' => 'select',
'description' => sprintf
('<b>%s</b> - %s<br /><b>%s</b> - %s<br /><hr>%s',
__('Do not use', 'wc1c-main'),
__('File deletion steps will be skipped.', 'wc1c-main'),
__('Standard', 'wc1c-main'),
__('The standard cleaning algorithm will be used. Suitable for most users.', 'wc1c-main'),
__('The choice of deletion mode must be taken very seriously.', 'wc1c-main')
),
'default' => 'standard',
'css' => 'min-width:100%',
'options' => $response_options
];
$fields['ob_end_clean'] =
[
'title' => __('Clearing the buffer before the receiver', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('When enabled, buffering will be disabled in the request receiver and the output buffer will be cleared.', 'wc1c-main'),
__('Used for sites that have viruses.', 'wc1c-main')
),
'default' => 'yes'
];
$response_options =
[
'failure' => __('Failure', 'wc1c-main'),
'success' => __('Success', 'wc1c-main'),
];
$fields['response_unknown_action'] =
[
'title' => __('Response on unknown action', 'wc1c-main'),
'type' => 'select',
'description' => sprintf
('<b>%s</b> - %s<br /><b>%s</b> - %s<br /><hr>%s',
__('Failure', 'wc1c-main'),
__('Error information will be sent.', 'wc1c-main'),
__('Success', 'wc1c-main'),
__('Information about the successful processing of the request will be sent.', 'wc1c-main'),
__('You need to understand what this setting is for. The default is to always throw an error.', 'wc1c-main')
),
'default' => 'failure',
'css' => 'min-width:100%',
'options' => $response_options
];
return $fields;
}
/**
* Configuration fields: categories
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsCategories(array $fields): array
{
$fields['categories'] =
[
'title' => __('Categories', 'wc1c-main'),
'type' => 'title',
'description' => __('Categorization of product positions on the WooCommerce side according to data from 1C.', 'wc1c-main'),
];
$merge_options =
[
'no' => __('Do not use', 'wc1c-main'),
'yes' => __('Name matching', 'wc1c-main'),
'yes_parent' => __('Name matching, with the match of the parent category', 'wc1c-main'),
];
$fields['categories_merge'] =
[
'title' => __('Using existing categories', 'wc1c-main'),
'type' => 'select',
'description' => sprintf
('%s<br /><b>%s</b> - %s<br /><b>%s</b> - %s<br /><hr>%s',
__('In the event that the categories were created manually or from another configuration, you must enable the merge. Merging will avoid duplication of categories.', 'wc1c-main'),
__('Name matching', 'wc1c-main'),
__('The categories will be linked when the names match without any other data matching.', 'wc1c-main'),
__('Name matching, with the match of the parent category', 'wc1c-main'),
__('The categories will be linked only if they have the same name and parent category.', 'wc1c-main'),
__('When using existing categories, the creation of found categories will be skipped and the update settings will be applied for them.', 'wc1c-main')
),
'default' => 'no',
'css' => 'min-width:100%',
'options' => $merge_options
];
$fields['categories_create'] =
[
'title' => __('Creating categories', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('Categories are only created if they are recognized as new. New categories are those that are not related according to 1C data and are not in an identical hierarchy.', 'wc1c-main'),
__('To create categories, you must also set up category sources. The current setting is just a global flag to allow creation.', 'wc1c-main')
),
'default' => 'no'
];
$fields['categories_classifier_groups_create'] =
[
'title' => __('Creating categories from classifier groups', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('Categories are only created if they have not been created before. Also, if access to work with categories is allowed from the global settings.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_classifier_groups_create_assign_parent'] =
[
'title' => __('Assign parent categories on creating', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('If there is a parent category in 1C, it will also be assigned in WooCommerce. The setting is triggered when a category is created.', 'wc1c-main'),
'default' => 'yes'
];
$fields['categories_classifier_groups_create_assign_description'] =
[
'title' => __('Assign categories description on creating', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('When creating categories, descriptions will be filled in if category descriptions are present in 1C.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_classifier_groups_create_assign_image'] =
[
'title' => __('Assign image on creating', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('If there is a image in 1C, it will also be assigned in WooCommerce. The setting is triggered when a category is created.', 'wc1c-main'),
'default' => 'yes'
];
$fields['categories_update'] =
[
'title' => __('Updating categories', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('If the category created earlier was linked to 1C data, then when you change any category data in 1C, the data will also change in WooCommerce.', 'wc1c-main'),
__('To update categories, you must also configure category sources. The current setting is just a global checkbox that allows updates.', 'wc1c-main')
),
'default' => 'no'
];
$fields['categories_classifier_groups_update'] =
[
'title' => __('Updating categories from classifier groups', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('If the category created earlier was linked to 1C data, then when you change any category data in 1C, the data will also change in WooCommerce.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_classifier_groups_update_parent'] =
[
'title' => __('Update parent categories on updating', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('When enabled, parent categories will be updated when they are updated in 1C. The setting is triggered when a category is updated.', 'wc1c-main'),
'default' => 'yes'
];
$fields['categories_classifier_groups_update_name'] =
[
'title' => __('Updating categories name', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('If the category was previously linked to 1C data, then when changing the name in 1C, the name will also change in WooCommerce.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_classifier_groups_update_description'] =
[
'title' => __('Updating categories description', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('If the category was previously linked to 1C data, then when you change the description in 1C, the description will also change in WooCommerce.
It should be borne in mind that descriptions in 1C are not always stored. Therefore, you should not enable this function if the descriptions were filled out on the site.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_classifier_groups_update_image'] =
[
'title' => __('Updating categories image', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('If the category was previously linked to 1C data, then when changing the image in 1C, the image will also change in WooCommerce.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_update_only_configuration'] =
[
'title' => __('Consider configuration when updating categories', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('When updating category data, the update will only occur if the category was created through the current configuration.', 'wc1c-main'),
'default' => 'no'
];
$fields['categories_update_only_schema'] =
[
'title' => __('Consider schema when updating categories', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('When updating category data, the update will only occur if the category was created through the current schema.', 'wc1c-main'),
'default' => 'yes'
];
return $fields;
}
/**
* Configuration fields: products with characteristics
*
* @param array $fields Прежний массив настроек
*
* @return array Новый массив настроек
*/
public function configurationsFieldsProductsWithCharacteristics(array $fields): array
{
$fields['title_products_with_characteristics'] =
[
'title' => __('Products (goods): with characteristics', 'wc1c-main'),
'type' => 'title',
'description' => sprintf
(
'%s %s %s',
__('The same product (product) can have various kinds of differences, such as color, size, etc.', 'wc1c-main'),
__('In 1C programs, these differences can be presented in the form of characteristics.', 'wc1c-main'),
__('This section of the settings regulates the behavior of the processing of such characteristics on the Woocommerce side.', 'wc1c-main')
)
];
$fields['products_with_characteristics'] =
[
'title' => __('Using characteristics', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<br/>%s %s<br /><hr>%s',
__('When turning on, products with characteristics will processing on the basis of settings for products.', 'wc1c-main'),
__('At the same time, products are divided into simple and variable. Work with simple products will occur when the parent is not found.', 'wc1c-main'),
__('The search for the parent product takes place according to a unique identifier of 1C. Search for simple products is carried out in all available settings for synchronization.', 'wc1c-main'),
__('With the option disconnected, all the data of products with characteristics will be simply missed. Neither the creation, nor update and no other processing will be.', 'wc1c-main')
),
'default' => 'no'
];
$fields['products_with_characteristics_simple'] =
[
'title' => __('Create simple products from characteristics', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s %s<br /><hr>%s',
__('Sometimes 1C does not provide complete information for creating variable products in WooCommerce.', 'wc1c-main'),
__('The option allows you to enable the creation of simple products according to the characteristics of the item from 1C.', 'wc1c-main'),
__('As a result, it turns out like this: a characteristic in 1C is equal to a simple product in WooCommerce.', 'wc1c-main')
),
'default' => 'no'
];
return $fields;
}
/**
* Configuration fields: attributes
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsAttributes(array $fields): array
{
$fields['attributes'] =
[
'title' => __('Attributes', 'wc1c-main'),
'type' => 'title',
'description' => sprintf
(
'%s %s %s',
__('General (global) attributes are used for all products.', 'wc1c-main'),
__('Work with individual product attributes is configured at the product level.', 'wc1c-main'),
__('These settings only affect the global attributes. As a rule, there is no deletion of global attributes and their values. Removal operations are performed manually or through a cleaner.', 'wc1c-main')
)
];
$fields['attributes_create'] =
[
'title' => __('Creating attributes', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('It will be allowed to add common attributes for products based on characteristics, properties and other data according to the other setting sections.', 'wc1c-main'),
__('Creation will only occur if the attribute has not been previously created. Verification is possible by: name, identifier from 1C, etc. The default is to match by name.', 'wc1c-main')
),
'default' => 'no'
];
$fields['attributes_create_by_classifier_properties'] =
[
'title' => __('Creating attributes from classifier properties', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('The creation will occur when processing the properties of the classifier. Creation occurs only if there is no attribute with the specified name or associated identifier.', 'wc1c-main'),
__('If disable the creation of attributes and create some attributes manually, it is possible to adding values to them.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['attributes_create_by_product_characteristics'] =
[
'title' => __('Creating attributes from product characteristics', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s %s<hr>%s',
__('Products may contain characteristics that are not in the properties of the classifier.', 'wc1c-main'),
__('Due to this setting, when processing such products, missing global attributes will be created.', 'wc1c-main'),
__('If disable the creation of attributes and create some attributes manually, it is possible to adding values to them.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['attributes_values_by_classifier_properties'] =
[
'title' => __('Adding values to attributes from classifier properties', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s %s',
__('Adding product attribute values based on classifier property values.', 'wc1c-main'),
__('The value is added only if it is absent: by name.', 'wc1c-main'),
__('The values of the classifier properties are not always filled in by the reference book. It is also recommended to enable adding values based on product properties.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['attributes_values_by_product_properties'] =
[
'title' => __('Adding values to attributes from product properties', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s %s',
__('Classifier properties do not always contain values in the reference. When the setting is enabled, values will be added based on the values of the product properties.', 'wc1c-main'),
__('The value is added only if it is absent: by name.', 'wc1c-main'),
__('The value is added only if it is missing.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['attributes_values_by_product_characteristics'] =
[
'title' => __('Adding values to attributes from product characteristics', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s %s<hr>%s %s',
__('The characteristics of products may contain data on properties that are not presented anywhere.', 'wc1c-main'),
__('Based on this data, in the process of processing products, new values will be added.', 'wc1c-main'),
__('The value is added only if it is absent: by name.', 'wc1c-main'),
__('For correct operation, you must either enable the setting for creating global attributes based on product characteristics, or add the attribute manually.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['attributes_update'] =
[
'title' => __('Updating attributes', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('It will be allowed to update common attributes for products based on characteristics, properties and other data according to the other setting sections.', 'wc1c-main'),
__('Attribute updating refers to adding product attribute values based on product characteristics, classifier properties, and other data specified in the settings. If you disable this feature, work will only occur with existing attribute values without updating attribute data. In some cases, updating refers to sorting and renaming the attributes themselves.', 'wc1c-main')
),
'default' => 'no'
];
return $fields;
}
/**
* Configuration fields: products categories
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsProductsCategories(array $fields): array
{
$fields['products_categories'] =
[
'title' => __('Products (goods): categories', 'wc1c-main'),
'type' => 'title',
'description' => sprintf
('%s',
__('Algorithms for product categories when creating and updating.', 'wc1c-main')
),
];
$products_categories_source_options =
[
'no' => __('Do not use', 'wc1c-main'),
'classifier_groups' => __('From classifier groups', 'wc1c-main'),
];
$fields['products_categories_source'] =
[
'title' => __('Source for categories', 'wc1c-main'),
'type' => 'select',
'description' => sprintf
(
'%s<hr><b>%s</b> - %s<br /><b>%s</b> - %s %s',
__('The setting works when creating and updating products (goods).', 'wc1c-main'),
__('Do not use', 'wc1c-main'),
__('Populating the categories data from CommerceML data will be skipped. If a product is updating, then its current categories will not be updated.', 'wc1c-main'),
__('From classifier groups', 'wc1c-main'),
__('The categories data will be filled in based on the classifier groups of the products (goods).', 'wc1c-main'),
__('To use this mode, need to configure the creation of categories based on classifier groups.', 'wc1c-main')
),
'default' => 'classifier_groups',
'options' => $products_categories_source_options
];
$fields['products_create_adding_category'] =
[
'title' => __('Assigning categories of the creating products', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('Products in 1C have their own hierarchy. Thanks to this hierarchy, it is possible to automatically assign categories to products on the site.', 'wc1c-main'),
__('For the correct operation of filling in categories, you must first configure them in a separate settings block.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['products_create_adding_category_fill_parent'] =
[
'title' => __('Filling the parent categories of the created product', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('If the category assigned to a product is a child category of other categories, then the parent categories will also be assigned to the product being created.', 'wc1c-main'),
__('It is recommended to enable this setting.', 'wc1c-main')
),
'default' => 'yes'
];
$products_update_categories_options =
[
'no' => __('Do not update', 'wc1c-main'),
'yes' => __('Update in any case', 'wc1c-main'),
'add' => __('Add if not on the site and available in 1C', 'wc1c-main'),
'yes_yes' => __('Update if present on the site and in 1C', 'wc1c-main'),
];
$fields['products_update_categories'] =
[
'title' => __('Categories updating when products updates', 'wc1c-main'),
'default' => 'no',
'type' => 'select',
'description' => sprintf
(
'<b>%s</b> - %s<br /><b>%s</b> - %s<br /><b>%s</b> - %s<br /><b>%s</b> - %s<hr>%s',
__('Do not update', 'wc1c-main'),
__('Categories updates will be skipped in any case.', 'wc1c-main'),
__('Update in any case', 'wc1c-main'),
__('Categories will be updated in any case. The same value will always be on the site and in 1C.', 'wc1c-main'),
__('Add if not on the site and available in 1C', 'wc1c-main'),
__('Existing categories will not be affected. There will be a filling of those missing on the site if they are available in 1C.', 'wc1c-main'),
__('Update if present on the site and in 1C', 'wc1c-main'),
__('Categories will be updated only if they are filled in 1C and on the site at the same time.', 'wc1c-main'),
__('The setting works when updating products (goods).', 'wc1c-main')
),
'options' => $products_update_categories_options
];
$fields['products_update_categories_fill_parent'] =
[
'title' => __('Filling the parent categories when requesting product updates', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => __('Fill in the categories that are higher in level for the product? It is recommended to enable this setting.', 'wc1c-main'),
'default' => 'yes'
];
return $fields;
}
/**
* Configuration fields: products sync
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsProductsSync(array $fields): array
{
$fields['product_sync'] =
[
'title' => __('Products (goods): synchronization', 'wc1c-main'),
'type' => 'title',
'description' => sprintf
('%s <br /> %s',
__('Dispute resolution between existing products (goods) on the 1C side and in WooCommerce. For extended matching (example by SKU), must use the extension.', 'wc1c-main'),
__('Products not found by sync keys will be treated as new. Accordingly, the rules for creating products will apply to them.', 'wc1c-main')
),
];
$fields['product_sync_by_id'] =
[
'title' => __('By external ID from 1C', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr> %s',
__('When creating new products based on data from 1C, a universal global identifier from 1C is filled in for them. Can also fill in global identifiers manually for manually created products.', 'wc1c-main'),
__('Enabling the option allows you to use the filled External ID to mark products (goods) as existing, and thereby run algorithms to update them.', 'wc1c-main')
),
'default' => 'yes'
];
return $fields;
}
/**
* Configuration fields: products
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsProducts(array $fields): array
{
$fields['title_products'] =
[
'title' => __('Products (goods)', 'wc1c-main'),
'type' => 'title',
'description' => __('Regulation of algorithms for products. Operations on products are based on data from product catalogs and offer packages described in CommerceML.', 'wc1c-main'),
];
$fields['products_create'] =
[
'title' => __('Creation of products', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable the creation of new products upon request from 1C. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<br />%s<br /><hr>%s',
__('The products is only created if it is not found in WooCommerce when searching by criteria for synchronization.', 'wc1c-main'),
__('To create, the products parameters from the current configuration are used.', 'wc1c-main'),
__('The option works only with automatic creation of products. When disabled, it is still possible to manually create products through ManualCML and similar extensions.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['products_create_delete_mark'] =
[
'title' => __('Creation of products: marked for deletion in 1C', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('If the product is marked in 1C for deletion, then when you enable the setting, it will still be created on the site and filled with data.', 'wc1c-main'),
__('At the same time, it is possible to place such products directly in the trash. There is a separate setting for this.', 'wc1c-main')
),
'default' => 'no'
];
$fields['products_create_delete_mark_trash'] =
[
'title' => __('Creation of products: placement of products from 1C marked for deletion to the trash', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('If the product is marked in 1C for deletion, then when the setting is enabled, it will be placed in the trash.', 'wc1c-main'),
__('It is possible to restore the products placed in the basket both manually and using the settings for updating products.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['products_update'] =
[
'title' => __('Update of products', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable product updates on demand from 1C. Disabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<br />%s<br /><hr>%s',
__('Products are updated only if they were found using the product synchronization keys.', 'wc1c-main'),
__('To update, the products parameters from the current configuration are used.', 'wc1c-main'),
__('The option works only with automatic updating of products. When disabled, it is still possible to manually update products through ManualCML and similar extensions.', 'wc1c-main')
),
'default' => 'no'
];
$fields['products_update_use_delete_mark'] =
[
'title' => __('Update of products: restoring from the trash removed from deletion in 1C', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('If the product is not marked in 1C for deletion, and it is in the basket on the site, then when the setting is enabled, it will be returned from the basket and filled with data according to the update settings.', 'wc1c-main'),
__('If the setting is disabled, all products placed in the basket will be there permanently. It will be impossible to create new products of the same kind.', 'wc1c-main')
),
'default' => 'no'
];
$fields['products_update_delete_mark_trash'] =
[
'title' => __('Update of products: placement of products marked for deletion in 1C to the trash', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('If the product is marked in 1C for deletion, then when the setting is enabled, it will be placed in the trash.', 'wc1c-main'),
__('It is possible to restore the products placed in the trash both manually and using the settings for updating products.', 'wc1c-main')
),
'default' => 'yes'
];
$fields['products_update_only_configuration'] =
[
'title' => __('Consider configuration when requesting product updates', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('When updating products data, the update will only occur if the product was created through the current configuration.', 'wc1c-main'),
'default' => 'yes'
];
$fields['products_update_only_schema'] =
[
'title' => __('Consider schema when requesting product updates', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box if you want to enable this feature. Disabled by default.', 'wc1c-main'),
'description' => __('When updating products data, the update will only occur if the product was created through the current schema.', 'wc1c-main'),
'default' => 'yes'
];
return $fields;
}
/**
* Configuration fields: products prices
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsProductsPrices(array $fields): array
{
$fields['title_products_prices'] =
[
'title' => __('Products (goods): prices', 'wc1c-main'),
'type' => 'title',
'description' => __('Comprehensive settings for updating prices.', 'wc1c-main'),
];
$products_prices_by_cml_options =
[
'no' => __('Do not use', 'wc1c-main'),
'yes_primary' => __('From first found', 'wc1c-main'),
'yes_name' => __('From specified name', 'wc1c-main'),
];
$fields['products_prices_regular_by_cml'] =
[
'title' => __('Prices based on CommerceML data: regular', 'wc1c-main'),
'type' => 'select',
'description' => sprintf
(
'%s<hr><b>%s</b> - %s<br /><b>%s</b> - %s<br /><b>%s</b> - %s',
__('The setting works when creating and updating products (goods). The found price after use will not be available for selection as a sale price.', 'wc1c-main'),
__('Do not use', 'wc1c-main'),
__('Populating the regular prices data from CommerceML data will be skipped.', 'wc1c-main'),
__('From first found', 'wc1c-main'),
__('The first available price of all available prices for the product will be used as the regular price.', 'wc1c-main'),
__('From specified name', 'wc1c-main'),
__('The price with the specified name will be used as the regular price. If the price is not found by name, no value will be assigned.', 'wc1c-main')
),
'default' => 'yes_primary',
'options' => $products_prices_by_cml_options
];
$fields['products_prices_regular_by_cml_from_name'] =
[
'title' => __('Prices based on CommerceML data: regular - name in 1C', 'wc1c-main'),
'type' => 'text',
'description' => __('Specify the name of the base price in 1C, which is used for filling to WooCommerce as the base price.', 'wc1c-main'),
'default' => '',
'css' => 'min-width: 370px;',
];
$fields['products_prices_sale_by_cml'] =
[
'title' => __('Prices based on CommerceML data: sale', 'wc1c-main'),
'type' => 'select',
'description' => sprintf
(
'%s<hr><b>%s</b> - %s<br /><b>%s</b> - %s<br /><b>%s</b> - %s',
__('The setting works when creating and updating products (goods). The sale price must be less than the regular price. Otherwise, it simply wont apply.', 'wc1c-main'),
__('Do not use', 'wc1c-main'),
__('Populating the sale prices data from CommerceML data will be skipped.', 'wc1c-main'),
__('From first found', 'wc1c-main'),
__('The first available price of all available prices for the product will be used as the sale price.', 'wc1c-main'),
__('From specified name', 'wc1c-main'),
__('The price with the specified name will be used as the sale price. If the price is not found by name, no value will be assigned.', 'wc1c-main')
),
'default' => 'no',
'options' => $products_prices_by_cml_options
];
$fields['products_prices_sale_by_cml_from_name'] =
[
'title' => __('Prices based on CommerceML data: sale - name in 1C', 'wc1c-main'),
'type' => 'text',
'description' => __('Specify the name of the sale price in 1C, which is used for filling to WooCommerce as the sale price.', 'wc1c-main'),
'default' => '',
'css' => 'min-width: 370px;',
];
return $fields;
}
/**
* Configuration fields: products sku
*
* @param array $fields
*
* @return array
*/
public function configurationsFieldsProductsSku(array $fields): array
{
$fields['title_products_sku'] =
[
'title' => __('Products (goods): SKU', 'wc1c-main'),
'type' => 'title',
'description' => __('Sources and algorithms for filling out products SKU.', 'wc1c-main'),
];
$fields['products_create_adding_sku'] =
[
'title' => __('Filling the SKU of the created product', 'wc1c-main'),
'type' => 'checkbox',
'label' => __('Check the box to enable this feature. Enabled by default.', 'wc1c-main'),
'description' => sprintf
(
'%s<hr>%s',
__('Product SKUs will be filled according to the data from 1C on the selected source for SKUs. It is recommended to enable this feature.', 'wc1c-main'),
__('The setting works when creating products (goods).', 'wc1c-main')
),
'default' => 'yes'
];
$products_update_sku_options =
[
'no' => __('Do not update', 'wc1c-main'),
'yes' => __('Update in any case', 'wc1c-main'),
'add' => __('Add if not on the site and available in 1C', 'wc1c-main'),
'yes_yes' => __('Update if present on the site and in 1C', 'wc1c-main'),
];
$fields['products_update_sku'] =
[
'title' => __('SKU update when products updates', 'wc1c-main'),
'default' => 'no',
'type' => 'select',
'description' => sprintf
(