Product Feed PRO for WooCommerce - Version 10.9.8

Version Description

Replaced usage of site_url with home_url for feed headings

Download this release

Release Info

Developer jorisverwater
Plugin Icon 128x128 Product Feed PRO for WooCommerce
Version 10.9.8
Comparing to
See all releases

Code changes from version 9.3.7 to 10.9.8

TODO.txt CHANGED
@@ -3,20 +3,27 @@ Missing some features you might like? Drop me a line at support@adtribes.io and
3
 
4
  Tutorial / Blog posts:
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
 
6
 
7
  Priority issues:
 
 
 
 
 
 
8
  - License key input field needs to be a password field (asterixes)
 
 
9
  - Add a preview option so only 5-10 products are being generated
10
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
11
  - Google local product feed inventory in XML format (not just TXT like it is now)
12
  - Add support for Multisites
13
  - Add a filter on review score (and amount of reviews)
14
  - Make extra woosea fields available for front-end usage
15
- - Only update feed when changes to products have been made
16
  - Add header to extra fields on product edit pages
17
  - Add possibility to create OR rules
18
  - Add support for Google My Business product feeds
19
- - Build a better WP Cron check, current one is not good enough
20
  - AMAZON integration:
21
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
22
- - only than we can use their MWS service needed to connect our plugin
3
 
4
  Tutorial / Blog posts:
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
+ - product highlight / details article
7
 
8
  Priority issues:
9
+ - Add automotive fields for Facebook feed, see: https://developers.facebook.com/docs/marketing-api/dynamic-ads-auto/auto-catalog/
10
+ - Autosuggest for category mapping broken
11
+ - Add AddToCart event on buttons again
12
+ - Add Vivino EXTRA fields, see: https://vivino.slab.com/public/posts/9gq0o3dg
13
+ - Local product feed - store code should also work with an attribute and not just static values
14
+ - Add Pinterest Tag; https://help.pinterest.com/nl/business/article/install-the-pinterest-tag
15
  - License key input field needs to be a password field (asterixes)
16
+ - Allow adding multiple pictures to Yandex feeds, see:https://wordpress.org/support/topic/yandex-yml-support/#post-14344829
17
+ - A seperate FB pixel per WPML website / language
18
  - Add a preview option so only 5-10 products are being generated
19
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
20
  - Google local product feed inventory in XML format (not just TXT like it is now)
21
  - Add support for Multisites
22
  - Add a filter on review score (and amount of reviews)
23
  - Make extra woosea fields available for front-end usage
 
24
  - Add header to extra fields on product edit pages
25
  - Add possibility to create OR rules
26
  - Add support for Google My Business product feeds
 
27
  - AMAZON integration:
28
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
29
+ - only then we can use their MWS service needed to connect our plugin
classes/channels/class-beslist.php CHANGED
@@ -56,6 +56,36 @@ class WooSEA_beslist {
56
  "feed_name" => "extra_image_3",
57
  "format" => "optional",
58
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  "Category" => array(
60
  "name" => "category",
61
  "feed_name" => "category",
56
  "feed_name" => "extra_image_3",
57
  "format" => "optional",
58
  ),
59
+ "Extra image 4" => array(
60
+ "name" => "extra_image_4",
61
+ "feed_name" => "extra_image_4",
62
+ "format" => "optional",
63
+ ),
64
+ "Extra image 5" => array(
65
+ "name" => "extra_image_5",
66
+ "feed_name" => "extra_image_5",
67
+ "format" => "optional",
68
+ ),
69
+ "Extra image 6" => array(
70
+ "name" => "extra_image_6",
71
+ "feed_name" => "extra_image_6",
72
+ "format" => "optional",
73
+ ),
74
+ "Extra image 7" => array(
75
+ "name" => "extra_image_7",
76
+ "feed_name" => "extra_image_7",
77
+ "format" => "optional",
78
+ ),
79
+ "Extra image 8" => array(
80
+ "name" => "extra_image_8",
81
+ "feed_name" => "extra_image_8",
82
+ "format" => "optional",
83
+ ),
84
+ "Extra image 9" => array(
85
+ "name" => "extra_image_9",
86
+ "feed_name" => "extra_image_9",
87
+ "format" => "optional",
88
+ ),
89
  "Category" => array(
90
  "name" => "category",
91
  "feed_name" => "category",
classes/channels/class-bing_shopping_promotions.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings for Bing Shopping Promotions feeds
4
+ */
5
+ class WooSEA_bing_shopping_promotions {
6
+ public $bing_attributes_promotions;
7
+
8
+ public static function get_channel_attributes() {
9
+ $sitename = get_option('blogname');
10
+
11
+ $bing_attributes_promotions = array(
12
+ "Feed fields" => array(
13
+ "promotion_id" => array(
14
+ "name" => "promotion_id",
15
+ "feed_name" => "promotion_id",
16
+ "format" => "required",
17
+ ),
18
+ "product_applicability" => array(
19
+ "name" => "product_applicability",
20
+ "feed_name" => "product_applicability",
21
+ "format" => "required",
22
+ ),
23
+ "offer_type" => array(
24
+ "name" => "offer_type",
25
+ "feed_name" => "offer_type",
26
+ "format" => "required",
27
+ ),
28
+ "long_title" => array(
29
+ "name" => "long_title",
30
+ "feed_name" => "long_title",
31
+ "format" => "required",
32
+ ),
33
+ "promotion_effective_dates" => array(
34
+ "name" => "promotion_effective_dates",
35
+ "feed_name" => "promotion_effective_dates",
36
+ "format" => "required",
37
+ ),
38
+ "redemption_channel" => array(
39
+ "name" => "redemption_channel",
40
+ "feed_name" => "redemption_channel",
41
+ "format" => "required",
42
+ ),
43
+ "promotional_display_dates" => array(
44
+ "name" => "promotional_display_dates",
45
+ "feed_name" => "promotional_display_dates",
46
+ "format" => "optional",
47
+ ),
48
+ "minimum_purchase_amount" => array(
49
+ "name" => "minimum_purchase_amount",
50
+ "feed_name" => "minimum_purchase_amount",
51
+ "format" => "optional",
52
+ ),
53
+ "generic_redemption_code" => array(
54
+ "name" => "generic_redemption_code",
55
+ "feed_name" => "generic_redemption_code",
56
+ "format" => "optional",
57
+ ),
58
+ ),
59
+ "Structured data attributes" => array(
60
+ "percent_off" => array(
61
+ "name" => "percent_off",
62
+ "feed_name" => "percent_off",
63
+ "format" => "optional",
64
+ ),
65
+ "money_off_amount" => array(
66
+ "name" => "percent_off_amount",
67
+ "feed_name" => "percent_off_amount",
68
+ "format" => "optional",
69
+ ),
70
+ "buy_this_quantity" => array(
71
+ "name" => "buy_this_quantity",
72
+ "feed_name" => "buy_this_quantity",
73
+ "format" => "optional",
74
+ ),
75
+ "get_this_quantity_discounted" => array(
76
+ "name" => "get_this_quantity_discounted",
77
+ "feed_name" => "get_this_quantity_discounted",
78
+ "format" => "optional",
79
+ ),
80
+ "free_shipping" => array(
81
+ "name" => "free_shipping",
82
+ "feed_name" => "free_shipping",
83
+ "format" => "optional",
84
+ ),
85
+ "free_gift_value" => array(
86
+ "name" => "free_gift_value",
87
+ "feed_name" => "free_gift_value",
88
+ "format" => "optional",
89
+ ),
90
+ "free_gift_description" => array(
91
+ "name" => "free_gift_description",
92
+ "feed_name" => "free_gift_description",
93
+ "format" => "optional",
94
+ ),
95
+ "free_gift_item_id" => array(
96
+ "name" => "free_gift_item_id",
97
+ "feed_name" => "free_gift_item_id",
98
+ "format" => "optional",
99
+ ),
100
+ ),
101
+ );
102
+ return $bing_attributes_promotions;
103
+ }
104
+ }
105
+ ?>
classes/channels/class-facebook_drm.php CHANGED
@@ -56,7 +56,7 @@ class WooSEA_facebook_drm {
56
  "name" => "title",
57
  "feed_name" => "g:title",
58
  "format" => "required",
59
- "woo_suggest" => "title",
60
  ),
61
  "price" => array(
62
  "name" => "price",
@@ -79,6 +79,12 @@ class WooSEA_facebook_drm {
79
  "feed_name" => "g:brand",
80
  "format" => "required",
81
  ),
 
 
 
 
 
 
82
  "additional_image_link" => array(
83
  "name" => "additional_image_link",
84
  "feed_name" => "g:additional_image_link",
@@ -116,6 +122,12 @@ class WooSEA_facebook_drm {
116
  "format" => "required",
117
  "woo_suggest" => "categories",
118
  ),
 
 
 
 
 
 
119
  "fb_product_category" => array(
120
  "name" => "fb_product_category",
121
  "feed_name" => "g:fb_product_category",
@@ -271,6 +283,11 @@ class WooSEA_facebook_drm {
271
  "feed_name" => "g:inventory",
272
  "format" => "optional",
273
  ),
 
 
 
 
 
274
  "ingredients" => array(
275
  "name" => "ingredients",
276
  "feed_name" => "g:ingredients",
56
  "name" => "title",
57
  "feed_name" => "g:title",
58
  "format" => "required",
59
+ "woo_suggest" => "mother_title",
60
  ),
61
  "price" => array(
62
  "name" => "price",
79
  "feed_name" => "g:brand",
80
  "format" => "required",
81
  ),
82
+ "identifier exists" => array(
83
+ "name" => "identifier_exists",
84
+ "feed_name" => "g:identifier_exists",
85
+ "woo_suggest" => "calculated",
86
+ "format" => "required",
87
+ ),
88
  "additional_image_link" => array(
89
  "name" => "additional_image_link",
90
  "feed_name" => "g:additional_image_link",
122
  "format" => "required",
123
  "woo_suggest" => "categories",
124
  ),
125
+ "product_type" => array(
126
+ "name" => "product_type",
127
+ "feed_name" => "g:product_type",
128
+ "format" => "required",
129
+ "woo_suggest" => "category_path",
130
+ ),
131
  "fb_product_category" => array(
132
  "name" => "fb_product_category",
133
  "feed_name" => "g:fb_product_category",
283
  "feed_name" => "g:inventory",
284
  "format" => "optional",
285
  ),
286
+ "quantity_to_sell_on_facebook" => array(
287
+ "name" => "quantity_to_sell_on_facebook",
288
+ "feed_name" => "g:quantity_to_sell_on_facebook",
289
+ "format" => "optional",
290
+ ),
291
  "ingredients" => array(
292
  "name" => "ingredients",
293
  "feed_name" => "g:ingredients",
classes/channels/class-google_local_products.php CHANGED
@@ -12,8 +12,8 @@ class WooSEA_google_local_products {
12
  $google_local_products = array(
13
  "Local products fields" => array(
14
  "Itemid" => array(
15
- "name" => "Itemid",
16
- "feed_name" => "g:itemid",
17
  "format" => "required",
18
  "woo_suggest" => "id",
19
  ),
12
  $google_local_products = array(
13
  "Local products fields" => array(
14
  "Itemid" => array(
15
+ "name" => "Id",
16
+ "feed_name" => "g:id",
17
  "format" => "required",
18
  "woo_suggest" => "id",
19
  ),
classes/channels/class-google_shopping.php CHANGED
@@ -132,8 +132,8 @@ class WooSEA_google_shopping {
132
  "Product type" => array(
133
  "name" => "product_type",
134
  "feed_name" => "g:product_type",
135
- "format" => "optional",
136
- "woo_suggest" => "product_type",
137
  ),
138
  ),
139
  "Product identifiers" => array(
@@ -244,11 +244,6 @@ class WooSEA_google_shopping {
244
  ),
245
  ),
246
  "Shopping campaigns" => array(
247
- "Adwords redirect (old)" => array(
248
- "name" => "adwords_redirect",
249
- "feed_name" => "g:adwords_redirect",
250
- "format" => "optional",
251
- ),
252
  "Ads redirect (new)" => array(
253
  "name" => "ads_redirect",
254
  "feed_name" => "g:ads_redirect",
@@ -309,6 +304,21 @@ class WooSEA_google_shopping {
309
  "feed_name" => "g:ads_labels",
310
  "format" => "optional",
311
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  ),
313
  "Shipping" => array(
314
  "Shipping" => array(
@@ -356,6 +366,16 @@ class WooSEA_google_shopping {
356
  "feed_name" => "g:max_handling_time",
357
  "format" => "optional",
358
  ),
 
 
 
 
 
 
 
 
 
 
359
  ),
360
  "Tax" => array(
361
  "Tax" => array(
@@ -425,6 +445,136 @@ class WooSEA_google_shopping {
425
  "feed_name" => "g:google_funded_promotion_eligibility",
426
  "format" => "optional",
427
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  ),
429
  );
430
  return $google_attributes;
132
  "Product type" => array(
133
  "name" => "product_type",
134
  "feed_name" => "g:product_type",
135
+ "format" => "required",
136
+ "woo_suggest" => "raw_categories",
137
  ),
138
  ),
139
  "Product identifiers" => array(
244
  ),
245
  ),
246
  "Shopping campaigns" => array(
 
 
 
 
 
247
  "Ads redirect (new)" => array(
248
  "name" => "ads_redirect",
249
  "feed_name" => "g:ads_redirect",
304
  "feed_name" => "g:ads_labels",
305
  "format" => "optional",
306
  ),
307
+ "Adwords grouping (BING)" => array(
308
+ "name" => "adwords_grouping",
309
+ "feed_name" => "g:adwords_grouping",
310
+ "format" => "optional",
311
+ ),
312
+ "Adwords labels (BING)" => array(
313
+ "name" => "adwords_labels",
314
+ "feed_name" => "g:adwords_labels",
315
+ "format" => "optional",
316
+ ),
317
+ "Adwords redirect (BING)" => array(
318
+ "name" => "adwords_redirect",
319
+ "feed_name" => "g:adwords_redirect",
320
+ "format" => "optional",
321
+ ),
322
  ),
323
  "Shipping" => array(
324
  "Shipping" => array(
366
  "feed_name" => "g:max_handling_time",
367
  "format" => "optional",
368
  ),
369
+ "Ships from country" => array(
370
+ "name" => "ships_from_country",
371
+ "feed_name" => "g:ships_from_country",
372
+ "format" => "optional",
373
+ ),
374
+ "Region Id" => array(
375
+ "name" => "region_id",
376
+ "feed_name" => "g:region_id",
377
+ "format" => "optional",
378
+ ),
379
  ),
380
  "Tax" => array(
381
  "Tax" => array(
445
  "feed_name" => "g:google_funded_promotion_eligibility",
446
  "format" => "optional",
447
  ),
448
+ "Pickup method" => array(
449
+ "name" => "pickup_method",
450
+ "feed_name" => "g:pickup_method",
451
+ "format" => "optional",
452
+ ),
453
+ "Pickup SLA" => array(
454
+ "name" => "pickup_SLA",
455
+ "feed_name" => "g:pickup_SLA",
456
+ "format" => "optional",
457
+ ),
458
+ "Pickup link template" => array(
459
+ "name" => "pickup_link_template",
460
+ "feed_name" => "g:pickup_link_template",
461
+ "format" => "optional",
462
+ ),
463
+ "Store code" => array(
464
+ "name" => "store_code",
465
+ "feed_name" => "g:store_code",
466
+ "format" => "optional",
467
+ ),
468
+ "Mobile pickup link template" => array(
469
+ "name" => "mobile_pickup_link_template",
470
+ "feed_name" => "g:mobile_pickup_link_template",
471
+ "format" => "optional",
472
+ ),
473
+ "Seller name" => array(
474
+ "name" => "seller_name",
475
+ "feed_name" => "g:seller_name",
476
+ "format" => "optional",
477
+ ),
478
+ "Count" => array(
479
+ "name" => "count",
480
+ "feed_name" => "g:count",
481
+ "format" => "optional",
482
+ ),
483
+ "Disclosure date" => array(
484
+ "name" => "disclosure_date",
485
+ "feed_name" => "g:disclosure_date",
486
+ "format" => "optional",
487
+ ),
488
+ "Feature description" => array(
489
+ "name" => "feature_description",
490
+ "feed_name" => "g:feature_description",
491
+ "format" => "optional",
492
+ ),
493
+ "Flavor" => array(
494
+ "name" => "flavor",
495
+ "feed_name" => "g:flavor",
496
+ "format" => "optional",
497
+ ),
498
+ "Scent" => array(
499
+ "name" => "scent",
500
+ "feed_name" => "g:scent",
501
+ "format" => "optional",
502
+ ),
503
+ "Format" => array(
504
+ "name" => "format",
505
+ "feed_name" => "g:format",
506
+ "format" => "optional",
507
+ ),
508
+ "Product line" => array(
509
+ "name" => "product_line",
510
+ "feed_name" => "g:product_line",
511
+ "format" => "optional",
512
+ ),
513
+ "Product name" => array(
514
+ "name" => "product_name",
515
+ "feed_name" => "g:product_name",
516
+ "format" => "optional",
517
+ ),
518
+ "Product page url" => array(
519
+ "name" => "product_page_url",
520
+ "feed_name" => "g:product_page_url",
521
+ "format" => "optional",
522
+ ),
523
+ "Size system" => array(
524
+ "name" => "size_system",
525
+ "feed_name" => "g:size_system",
526
+ "format" => "optional",
527
+ ),
528
+ "Size type" => array(
529
+ "name" => "size_type",
530
+ "feed_name" => "g:size_type",
531
+ "format" => "optional",
532
+ ),
533
+ "Capacity" => array(
534
+ "name" => "capacity",
535
+ "feed_name" => "g:capacity",
536
+ "format" => "optional",
537
+ ),
538
+ "Suggested retail price" => array(
539
+ "name" => "suggested_retail_price",
540
+ "feed_name" => "g:suggested_retail_price",
541
+ "format" => "optional",
542
+ ),
543
+ "Theme" => array(
544
+ "name" => "theme",
545
+ "feed_name" => "g:theme",
546
+ "format" => "optional",
547
+ ),
548
+ "Video link" => array(
549
+ "name" => "video_link",
550
+ "feed_name" => "g:video_link",
551
+ "format" => "optional",
552
+ ),
553
+ "Display ads ID" => array(
554
+ "name" => "display_ads_id",
555
+ "feed_name" => "g:display_ads_id",
556
+ "format" => "optional",
557
+ ),
558
+ "Display ads Similar ID" => array(
559
+ "name" => "display_ads_similar_id",
560
+ "feed_name" => "g:display_ads_similar_id",
561
+ "format" => "optional",
562
+ ),
563
+ "Display ads Title" => array(
564
+ "name" => "display_ads_title",
565
+ "feed_name" => "g:display_ads_title",
566
+ "format" => "optional",
567
+ ),
568
+ "Display ads Link" => array(
569
+ "name" => "display_ads_link",
570
+ "feed_name" => "g:display_ads_link",
571
+ "format" => "optional",
572
+ ),
573
+ "Display ads Value" => array(
574
+ "name" => "display_ads_value",
575
+ "feed_name" => "g:display_ads_value",
576
+ "format" => "optional",
577
+ ),
578
  ),
579
  );
580
  return $google_attributes;
classes/channels/class-idealo.php ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings for Idealo feeds
4
+ */
5
+ class WooSEA_idealo {
6
+ public $idealo;
7
+
8
+ public static function get_channel_attributes() {
9
+
10
+ $sitename = get_option('blogname');
11
+
12
+ $idealo = array(
13
+ "Feed fields" => array(
14
+ "SKU" => array(
15
+ "name" => "SKU",
16
+ "feed_name" => "sku",
17
+ "format" => "required",
18
+ "woo_suggest" => "sku",
19
+ ),
20
+ "Brand" => array(
21
+ "name" => "brand",
22
+ "feed_name" => "brand",
23
+ "format" => "required",
24
+ ),
25
+ "Title" => array(
26
+ "name" => "title",
27
+ "feed_name" => "title",
28
+ "format" => "required",
29
+ "woo_suggest" => "title",
30
+ ),
31
+ "CategoryPath" => array(
32
+ "name" => "categoryPath",
33
+ "feed_name" => "categoryPath",
34
+ "format" => "required",
35
+ "woo_suggest" => "category_path",
36
+ ),
37
+ "url" => array(
38
+ "name" => "url",
39
+ "feed_name" => "url",
40
+ "format" => "required",
41
+ "woo_suggest" => "link",
42
+ ),
43
+ "hans" => array(
44
+ "name" => "hans",
45
+ "feed_name" => "hans",
46
+ "format" => "optional",
47
+ ),
48
+ "Description" => array(
49
+ "name" => "description",
50
+ "feed_name" => "description",
51
+ "format" => "required",
52
+ "woo_suggest" => "description",
53
+ ),
54
+ "ImageUrls" => array(
55
+ "name" => "imageUrls",
56
+ "feed_name" => "imageUrls",
57
+ "format" => "optional",
58
+ "woo_suggest" => "image",
59
+ ),
60
+ "eec" => array(
61
+ "name" => "eec",
62
+ "feed_name" => "eec",
63
+ "format" => "optional",
64
+ ),
65
+ "merchantName" => array(
66
+ "name" => "merchantName",
67
+ "feed_name" => "merchantName",
68
+ "format" => "optional",
69
+ ),
70
+ "merchantId" => array(
71
+ "name" => "merchantId",
72
+ "feed_name" => "merchanId",
73
+ "format" => "optional",
74
+ ),
75
+ "price" => array(
76
+ "name" => "price",
77
+ "feed_name" => "price",
78
+ "format" => "required",
79
+ "woo_suggest" => "price",
80
+ ),
81
+ "basePrice" => array(
82
+ "name" => "basePrice",
83
+ "feed_name" => "basePrice",
84
+ "format" => "optional",
85
+ ),
86
+ "formerPrice" => array(
87
+ "name" => "formerPrice",
88
+ "feed_name" => "formerPrice",
89
+ "format" => "optional",
90
+ ),
91
+ "voucherCode" => array(
92
+ "name" => "voucherCode",
93
+ "feed_name" => "voucherCode",
94
+ "format" => "optional",
95
+ ),
96
+ "deposit" => array(
97
+ "name" => "deposit",
98
+ "feed_name" => "deposit",
99
+ "format" => "optional",
100
+ ),
101
+ "deliveryTime" => array(
102
+ "name" => "deliveryTime",
103
+ "feed_name" => "deliveryTime",
104
+ "format" => "optional",
105
+ ),
106
+ "deliveryComment" => array(
107
+ "name" => "deliveryComment",
108
+ "feed_name" => "deliveryComment",
109
+ "format" => "optional",
110
+ ),
111
+ "maxOrderProcessingTime" => array(
112
+ "name" => "maxOrderProcessingTime",
113
+ "feed_name" => "maxOrderProcessingTime",
114
+ "format" => "optional",
115
+ ),
116
+ "freeReturnDays" => array(
117
+ "name" => "freeReturnDays",
118
+ "feed_name" => "freeReturnDays",
119
+ "format" => "optional",
120
+ ),
121
+ "checkout" => array(
122
+ "name" => "checkout",
123
+ "feed_name" => "checkout",
124
+ "format" => "required",
125
+ ),
126
+ "minimumPrice" => array(
127
+ "name" => "minimumPrice",
128
+ "feed_name" => "minimumPrice",
129
+ "format" => "required",
130
+ ),
131
+ "fullfillmentType" => array(
132
+ "name" => "fulfillmentType",
133
+ "feed_name" => "fulfillmentType",
134
+ "format" => "required",
135
+ ),
136
+ "checkoutLimitPerPeriod" => array(
137
+ "name" => "checkoutLimitPerPeriod",
138
+ "feed_name" => "checkoutLimitPerPeriod",
139
+ "format" => "required",
140
+ ),
141
+ "quantityPerOrder" => array(
142
+ "name" => "quantityPerOrder",
143
+ "feed_name" => "quantityPerOrder",
144
+ "format" => "optional",
145
+ ),
146
+ "twoManHandlingFee" => array(
147
+ "name" => "twoManHandlingFee",
148
+ "feed_name" => "twoManHandlingFee",
149
+ "format" => "optional",
150
+ ),
151
+ "disposalFee" => array(
152
+ "name" => "disposalFee",
153
+ "feed_name" => "disposalFee",
154
+ "format" => "optional",
155
+ ),
156
+ "eans" => array(
157
+ "name" => "eans",
158
+ "feed_name" => "eans",
159
+ "format" => "required",
160
+ ),
161
+ "packagingUnit" => array(
162
+ "name" => "packagingUnit",
163
+ "feed_name" => "packagingUnit",
164
+ "format" => "optional",
165
+ ),
166
+ "deliveryCost_ups" => array(
167
+ "name" => "deliveryCost_ups",
168
+ "feed_name" => "deliveryCost_ups",
169
+ "format" => "optional",
170
+ ),
171
+ "deliveryCost_fedex" => array(
172
+ "name" => "deliveryCost_fedex",
173
+ "feed_name" => "deliveryCost_fedex",
174
+ "format" => "optional",
175
+ ),
176
+ "deliveryCost_deutsche_post" => array(
177
+ "name" => "deliveryCost_deutsche_post",
178
+ "feed_name" => "deliveryCost_deutsche_post",
179
+ "format" => "optional",
180
+ ),
181
+ "deliveryCost_dhl" => array(
182
+ "name" => "deliveryCost_dhl",
183
+ "feed_name" => "deliveryCost_dhl",
184
+ "format" => "optional",
185
+ ),
186
+ "deliveryCost_dhl_go_green" => array(
187
+ "name" => "deliveryCost_dhl_go_green",
188
+ "feed_name" => "deliveryCost_dhl_go_green",
189
+ "format" => "optional",
190
+ ),
191
+ "deliveryCost_download" => array(
192
+ "name" => "deliveryCost_download",
193
+ "feed_name" => "deliveryCost_download",
194
+ "format" => "optional",
195
+ ),
196
+ "deliveryCost_dpd" => array(
197
+ "name" => "deliveryCost_dpd",
198
+ "feed_name" => "deliveryCost_dpd",
199
+ "format" => "optional",
200
+ ),
201
+ "deliveryCost_german_express_logistics" => array(
202
+ "name" => "deliveryCost_german_express_logistics",
203
+ "feed_name" => "deliveryCost_german_express_logistics",
204
+ "format" => "optional",
205
+ ),
206
+ "deliveryCost_gls" => array(
207
+ "name" => "deliveryCost_gls",
208
+ "feed_name" => "deliveryCost_gls",
209
+ "format" => "optional",
210
+ ),
211
+ "deliveryCost_gls_think_green" => array(
212
+ "name" => "deliveryCost_gls_think_green",
213
+ "feed_name" => "deliveryCost_gls_think_green",
214
+ "format" => "optional",
215
+ ),
216
+ "deliveryCost_hermes" => array(
217
+ "name" => "deliveryCost_hermes",
218
+ "feed_name" => "deliveryCost_hermes",
219
+ "format" => "optional",
220
+ ),
221
+ "deliveryCost_pick_point" => array(
222
+ "name" => "deliveryCost_pick_points",
223
+ "feed_name" => "deliveryCost_pick_point",
224
+ "format" => "optional",
225
+ ),
226
+ "deliveryCost_spedition" => array(
227
+ "name" => "deliveryCost_spedition",
228
+ "feed_name" => "deliveryCost_spedition",
229
+ "format" => "optional",
230
+ ),
231
+ "deliveryCost_tnt" => array(
232
+ "name" => "deliveryCost_tnt",
233
+ "feed_name" => "deliveryCost_tnt",
234
+ "format" => "optional",
235
+ ),
236
+ "deliveryCost_trans_o_flex" => array(
237
+ "name" => "deliveryCost_trans_o_flex",
238
+ "feed_name" => "deliveryCost_trand_o_flex",
239
+ "format" => "optional",
240
+ ),
241
+ "paymentCosts_credit_card" => array(
242
+ "name" => "paymentCosts_credit_card",
243
+ "feed_name" => "paymentCosts_credit_card",
244
+ "format" => "optional",
245
+ ),
246
+ "paymentCosts_cash_in_advance" => array(
247
+ "name" => "paymentCosts_cash_in_advance",
248
+ "feed_name" => "paymentCosts_cash_in_advance",
249
+ "format" => "optional",
250
+ ),
251
+ "paymentCosts_cash_on_delivery" => array(
252
+ "name" => "paymentCosts_cash_on_delivery",
253
+ "feed_name" => "paymentCosts_cash_on_delivery",
254
+ "format" => "optional",
255
+ ),
256
+ "paymentCosts_paypal" => array(
257
+ "name" => "paymentCosts_paypal",
258
+ "feed_name" => "paymentCosts_paypal",
259
+ "format" => "optional",
260
+ ),
261
+ "paymentCosts_giropay" => array(
262
+ "name" => "paymentCosts_giropay",
263
+ "feed_name" => "paymentCosts_giropay",
264
+ "format" => "optional",
265
+ ),
266
+ "paymentCosts_direct_debit" => array(
267
+ "name" => "paymentCosts_direct_debit",
268
+ "feed_name" => "paymentCosts_direct_debit",
269
+ "format" => "optional",
270
+ ),
271
+ "paymentCosts_google_checkout" => array(
272
+ "name" => "paymentCosts_google_checkout",
273
+ "feed_name" => "paymentCosts_google_checkout",
274
+ "format" => "optional",
275
+ ),
276
+ "paymentCosts_invoice" => array(
277
+ "name" => "paymentCosts_invoice",
278
+ "feed_name" => "paymentCosts_invoice",
279
+ "format" => "optional",
280
+ ),
281
+ "paymentCosts_postal_order" => array(
282
+ "name" => "paymentCosts_postal_order",
283
+ "feed_name" => "paymentCosts_postal_order",
284
+ "format" => "optional",
285
+ ),
286
+ "paymentCosts_paysafecard" => array(
287
+ "name" => "paymentCosts_paysafecard",
288
+ "feed_name" => "paymentCosts_paysafecard",
289
+ "format" => "optional",
290
+ ),
291
+ "paymentCosts_sofortueberweisung" => array(
292
+ "name" => "paymentCosts_sofortueberweisung",
293
+ "feed_name" => "paymentCosts_sofortueberweisung",
294
+ "format" => "optional",
295
+ ),
296
+ "paymentCosts_amazon_payment" => array(
297
+ "name" => "paymentCosts_amazon_payment",
298
+ "feed_name" => "paymentCosts_amazon_payment",
299
+ "format" => "optional",
300
+ ),
301
+ "paymentCosts_electronical_payment_standard" => array(
302
+ "name" => "paymentCosts_electronical_payment_standard",
303
+ "feed_name" => "paymentCosts_electronical_payment_standard",
304
+ "format" => "optional",
305
+ ),
306
+ "paymentCosts_ecotax" => array(
307
+ "name" => "paymentCosts_ecotax",
308
+ "feed_name" => "paymentCosts_ecotax",
309
+ "format" => "optional",
310
+ ),
311
+ "used" => array(
312
+ "name" => "used",
313
+ "feed_name" => "used",
314
+ "format" => "optional",
315
+ ),
316
+ "download" => array(
317
+ "name" => "download",
318
+ "feed_name" => "download",
319
+ "format" => "optional",
320
+ ),
321
+ "replica" => array(
322
+ "name" => "replica",
323
+ "feed_name" => "replica",
324
+ "format" => "optional",
325
+ ),
326
+ "size" => array(
327
+ "name" => "size",
328
+ "feed_name" => "size",
329
+ "format" => "optional",
330
+ ),
331
+ "colour" => array(
332
+ "name" => "colour",
333
+ "feed_name" => "colour",
334
+ "format" => "optional",
335
+ ),
336
+ "gender" => array(
337
+ "name" => "gender",
338
+ "feed_name" => "gender",
339
+ "format" => "optional",
340
+ ),
341
+ "material" => array(
342
+ "name" => "material",
343
+ "feed_name" => "material",
344
+ "format" => "optional",
345
+ ),
346
+ "oens" => array(
347
+ "name" => "oens",
348
+ "feed_name" => "oens",
349
+ "format" => "optional",
350
+ ),
351
+ "kbas" => array(
352
+ "name" => "kbas",
353
+ "feed_name" => "kbas",
354
+ "format" => "optional",
355
+ ),
356
+ "diopter" => array(
357
+ "name" => "diopter",
358
+ "feed_name" => "diopter",
359
+ "format" => "optional",
360
+ ),
361
+ "baseCurve" => array(
362
+ "name" => "baseCurve",
363
+ "feed_name" => "baseCurve",
364
+ "format" => "optional",
365
+ ),
366
+ "diameter" => array(
367
+ "name" => "diameter",
368
+ "feed_name" => "diameter",
369
+ "format" => "optional",
370
+ ),
371
+ "cylinder" => array(
372
+ "name" => "cylinder",
373
+ "feed_name" => "cylinder",
374
+ "format" => "optional",
375
+ ),
376
+ "axis" => array(
377
+ "name" => "axis",
378
+ "feed_name" => "axis",
379
+ "format" => "optional",
380
+ ),
381
+ "addition" => array(
382
+ "name" => "addition",
383
+ "feed_name" => "addition",
384
+ "format" => "optional",
385
+ ),
386
+ "pzns" => array(
387
+ "name" => "pzns",
388
+ "feed_name" => "pzns",
389
+ "format" => "optional",
390
+ ),
391
+ "quantity" => array(
392
+ "name" => "quantity",
393
+ "feed_name" => "quantity",
394
+ "format" => "optional",
395
+ ),
396
+ "fuelEfficiency" => array(
397
+ "name" => "fuelEfficiency",
398
+ "feed_name" => "fuelEfficiency",
399
+ "format" => "optional",
400
+ ),
401
+ "wetGrip" => array(
402
+ "name" => "wetGrip",
403
+ "feed_name" => "wetGrip",
404
+ "format" => "optional",
405
+ ),
406
+ "externalRollingNoise" => array(
407
+ "name" => "externalRollingNoise",
408
+ "feed_name" => "externalRollingNoise",
409
+ "format" => "optional",
410
+ ),
411
+ "rollingNoiseClass" => array(
412
+ "name" => "rollingNoiseClass",
413
+ "feed_name" => "rollingNoiseClass",
414
+ "format" => "optional",
415
+ ),
416
+ "alcoholicContent" => array(
417
+ "name" => "alcoholicContent",
418
+ "feed_name" => "alcoholicConent",
419
+ "format" => "optional",
420
+ ),
421
+ "allergenInformation" => array(
422
+ "name" => "allergenInformation",
423
+ "feed_name" => "allergenInformation",
424
+ "format" => "optional",
425
+ ),
426
+ "countryOfOrigin" => array(
427
+ "name" => "countryOfOrigin",
428
+ "feed_name" => "countryOfOrigin",
429
+ "format" => "optional",
430
+ ),
431
+ "bottler" => array(
432
+ "name" => "bottler",
433
+ "feed_name" => "bottler",
434
+ "format" => "optional",
435
+ ),
436
+ "importer" => array(
437
+ "name" => "importer",
438
+ "feed_name" => "importer",
439
+ "format" => "optional",
440
+ ),
441
+ ),
442
+ );
443
+ return $idealo;
444
+ }
445
+ }
446
+ ?>
classes/channels/class-vivino.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings for Vivino feeds
4
+ */
5
+ class WooSEA_vivino {
6
+ public $vivino;
7
+
8
+ public static function get_channel_attributes() {
9
+
10
+ $sitename = get_option('blogname');
11
+
12
+ $vivino = array(
13
+ "Feed fields" => array(
14
+ "Product ID" => array(
15
+ "name" => "product-id",
16
+ "feed_name" => "product-id",
17
+ "format" => "required",
18
+ "woo_suggest" => "id"
19
+ ),
20
+ "Product Name" => array(
21
+ "name" => "product-name",
22
+ "feed_name" => "product-name",
23
+ "format" => "required",
24
+ "woo_suggest" => "title",
25
+ ),
26
+ "Price" => array(
27
+ "name" => "price",
28
+ "feed_name" => "price",
29
+ "format" => "required",
30
+ "woo_suggest" => "vivino_price",
31
+ ),
32
+ "Bottle Size" => array(
33
+ "name" => "bottle_size",
34
+ "feed_name" => "bottle_size",
35
+ "format" => "required",
36
+ ),
37
+ "Bottle Quantity" => array(
38
+ "name" => "bottle_quantity",
39
+ "feed_name" => "bottle_quantity",
40
+ "format" => "required",
41
+ ),
42
+ "Inventory Count" => array(
43
+ "name" => "inventory_count",
44
+ "feed_name" => "inventory_count",
45
+ "format" => "required",
46
+ "woo_suggest" => "quantity",
47
+ ),
48
+ "Quantity is minimum" => array(
49
+ "name" => "quantity-is-minimum",
50
+ "feed_name" => "quantity-is-minimum",
51
+ "format" => "required",
52
+ ),
53
+ "Link" => array(
54
+ "name" => "link",
55
+ "feed_name" => "link",
56
+ "format" => "required",
57
+ "woo_suggest" => "link",
58
+ ),
59
+ "Image" => array(
60
+ "name" => "image",
61
+ "feed_name" => "image",
62
+ "format" => "required",
63
+ "woo_suggest" => "image",
64
+ ),
65
+ "Producer" => array(
66
+ "name" => "producer",
67
+ "feed_name" => "producer",
68
+ "format" => "optional",
69
+ ),
70
+ "Wine Name" => array(
71
+ "name" => "wine-name",
72
+ "feed_name" => "wine-name",
73
+ "format" => "optional",
74
+ ),
75
+ "Appellation" => array(
76
+ "name" => "appellation",
77
+ "feed_name" => "appellation",
78
+ "format" => "optional",
79
+ ),
80
+ "Vintage" => array(
81
+ "name" => "vintage",
82
+ "feed_name" => "vintage",
83
+ "format" => "optional",
84
+ ),
85
+ "Country" => array(
86
+ "name" => "country",
87
+ "feed_name" => "country",
88
+ "format" => "optional",
89
+ ),
90
+ "Color" => array(
91
+ "name" => "color",
92
+ "feed_name" => "color",
93
+ "format" => "optional",
94
+ ),
95
+ "EAN" => array(
96
+ "name" => "ean",
97
+ "feed_name" => "ean",
98
+ "format" => "optional",
99
+ ),
100
+ "UPC" => array(
101
+ "name" => "upc",
102
+ "feed_name" => "upc",
103
+ "format" => "optional",
104
+ ),
105
+ "JAN" => array(
106
+ "name" => "jan",
107
+ "feed_name" => "jan",
108
+ "format" => "optional",
109
+ ),
110
+ "Description" => array(
111
+ "name" => "description",
112
+ "feed_name" => "description",
113
+ "format" => "optional",
114
+ ),
115
+ "Alcohol" => array(
116
+ "name" => "alcohol",
117
+ "feed_name" => "alcohol",
118
+ "format" => "optional",
119
+ ),
120
+ "Producer Address" => array(
121
+ "name" => "producer-address",
122
+ "feed_name" => "producer-address",
123
+ "format" => "optional",
124
+ ),
125
+ "Importer Address" => array(
126
+ "name" => "importer-address",
127
+ "feed_name" => "importer-address",
128
+ "format" => "optional",
129
+ ),
130
+ "Varietal" => array(
131
+ "name" => "varietal",
132
+ "feed_name" => "varietal",
133
+ "format" => "optional",
134
+ ),
135
+ "Ageing" => array(
136
+ "name" => "ageing",
137
+ "feed_name" => "ageing",
138
+ "format" => "optional",
139
+ ),
140
+ "Closure" => array(
141
+ "name" => "closure",
142
+ "feed_name" => "closure",
143
+ "format" => "optional",
144
+ ),
145
+ "Production Size Unit" => array(
146
+ "name" => "production-size",
147
+ "feed_name" => "production-size",
148
+ "format" => "optional",
149
+ ),
150
+ "Residual Sugar Unit" => array(
151
+ "name" => "residual-sugar",
152
+ "feed_name" => "residual-sugar",
153
+ "format" => "optional",
154
+ ),
155
+ "Acidity Unit" => array(
156
+ "name" => "acidity",
157
+ "feed_name" => "acidity",
158
+ "format" => "optional",
159
+ ),
160
+ "Ph" => array(
161
+ "name" => "ph",
162
+ "feed_name" => "ph",
163
+ "format" => "optional",
164
+ ),
165
+ "Winemaker" => array(
166
+ "name" => "winemaker",
167
+ "feed_name" => "winemaker",
168
+ "format" => "optional",
169
+ ),
170
+ "Contains Milk Allergens" => array(
171
+ "name" => "contains-milk-allergens",
172
+ "feed_name" => "contains-milk-allergens",
173
+ "format" => "optional",
174
+ ),
175
+ "Contains Egg Allergens" => array(
176
+ "name" => "contains-egg-allergens",
177
+ "feed_name" => "contains-egg-allergens",
178
+ "format" => "optional",
179
+ ),
180
+ "Non Alcoholic" => array(
181
+ "name" => "non-alcoholic",
182
+ "feed_name" => "non-alcoholic",
183
+ "format" => "optional",
184
+ ),
185
+ ),
186
+ );
187
+ return $vivino;
188
+ }
189
+ }
190
+ ?>
classes/class-activate.php CHANGED
@@ -64,7 +64,14 @@ class WooSEA_Activation {
64
  "fields" => "google_shopping",
65
  "taxonomy" => "google_shopping",
66
  "utm_source" => "Bing Shopping",
67
- "type" => "Advertising" ),
 
 
 
 
 
 
 
68
  "Facebook Catalog Feed / Instagram" => array (
69
  "channel_hash" => md5("Facebook Remarketing"),
70
  "name" => "Facebook Catalog Feed / Instagram",
@@ -90,9 +97,23 @@ class WooSEA_Activation {
90
  "channel_hash" => md5("Snapchat Product Catalog"),
91
  "name" => "Snapchat Product Catalog",
92
  "fields" => "snapchat",
93
- "taxonomy" => "none",
94
  "utm_source" => "snapchat",
95
- "type" => "Advertising" ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  ),
97
  "Custom Feed" => array (
98
  "Custom Feed" => array (
@@ -432,8 +453,8 @@ class WooSEA_Activation {
432
  "Prisjakt" => array (
433
  "channel_hash" => md5("Prisjakt"),
434
  "name" => "Prisjakt",
435
- "fields" => "customfeed",
436
- "taxonomy" => "none",
437
  "utm_source" => "Prisjakt",
438
  "type" => "Comparison shopping engine" ),
439
  "Hintaseuranta" => array (
@@ -529,7 +550,14 @@ class WooSEA_Activation {
529
  "taxonomy" => "none",
530
  "utm_source" => "LeGuide.fr",
531
  "type" => "Comparison shopping engine" ),
532
- "Priceminister.fr" => array (
 
 
 
 
 
 
 
533
  "channel_hash" => md5("Priceminister.fr"),
534
  "name" => "Priceminister.fr",
535
  "fields" => "customfeed",
@@ -600,6 +628,7 @@ class WooSEA_Activation {
600
  "utm_source" => "Webmarchand.com",
601
  "type" => "Comparison shopping engine" ),
602
  ),
 
603
  "Gabon" => array (),
604
  "Gambia" => array (),
605
  "Georgia" => array (),
@@ -625,7 +654,14 @@ class WooSEA_Activation {
625
  "taxonomy" => "none",
626
  "utm_source" => "AdRoll.de",
627
  "type" => "Advertising" ),
628
- "Smartly.io" => array (
 
 
 
 
 
 
 
629
  "channel_hash" => md5("Smartly.io"),
630
  "name" => "Smartly.io",
631
  "fields" => "customfeed",
@@ -740,7 +776,7 @@ class WooSEA_Activation {
740
  "Idealo.de" => array (
741
  "channel_hash" => md5("Idealo.de"),
742
  "name" => "Idealo.de",
743
- "fields" => "customfeed",
744
  "taxonomy" => "none",
745
  "utm_source" => "Idealo.de",
746
  "type" => "Comparison shopping engine" ),
@@ -772,6 +808,13 @@ class WooSEA_Activation {
772
  "taxonomy" => "none",
773
  "utm_source" => "Medizinfuchs.de",
774
  "type" => "Comparison shopping engine" ),
 
 
 
 
 
 
 
775
  "Moebel.de" => array (
776
  "channel_hash" => md5("Moebel.de"),
777
  "name" => "Moebel.de",
@@ -910,6 +953,7 @@ class WooSEA_Activation {
910
  "type" => "Comparison shopping engine" ),
911
  ),
912
  "Grenada" => array (),
 
913
  "Guatemala" => array (),
914
  "Guinea" => array (),
915
  "Guinea-Bissau" => array (),
@@ -1060,6 +1104,7 @@ class WooSEA_Activation {
1060
  "Mali" => array (),
1061
  "Malta" => array (),
1062
  "Marshall Islands" => array (),
 
1063
  "Mauritania" => array (),
1064
  "Mauritius" => array (),
1065
  "Mexico" => array (
@@ -1112,6 +1157,13 @@ class WooSEA_Activation {
1112
  "taxonomy" => "none",
1113
  "utm_source" => "Tweakers.nl",
1114
  "type" => "Comparison shopping engine" ),
 
 
 
 
 
 
 
1115
  "Fashionchick.nl" => array (
1116
  "channel_hash" => md5("Fashionchick.nl"),
1117
  "name" => "Fashionchick.nl",
@@ -1226,8 +1278,8 @@ class WooSEA_Activation {
1226
  "Prisjakt" => array (
1227
  "channel_hash" => md5("Prisjakt.no"),
1228
  "name" => "Prisjakt.no",
1229
- "fields" => "customfeed",
1230
- "taxonomy" => "none",
1231
  "utm_source" => "Prisjakt.no",
1232
  "type" => "Comparison shopping engine" ),
1233
  ),
@@ -1300,7 +1352,8 @@ class WooSEA_Activation {
1300
  "type" => "Comparison shopping engine" ),
1301
  ),
1302
  "Qatar" => array (),
1303
- "Romania" => array (
 
1304
  "Okazzi" => array (
1305
  "channel_hash" => md5("Okazzi.ro"),
1306
  "name" => "Okazzi.ro",
@@ -1321,8 +1374,7 @@ class WooSEA_Activation {
1321
  "fields" => "compari_ro",
1322
  "taxonomy" => "none",
1323
  "utm_source" => "Compari.ro",
1324
- "type" => "Comparison shopping engine" ),
1325
-
1326
  ),
1327
  "Russian Federation" => array (
1328
  "Yandex" => array (
@@ -1455,8 +1507,8 @@ class WooSEA_Activation {
1455
  "Prisjakt" => array (
1456
  "channel_hash" => md5("Prisjakt.se"),
1457
  "name" => "Prisjakt.se",
1458
- "fields" => "customfeed",
1459
- "taxonomy" => "none",
1460
  "utm_source" => "Pricerunner.se",
1461
  "type" => "Comparison shopping engine" ),
1462
  ),
64
  "fields" => "google_shopping",
65
  "taxonomy" => "google_shopping",
66
  "utm_source" => "Bing Shopping",
67
+ "type" => "Advertising" ),
68
+ "Bing Shopping Promotions" => array (
69
+ "channel_hash" => md5("Bing Shopping Promotions"),
70
+ "name" => "Bing Shopping Promotions",
71
+ "fields" => "google_shopping_promotions",
72
+ "taxonomy" => "google_shopping_promotions",
73
+ "utm_source" => "Bing Shopping Promotions",
74
+ "type" => "Advertising" ),
75
  "Facebook Catalog Feed / Instagram" => array (
76
  "channel_hash" => md5("Facebook Remarketing"),
77
  "name" => "Facebook Catalog Feed / Instagram",
97
  "channel_hash" => md5("Snapchat Product Catalog"),
98
  "name" => "Snapchat Product Catalog",
99
  "fields" => "snapchat",
100
+ "taxonomy" => "google_shopping",
101
  "utm_source" => "snapchat",
102
+ "type" => "Advertising" ),
103
+ "TikTok Product Catalog" => array (
104
+ "channel_hash" => md5("TikTok Product Catalog"),
105
+ "name" => "TikTok Product Catalog",
106
+ "fields" => "tiktok",
107
+ "taxonomy" => "google_shopping",
108
+ "utm_source" => "tiktok",
109
+ "type" => "Advertising" ),
110
+ "Vivino" => array (
111
+ "channel_hash" => md5("Vivino"),
112
+ "name" => "Vivino",
113
+ "fields" => "vivino",
114
+ "taxonomy" => "none",
115
+ "utm_source" => "Vivino",
116
+ "type" => "Advertising" ),
117
  ),
118
  "Custom Feed" => array (
119
  "Custom Feed" => array (
453
  "Prisjakt" => array (
454
  "channel_hash" => md5("Prisjakt"),
455
  "name" => "Prisjakt",
456
+ "fields" => "google_shopping",
457
+ "taxonomy" => "google_shopping",
458
  "utm_source" => "Prisjakt",
459
  "type" => "Comparison shopping engine" ),
460
  "Hintaseuranta" => array (
550
  "taxonomy" => "none",
551
  "utm_source" => "LeGuide.fr",
552
  "type" => "Comparison shopping engine" ),
553
+ "Miinto" => array (
554
+ "channel_hash" => md5("Miinto.fr"),
555
+ "name" => "Miinto.fr",
556
+ "fields" => "miinto_fr",
557
+ "taxonomy" => "none",
558
+ "utm_source" => "Miinto.fr",
559
+ "type" => "Comparison shopping engine" ),
560
+ "Priceminister.fr" => array (
561
  "channel_hash" => md5("Priceminister.fr"),
562
  "name" => "Priceminister.fr",
563
  "fields" => "customfeed",
628
  "utm_source" => "Webmarchand.com",
629
  "type" => "Comparison shopping engine" ),
630
  ),
631
+ "French Guiana" => array (),
632
  "Gabon" => array (),
633
  "Gambia" => array (),
634
  "Georgia" => array (),
654
  "taxonomy" => "none",
655
  "utm_source" => "AdRoll.de",
656
  "type" => "Advertising" ),
657
+ "ElCheapo.de" => array (
658
+ "channel_hash" => md5("ElCheapo.de"),
659
+ "name" => "ElCheapo.de",
660
+ "fields" => "vergelijknl",
661
+ "taxonomy" => "none",
662
+ "utm_source" => "ElCheapo.de",
663
+ "type" => "Comparison shopping engine" ),
664
+ "Smartly.io" => array (
665
  "channel_hash" => md5("Smartly.io"),
666
  "name" => "Smartly.io",
667
  "fields" => "customfeed",
776
  "Idealo.de" => array (
777
  "channel_hash" => md5("Idealo.de"),
778
  "name" => "Idealo.de",
779
+ "fields" => "idealo",
780
  "taxonomy" => "none",
781
  "utm_source" => "Idealo.de",
782
  "type" => "Comparison shopping engine" ),
808
  "taxonomy" => "none",
809
  "utm_source" => "Medizinfuchs.de",
810
  "type" => "Comparison shopping engine" ),
811
+ "Miinto.de" => array (
812
+ "channel_hash" => md5("Miinto.de"),
813
+ "name" => "Miinto.de",
814
+ "fields" => "miinto_de",
815
+ "taxonomy" => "none",
816
+ "utm_source" => "Miinto.de",
817
+ "type" => "Comparison shopping engine" ),
818
  "Moebel.de" => array (
819
  "channel_hash" => md5("Moebel.de"),
820
  "name" => "Moebel.de",
953
  "type" => "Comparison shopping engine" ),
954
  ),
955
  "Grenada" => array (),
956
+ "Guadeloupe" => array (),
957
  "Guatemala" => array (),
958
  "Guinea" => array (),
959
  "Guinea-Bissau" => array (),
1104
  "Mali" => array (),
1105
  "Malta" => array (),
1106
  "Marshall Islands" => array (),
1107
+ "Martinique" => array (),
1108
  "Mauritania" => array (),
1109
  "Mauritius" => array (),
1110
  "Mexico" => array (
1157
  "taxonomy" => "none",
1158
  "utm_source" => "Tweakers.nl",
1159
  "type" => "Comparison shopping engine" ),
1160
+ "Boetiek.nl" => array (
1161
+ "channel_hash" => md5("Boetiek.nl"),
1162
+ "name" => "Boetiek.nl",
1163
+ "fields" => "boetiek",
1164
+ "taxonomy" => "none",
1165
+ "utm_source" => "Boetiek.nl",
1166
+ "type" => "Comparison shopping engine" ),
1167
  "Fashionchick.nl" => array (
1168
  "channel_hash" => md5("Fashionchick.nl"),
1169
  "name" => "Fashionchick.nl",
1278
  "Prisjakt" => array (
1279
  "channel_hash" => md5("Prisjakt.no"),
1280
  "name" => "Prisjakt.no",
1281
+ "fields" => "google_shopping",
1282
+ "taxonomy" => "google_shopping",
1283
  "utm_source" => "Prisjakt.no",
1284
  "type" => "Comparison shopping engine" ),
1285
  ),
1352
  "type" => "Comparison shopping engine" ),
1353
  ),
1354
  "Qatar" => array (),
1355
+ "Reunion" => array (),
1356
+ "Romania" => array (
1357
  "Okazzi" => array (
1358
  "channel_hash" => md5("Okazzi.ro"),
1359
  "name" => "Okazzi.ro",
1374
  "fields" => "compari_ro",
1375
  "taxonomy" => "none",
1376
  "utm_source" => "Compari.ro",
1377
+ "type" => "Comparison shopping engine" ),
 
1378
  ),
1379
  "Russian Federation" => array (
1380
  "Yandex" => array (
1507
  "Prisjakt" => array (
1508
  "channel_hash" => md5("Prisjakt.se"),
1509
  "name" => "Prisjakt.se",
1510
+ "fields" => "google_shopping",
1511
+ "taxonomy" => "google_shopping",
1512
  "utm_source" => "Pricerunner.se",
1513
  "type" => "Comparison shopping engine" ),
1514
  ),
classes/class-admin-notifications.php CHANGED
@@ -54,67 +54,67 @@ class WooSEA_Get_Admin_Notifications {
54
 
55
  switch($step){
56
  case 0:
57
- $message = __( 'Please select the country and channel for which you would like to create a new product feed. The channel drop-down will populate with relevant country channels once you selected a country. Filling in a project name is mandatory.','woosea' );
58
  $message_type = "notice notice-info";
59
  break;
60
  case 1:
61
- $message = __( 'Map your products or categories to the categories of your selected channel. For some channels adding their categorisation in the product feed is mandatory. Even when category mappings are not mandatory it is likely your products will get better visibility and higher conversions when mappings have been added.','woosea' );
62
  $message_type = "notice notice-info";
63
  break;
64
  case 2:
65
- $message = __( 'Please drag and drop the attributes you want to be in your product feed from left to right.','woosea' );
66
  $message_type = "notice notice-info is-dismissible";
67
  break;
68
  case 3:
69
- $message = __( 'Mapping your product categories to the channel categories will increase changes of getting all your products listed correctly, thus increase your conversion rates.','woosea' );
70
  $message_type = "notice notice-info is-dismissible";
71
  break;
72
  case 4:
73
- $message = __( 'Create filter and rules so exactly the right products end up in your product feed. These filters and rules are only eligable for the current product feed you are configuring and will not be used for other feeds.<br/><br/><strong>Filters:</strong> Exclude or include products that meet certain conditions. [<strong><i><a href="https://adtribes.io/how-to-create-filters-for-your-product-feed/" target="_blank">Detailed information and filter examples</a></i></strong>] or [<strong><i><a href="https://adtribes.io/create-a-product-feed-for-one-specific-category/" target="_blank">Create a product feed for just 1 category</a></i></strong>]<br/><strong>Rules:</strong> Change attribute values based on other attribute values or conditions.[<strong><i><a href="https://adtribes.io/how-to-create-rules/" target="_blank">Detailed information about rules and some examples</a></i></strong>]<br/><br/>Order of execution: the filters and rules will be executed in the order of creation.','woosea' );
74
  $message_type = "notice notice-info";
75
  break;
76
  case 5:
77
- $message = __( '<strong>Google Analytics UTM codes:</strong><br/>Adding Google Analytics UTM codes is not mandatory, it will however enable you to get detailed insights into how your products are performing in Google Analytics reporting and allow you to tweak and tune your campaign making it more profitable. We strongly advise you to add the Google Analytics tracking. When enabled the plugin will append the Google Analytics UTM parameters to your landingpage URL\'s.','woosea' );
78
  $message_type = "notice notice-info";
79
  break;
80
  case 6:
81
- $message = __( 'Your product feed is now being created, please be patient. Your feed details will be displayed when generation of the product feed has been finished.','woosea' );
82
  $message_type = "notice notice-info is-dismissible";
83
  break;
84
  case 7:
85
- $message = __( 'For the selected channel the attributes shown below are mandatory, please map them to your product attributes. We\'ve already pre-filled a lot of mappings so all you have to do is check those and map the ones that are left blank or add new ones by hitting the \'Add field mapping\' button.<br/><br/>[<strong><i><a href="https://adtribes.io/how-to-use-static-values-and-create-fake-content-for-your-product-feed/" target="_blank">Learn how to use static values</a></i></strong>]','woosea' );
86
  $message_type = "notice notice-info";
87
  break;
88
  case 8:
89
- $message = __( 'Manage your projects, such as the mappings and filter rules, below. Hit the refresh icon for the project to run with its new settings or just to refresh the product feed. When a project is being processed it is not possible to make changes to its configuration.','woosea' );
90
  $message_type = "notice notice-info";
91
  break;
92
  case 9:
93
- $message = __( 'You cannot create product feeds yet, please install WooCommerce first.','woosea' );
94
  $message_type = "notice notice-error";
95
  break;
96
  case 10:
97
- $message = __( 'The graph shows the amount of products in this product feed, measured after every scheduled and/or manually triggered refresh.','woosea' );
98
  $message_type = "notice notice-info is-dismissible";
99
  break;
100
  case 11:
101
- $message = __( 'You are running an old PHP version. This plugin might not work or be really slow. Please upgrade to PHP version 7.0 or newer.','woosea' );
102
  $message_type = "notice notice-error is-dismissible";
103
  break;
104
  case 12:
105
- $message = __( 'We are sorry but it seems you have disabled your WP CRON. This plugin creates product feeds in batches and needs the WP CRON to be active for doing so. Please enable the WP CRON in your wp-config.php file and re-activate this plugin before creating a product feed.','woosea' );
106
  $message_type = "notice notice-error is-dismissible";
107
  break;
108
  case 13:
109
- $message = __( 'We are sorry but it seems you are running an old version of WooCommerce. This plugin requires WooCommerce version 3.0 at least. Please upgrade to the latest version of WooCommerce before creating a product feed.','woosea' );
110
  $message_type = "notice notice-error is-dismissible";
111
  break;
112
  case 14:
113
- $message = __( 'Add important attributes, such as Brand, GTIN, condition and many more to create a perfect Google Shopping feed or fix the WooCommerce structured data bug so less products get disapproved in Google\'s Merchant Center.','woosea' );
114
  $message_type = "notice notice-info";
115
  break;
116
  case 15:
117
- $message = __( 'Manipulate your product data to improve the quality of your product feeds and online marketing campaigns. Manipulating your product data is an extremely powerfull feature. Check out an example we have created in our blog post: <b><u><a href="https://adtribes.io/feature-product-data-manipulation/" target="_blank">Manipulating product data</a></u></b>','woosea' );
118
  $message_type = "notice notice-info";
119
  break;
120
  }
54
 
55
  switch($step){
56
  case 0:
57
+ $message = __( 'Please select the country and channel for which you would like to create a new product feed. The channel drop-down will populate with relevant country channels once you selected a country. Filling in a project name is mandatory.','woo-product-feed-pro' );
58
  $message_type = "notice notice-info";
59
  break;
60
  case 1:
61
+ $message = __( 'Map your products or categories to the categories of your selected channel. For some channels adding their categorisation in the product feed is mandatory. Even when category mappings are not mandatory it is likely your products will get better visibility and higher conversions when mappings have been added.','woo-product-feed-pro' );
62
  $message_type = "notice notice-info";
63
  break;
64
  case 2:
65
+ $message = __( 'Please drag and drop the attributes you want to be in your product feed from left to right.','woo-product-feed-pro' );
66
  $message_type = "notice notice-info is-dismissible";
67
  break;
68
  case 3:
69
+ $message = __( 'Mapping your product categories to the channel categories will increase changes of getting all your products listed correctly, thus increase your conversion rates.','woo-product-feed-pro' );
70
  $message_type = "notice notice-info is-dismissible";
71
  break;
72
  case 4:
73
+ $message = __( 'Create filter and rules so exactly the right products end up in your product feed. These filters and rules are only eligable for the current product feed you are configuring and will not be used for other feeds.<br/><br/><strong>Filters:</strong> Exclude or include products that meet certain conditions. [<strong><i><a href="https://adtribes.io/how-to-create-filters-for-your-product-feed/" target="_blank">Detailed information and filter examples</a></i></strong>] or [<strong><i><a href="https://adtribes.io/create-a-product-feed-for-one-specific-category/" target="_blank">Create a product feed for just 1 category</a></i></strong>]<br/><strong>Rules:</strong> Change attribute values based on other attribute values or conditions.[<strong><i><a href="https://adtribes.io/how-to-create-rules/" target="_blank">Detailed information about rules and some examples</a></i></strong>]<br/><br/>Order of execution: the filters and rules will be executed in the order of creation.','woo-product-feed-pro' );
74
  $message_type = "notice notice-info";
75
  break;
76
  case 5:
77
+ $message = __( '<strong>Google Analytics UTM codes:</strong><br/>Adding Google Analytics UTM codes is not mandatory, it will however enable you to get detailed insights into how your products are performing in Google Analytics reporting and allow you to tweak and tune your campaign making it more profitable. We strongly advise you to add the Google Analytics tracking. When enabled the plugin will append the Google Analytics UTM parameters to your landingpage URL\'s.','woo-product-feed-pro' );
78
  $message_type = "notice notice-info";
79
  break;
80
  case 6:
81
+ $message = __( 'Your product feed is now being created, please be patient. Your feed details will be displayed when generation of the product feed has been finished.','woo-product-feed-pro' );
82
  $message_type = "notice notice-info is-dismissible";
83
  break;
84
  case 7:
85
+ $message = __( 'For the selected channel the attributes shown below are mandatory, please map them to your product attributes. We\'ve already pre-filled a lot of mappings so all you have to do is check those and map the ones that are left blank or add new ones by hitting the \'Add field mapping\' button.<br/><br/>[<strong><i><a href="https://adtribes.io/how-to-use-static-values-and-create-fake-content-for-your-product-feed/" target="_blank">Learn how to use static values</a></i></strong>]','woo-product-feed-pro' );
86
  $message_type = "notice notice-info";
87
  break;
88
  case 8:
89
+ $message = __( 'Manage your projects, such as the mappings and filter rules, below. Hit the refresh icon for the project to run with its new settings or just to refresh the product feed. When a project is being processed it is not possible to make changes to its configuration.','woo-product-feed-pro' );
90
  $message_type = "notice notice-info";
91
  break;
92
  case 9:
93
+ $message = __( 'You cannot create product feeds yet, please install WooCommerce first.','woo-product-feed-pro' );
94
  $message_type = "notice notice-error";
95
  break;
96
  case 10:
97
+ $message = __( 'The graph shows the amount of products in this product feed, measured after every scheduled and/or manually triggered refresh.','woo-product-feed-pro' );
98
  $message_type = "notice notice-info is-dismissible";
99
  break;
100
  case 11:
101
+ $message = __( 'You are running an old PHP version. This plugin might not work or be really slow. Please upgrade to PHP version 7.0 or newer.','woo-product-feed-pro' );
102
  $message_type = "notice notice-error is-dismissible";
103
  break;
104
  case 12:
105
+ $message = __( 'We are sorry but it seems you have disabled your WP CRON. This plugin creates product feeds in batches and needs the WP CRON to be active for doing so. Please enable the WP CRON in your wp-config.php file and re-activate this plugin before creating a product feed.','woo-product-feed-pro' );
106
  $message_type = "notice notice-error is-dismissible";
107
  break;
108
  case 13:
109
+ $message = __( 'We are sorry but it seems you are running an old version of WooCommerce. This plugin requires WooCommerce version 3.0 at least. Please upgrade to the latest version of WooCommerce before creating a product feed.','woo-product-feed-pro' );
110
  $message_type = "notice notice-error is-dismissible";
111
  break;
112
  case 14:
113
+ $message = __( 'Add important attributes, such as Brand, GTIN, condition and many more to create a perfect Google Shopping feed or fix the WooCommerce structured data bug so less products get disapproved in Google\'s Merchant Center.','woo-product-feed-pro' );
114
  $message_type = "notice notice-info";
115
  break;
116
  case 15:
117
+ $message = __( 'Manipulate your product data to improve the quality of your product feeds and online marketing campaigns. Manipulating your product data is an extremely powerfull feature. Check out an example we have created in our blog post: <b><u><a href="https://adtribes.io/feature-product-data-manipulation/" target="_blank">Manipulating product data</a></u></b>','woo-product-feed-pro' );
118
  $message_type = "notice notice-info";
119
  break;
120
  }
classes/class-attributes.php CHANGED
@@ -48,7 +48,7 @@ private function get_dynamic_attributes(){
48
  global $wpdb;
49
  $list = array();
50
 
51
- $no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","yst_prominent_words","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
52
  $taxonomies = get_taxonomies();
53
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
54
 
@@ -205,13 +205,17 @@ public function get_mapping_attributes_dropdown() {
205
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
206
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
207
  "title" => "Product name",
208
- "mother_title" => "Product name parent product",
209
  "title_hyphen" => "Product name hyphen",
 
 
210
  "title_lc" => "Product name lowercase",
 
211
  "description" => "Product description",
212
  "short_description" => "Product short description",
213
  "raw_description" => "Unfiltered product description",
214
  "raw_short_description" => "Unfiltered product short description",
 
 
215
  "price" => "Price",
216
  "regular_price" => "Regular price",
217
  "sale_price" => "Sale price",
@@ -229,14 +233,21 @@ public function get_mapping_attributes_dropdown() {
229
  "rounded_sale_price" => "Sale price rounded",
230
  "system_price" => "System price",
231
  "system_net_price" => "System price excl. VAT",
 
 
232
  "system_regular_price" => "System regular price",
233
  "system_sale_price" => "System sale price",
234
- "vivino_price" => "Pinterest / Vivino price",
235
- "vivino_sale_price" => "Pinterest / Vivino sale price",
236
- "vivino_regular_price" => "Pinterest / Vivino regular price",
237
  "non_geo_wcml_price" => "Non GEO WCML price",
 
 
 
 
238
  "discount_percentage" => "Discount percentage",
239
  "link" => "Link",
 
240
  "variable_link" => "Product variable link",
241
  "add_to_cart_link" => "Add to cart link",
242
  "product_creation_date" => "Product creation date",
@@ -247,9 +258,20 @@ public function get_mapping_attributes_dropdown() {
247
  "category_path" => "Category path",
248
  "category_path_short" => "Category path short",
249
  "category_path_skroutz" => "Category path Skroutz",
250
- "one_category" => "Primary category",
 
 
 
 
 
 
 
 
251
  "condition" => "Condition",
252
- "availability" => "Availability",
 
 
 
253
  "quantity" => "Quantity [Stock]",
254
  "product_type" => "Product Type",
255
  "content_type" => "Content Type",
@@ -267,7 +289,9 @@ public function get_mapping_attributes_dropdown() {
267
  "length" => "Length",
268
  "shipping" => "Shipping",
269
  "shipping_price" => "Shipping cost",
270
- "shipping_label" => "Shipping label",
 
 
271
  "visibility" => "Visibility",
272
  "rating_total" => "Total rating",
273
  "rating_average" => "Average rating",
@@ -350,9 +374,10 @@ public function get_mapping_attributes_dropdown() {
350
 
351
  foreach ($custom_attributes as $key => $value) {
352
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
353
- if (strpos($value, 0, 1) !== "_") {
 
354
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
355
- }
356
  }
357
  }
358
 
@@ -398,15 +423,20 @@ public function get_mapping_attributes_dropdown() {
398
  "parent_sku" => "SKU parent variable product",
399
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
400
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
401
- "title" => "Product name",
402
- "mother_title" => "Product name parent product",
403
- "title_hyphen" => "Product name hyphen",
 
404
  "title_lc" => "Product name lowercase",
 
405
  "description" => "Product description",
406
  "short_description" => "Product short description",
407
  "raw_description" => "Unfiltered product description",
408
  "raw_short_description" => "Unfiltered product short description",
409
- "link" => "Link",
 
 
 
410
  "variable_link" => "Product variable link",
411
  "add_to_cart_link" => "Add to cart link",
412
  "image" => "Main image",
@@ -429,10 +459,21 @@ public function get_mapping_attributes_dropdown() {
429
  "category_path" => "Category path",
430
  "category_path_short" => "Category path short",
431
  "category_path_skroutz" => "Category path Skroutz",
432
- "one_category" => "Primary category",
 
 
 
 
 
 
 
 
433
  "condition" => "Condition",
434
- "availability" => "Availability",
435
- "quantity" => "Quantity [Stock]",
 
 
 
436
  "price" => "Price",
437
  "regular_price" => "Regular price",
438
  "sale_price" => "Sale price",
@@ -449,14 +490,20 @@ public function get_mapping_attributes_dropdown() {
449
  "rounded_regular_price" => "Regular price rounded",
450
  "rounded_sale_price" => "Sale price rounded",
451
  "system_price" => "System price",
452
- "system_net_price" => "System price excl. VAT",
 
 
453
  "system_regular_price" => "System regular price",
454
  "system_sale_price" => "System sale price",
455
- "vivino_price" => "Pinterest / Vivino price",
456
- "vivino_sale_price" => "Pinterest / Vivino sale price",
457
- "vivino_regular_price" => "Pinterest / Vivino regular price",
458
  "non_geo_wcml_price" => "Non GEO WCML price",
459
- "discount_percentage" => "Discount percentage",
 
 
 
 
460
  "item_group_id" => "Item group ID",
461
  "weight" => "Weight",
462
  "width" => "Width",
@@ -464,7 +511,9 @@ public function get_mapping_attributes_dropdown() {
464
  "length" => "Length",
465
  "shipping" => "Shipping",
466
  "shipping_price" => "Shipping cost",
467
- "shipping_label" => "Shipping label",
 
 
468
  "visibility" => "Visibility",
469
  "rating_total" => "Total rating",
470
  "rating_average" => "Average rating",
48
  global $wpdb;
49
  $list = array();
50
 
51
+ $no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
52
  $taxonomies = get_taxonomies();
53
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
54
 
205
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
206
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
207
  "title" => "Product name",
 
208
  "title_hyphen" => "Product name hyphen",
209
+ "mother_title" => "Product name parent product",
210
+ "mother_title_hyphen" => "Product name parent product hyphen",
211
  "title_lc" => "Product name lowercase",
212
+ "title_lcw" => "Product name uppercase first characters",
213
  "description" => "Product description",
214
  "short_description" => "Product short description",
215
  "raw_description" => "Unfiltered product description",
216
  "raw_short_description" => "Unfiltered product short description",
217
+ "mother_description" => "Product description parent product",
218
+ "mother_short_description" => "Product short description parent product",
219
  "price" => "Price",
220
  "regular_price" => "Regular price",
221
  "sale_price" => "Sale price",
233
  "rounded_sale_price" => "Sale price rounded",
234
  "system_price" => "System price",
235
  "system_net_price" => "System price excl. VAT",
236
+ "system_net_sale_price" => "System sale price excl. VAT",
237
+ "system_net_regular_price" => "System regular price excl. VAT",
238
  "system_regular_price" => "System regular price",
239
  "system_sale_price" => "System sale price",
240
+ "vivino_price" => "Pinterest / TikTok / Vivino price",
241
+ "vivino_sale_price" => "Pinterest / TikTok / Vivino sale price",
242
+ "vivino_regular_price" => "Pinterest / TikTok / Vivino regular price",
243
  "non_geo_wcml_price" => "Non GEO WCML price",
244
+ "mm_min_price" => "Mix & Match minimum price",
245
+ "mm_min_regular_price" => "Mix & Match minimum regular price",
246
+ "mm_max_price" => "Mix & Match maximum price",
247
+ "mm_max_regular_price" => "Mix & Match maximum regular price",
248
  "discount_percentage" => "Discount percentage",
249
  "link" => "Link",
250
+ "link_no_tracking" => "Link without parameters",
251
  "variable_link" => "Product variable link",
252
  "add_to_cart_link" => "Add to cart link",
253
  "product_creation_date" => "Product creation date",
258
  "category_path" => "Category path",
259
  "category_path_short" => "Category path short",
260
  "category_path_skroutz" => "Category path Skroutz",
261
+ "one_category" => "Yoast / Rankmath primary category",
262
+ "nr_variations" => "Number of variations",
263
+ "nr_variations_stock" => "Number of variations on stock",
264
+ "yoast_gtin8" => "Yoast WooCommerce GTIN8",
265
+ "yoast_gtin12" => "Yoast WooCommerce GTIN12",
266
+ "yoast_gtin13" => "Yoast WooCommerce GTIN13",
267
+ "yoast_gtin14" => "Yoast WooCommerce GTIN14",
268
+ "yoast_isbn" => "Yoast WooCommerce ISBN",
269
+ "yoast_mpn" => "Yoast WooCommerce MPN",
270
  "condition" => "Condition",
271
+ "purchase_note" => "Purchase note",
272
+ "availability" => "Availability",
273
+ "region_id" => "Region Id",
274
+ "stock_status" => "Stock Status WooCommerce",
275
  "quantity" => "Quantity [Stock]",
276
  "product_type" => "Product Type",
277
  "content_type" => "Content Type",
289
  "length" => "Length",
290
  "shipping" => "Shipping",
291
  "shipping_price" => "Shipping cost",
292
+ "lowest_shipping_costs" => "Lowest shipping costs",
293
+ "shipping_label" => "Shipping class slug",
294
+ "shipping_label_name" => "Shipping class name",
295
  "visibility" => "Visibility",
296
  "rating_total" => "Total rating",
297
  "rating_average" => "Average rating",
374
 
375
  foreach ($custom_attributes as $key => $value) {
376
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
377
+ $value = ltrim($value);
378
+ if (!empty($value)){
379
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
380
+ }
381
  }
382
  }
383
 
423
  "parent_sku" => "SKU parent variable product",
424
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
425
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
426
+ "title" => "Product name",
427
+ "title_hyphen" => "Product name hyphen",
428
+ "mother_title" => "Product name parent product",
429
+ "mother_title_hyphen" => "Product name parent product hyphen",
430
  "title_lc" => "Product name lowercase",
431
+ "title_lcw" => "Product name uppercase first characters",
432
  "description" => "Product description",
433
  "short_description" => "Product short description",
434
  "raw_description" => "Unfiltered product description",
435
  "raw_short_description" => "Unfiltered product short description",
436
+ "mother_description" => "Product description parent product",
437
+ "mother_short_description" => "Product short description parent product",
438
+ "link" => "Link",
439
+ "link_no_tracking" => "Link without parameters",
440
  "variable_link" => "Product variable link",
441
  "add_to_cart_link" => "Add to cart link",
442
  "image" => "Main image",
459
  "category_path" => "Category path",
460
  "category_path_short" => "Category path short",
461
  "category_path_skroutz" => "Category path Skroutz",
462
+ "one_category" => "Yoast / Rankmath primary category",
463
+ "nr_variations" => "Number of variations",
464
+ "nr_variations_stock" => "Number of variations on stock",
465
+ "yoast_gtin8" => "Yoast WooCommerce GTIN8",
466
+ "yoast_gtin12" => "Yoast WooCommerce GTIN12",
467
+ "yoast_gtin13" => "Yoast WooCommerce GTIN13",
468
+ "yoast_gtin14" => "Yoast WooCommerce GTIN14",
469
+ "yoast_isbn" => "Yoast WooCommerce ISBN",
470
+ "yoast_mpn" => "Yoast WooCommerce MPN",
471
  "condition" => "Condition",
472
+ "purchase_note" => "Purchase note",
473
+ "availability" => "Availability",
474
+ "region_id" => "Region Id",
475
+ "stock_status" => "Stock Status WooCommerce",
476
+ "quantity" => "Quantity [Stock]",
477
  "price" => "Price",
478
  "regular_price" => "Regular price",
479
  "sale_price" => "Sale price",
490
  "rounded_regular_price" => "Regular price rounded",
491
  "rounded_sale_price" => "Sale price rounded",
492
  "system_price" => "System price",
493
+ "system_net_price" => "System price excl. VAT",
494
+ "system_net_sale_price" => "System sale price excl. VAT",
495
+ "system_net_regular_price" => "System regular price excl. VAT",
496
  "system_regular_price" => "System regular price",
497
  "system_sale_price" => "System sale price",
498
+ "vivino_price" => "Pinterest / TikTok / Vivino price",
499
+ "vivino_sale_price" => "Pinterest / TikTok / Vivino sale price",
500
+ "vivino_regular_price" => "Pinterest / TikTok / Vivino regular price",
501
  "non_geo_wcml_price" => "Non GEO WCML price",
502
+ "mm_min_price" => "Mix & Match minimum price",
503
+ "mm_min_regular_price" => "Mix & Match minimum regular price",
504
+ "mm_max_price" => "Mix & Match maximum price",
505
+ "mm_max_regular_price" => "Mix & Match maximum regular price",
506
+ "discount_percentage" => "Discount percentage",
507
  "item_group_id" => "Item group ID",
508
  "weight" => "Weight",
509
  "width" => "Width",
511
  "length" => "Length",
512
  "shipping" => "Shipping",
513
  "shipping_price" => "Shipping cost",
514
+ "lowest_shipping_costs" => "Lowest shipping costs",
515
+ "shipping_label" => "Shipping class slug",
516
+ "shipping_label_name" => "Shipping class name",
517
  "visibility" => "Visibility",
518
  "rating_total" => "Total rating",
519
  "rating_average" => "Average rating",
classes/class-get-products.php CHANGED
@@ -23,10 +23,11 @@ class WooSEA_Get_Products {
23
  * Function to add CDATA brackets to title, short_description and description attributes
24
  */
25
  protected function woosea_append_cdata( $string ){
26
- return "<![CDATA[ $string ]]>";
 
 
27
  }
28
 
29
-
30
  /**
31
  * Check if a plugin is active
32
  */
@@ -57,6 +58,11 @@ class WooSEA_Get_Products {
57
  * Get all approved product review comments for Google's Product Review Feeds
58
  */
59
  public function woosea_get_reviews ( $product_data, $product ) {
 
 
 
 
 
60
  $approved_reviews = array();
61
  $prod_id = $product_data['id'];
62
 
@@ -73,54 +79,62 @@ class WooSEA_Get_Products {
73
 
74
  // Loop through all product reviews for this specific products (ternary operators)
75
  foreach($reviews as $review_raw){
76
- $review = array();
77
- $review['review_reviewer_image'] = empty($product_data['reviewer_image']) ? '' : $product_data['reviewer_image'];
78
- $review['review_ratings'] = get_comment_meta( $review_raw->comment_ID, 'rating', true);
79
- $review['review_id'] = $review_raw->comment_ID;
80
-
81
- // Names need to be anonomyzed
82
- $name_pieces = explode(" ", $review_raw->comment_author);
83
- $nr_name_pieces = count($name_pieces);
84
- $cnt = 0;
85
- $name = "";
86
- foreach($name_pieces as $n_piece){
87
- if($cnt > 0){
88
- $n_piece = substr($n_piece, 0, 1);
89
- }
90
- $name .= $n_piece." ";
91
- $cnt++;
92
- }
93
 
94
- // Remove strange charachters from reviewer name
95
- $review['reviewer_name'] = $this->rip_tags(trim(ucfirst($name)));
96
- $review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
97
- $review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
98
- $review['reviewer_name'] = str_replace("&#xa0;", "", $review['reviewer_name']);
99
- $review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
100
-
101
- $review['reviewer_id'] = $review_raw->user_id;
102
- $review['review_timestamp'] = $review_raw->comment_date;
103
-
104
- // Remove strange characters from review title
105
- $review['title'] = empty($product_data['title']) ? '' : $product_data['title'];
106
- $review['title'] = $this->rip_tags($review['title']);
107
- $review['title'] = html_entity_decode((str_replace("\r", "", $review['title'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
108
- $review['title'] = preg_replace( '/\[(.*?)\]/', ' ', $review['title'] );
109
- $review['title'] = str_replace("&#xa0;", "", $review['title']);
110
- $review['title'] = $this->woosea_utf8_for_xml( $review['title'] );
111
-
112
- // Remove strange charchters from review content
113
- $review['content'] = $review_raw->comment_content;
114
- $review['content'] = $this->rip_tags($review['content']);
115
- $review['content'] = html_entity_decode((str_replace("\r", "", $review['content'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
116
- $review['content'] = preg_replace( '/\[(.*?)\]/', ' ', $review['content'] );
117
- $review['content'] = str_replace("&#xa0;", "", $review['content']);
118
- $review['content'] = $this->woosea_utf8_for_xml( $review['content'] );
119
-
120
- $review['review_product_name'] = $product_data['title'];
121
- $review['review_url'] = $product_data['link'];
122
- $review['review_product_url'] = $product_data['link'];
123
- array_push($approved_reviews, $review);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
125
  $review_count = $product->get_review_count();
126
  $review_average = $product->get_average_rating();
@@ -174,7 +188,7 @@ class WooSEA_Get_Products {
174
  if($feed_config['fields'] == "google_drm"){
175
  $utm_part .= "&$key=$value";
176
  } else {
177
- $utm_part .= "&amp;$key=$value";
178
  }
179
  }
180
 
@@ -200,7 +214,7 @@ class WooSEA_Get_Products {
200
  if($parentId > 0){
201
  # Even though variation products always have parameters in the URL we still need to check and make sure they are there
202
  if(strpos($link, '?') !== false){
203
- $utm_part = "&amp;".ltrim($utm_part, '&amp;');
204
  } else {
205
  $utm_part = "?".ltrim($utm_part, '&amp;');
206
  }
@@ -248,21 +262,43 @@ class WooSEA_Get_Products {
248
  $data = $wpdb->get_results($sql);
249
 
250
  if (count($data)) {
251
-
252
  foreach ($data as $key => $value) {
253
  $value_display = str_replace("_", " ",$value->name);
254
- if (!preg_match("/_product_attributes/i",$value->name)){
255
  $list[$value->name] = ucfirst($value_display);
256
- } else {
257
- $product_attr = unserialize($value->type);
258
- if(!empty($product_attr)){
259
- foreach ($product_attr as $key_inner => $arr_value) {
260
- $value_display = @str_replace("_", " ",$arr_value['name']);
261
- $list[$key_inner] = ucfirst($value_display);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  }
263
  }
264
  }
265
- }
266
  return $list;
267
  }
268
  return false;
@@ -324,7 +360,7 @@ class WooSEA_Get_Products {
324
  /**
325
  * Get category path (needed for Prisjakt)
326
  */
327
- public function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxonomy, $nicename = false, $visited = array() ) {
328
  // Only add Home to the beginning of the chain when we start buildin the chain
329
  if(empty($visited)){
330
  $chain = 'Home';
@@ -363,6 +399,15 @@ class WooSEA_Get_Products {
363
  return $chain;
364
  }
365
 
 
 
 
 
 
 
 
 
 
366
  /**
367
  * Get all configured shipping zones
368
  */
@@ -652,8 +697,8 @@ class WooSEA_Get_Products {
652
  /**
653
  * Get shipping cost for product
654
  */
655
- public function woosea_get_shipping_cost ($class_cost_id, $project_config, $price, $tax_rates, $shipping_zones, $product_id, $item_group_id) {
656
- $shipping_cost = 0;
657
  $shipping_arr = array();
658
  $zone_count = 0;
659
  $nr_shipping_zones = count($shipping_zones);
@@ -712,6 +757,8 @@ class WooSEA_Get_Products {
712
  $shipping_methods = $zone['shipping_methods'];
713
 
714
  foreach ($shipping_methods as $k => $v){
 
 
715
 
716
  if($v->enabled == "yes"){
717
  if(empty($zone_details['country'])){
@@ -721,55 +768,57 @@ class WooSEA_Get_Products {
721
  }
722
  $taxable = $v->tax_status;
723
 
724
- if(isset($v->instance_settings['cost'])){
725
- $shipping_cost = $v->instance_settings['cost'];
726
- if(!$shipping_cost){
727
- $shipping_cost = 0;
728
- }
729
 
730
- // Do we need to convert the shipping costs with the Aelia Currency Switcher
731
- if((isset($project_config['AELIA'])) AND (!empty($GLOBALS['woocommerce-aelia-currencyswitcher'])) AND (get_option ('add_aelia_support') == "yes")){
 
 
732
 
733
- if(!array_key_exists('base_currency', $project_config)){
734
- $from_currency = get_woocommerce_currency();
735
- } else {
736
- $from_currency = $project_config['base_currency'];
737
- }
738
-
739
- // Get Aelia currency conversion prices
740
- $shipping_cost = apply_filters('wc_aelia_cs_convert', $shipping_cost, $from_currency, $project_config['AELIA']);
741
- }
742
 
743
- if($taxable == "taxable"){
744
- foreach ($tax_rates as $k_inner => $w){
745
- if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
746
- $rate = (($w['rate']+100)/100);
747
 
748
- $shipping_cost = str_replace(",", ".", $shipping_cost);
749
- $shipping_cost = $shipping_cost*$rate;
750
- $shipping_cost = round($shipping_cost, 2);
751
- $shipping_cost = wc_format_localized_price($shipping_cost);
 
752
  }
753
  }
754
  }
755
- }
756
-
757
- // WooCommerce Table Rate Bolder Elements
758
- if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
759
- // Set shipping cost
760
- $shipping_cost = 0;
761
- if(!empty($product_id)){
762
- // Add product to cart
763
- if ((isset($product_id)) AND ($product_id > 0)){
764
- $quantity = 1;
765
- if(!empty($code_from_config)){
766
- defined( 'WC_ABSPATH' ) || exit;
767
-
768
- // Load cart functions which are loaded only on the front-end.
769
- include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
770
- include_once WC_ABSPATH . 'includes/class-wc-cart.php';
771
-
772
- // if ( is_null( WC()->cart ) ) {
773
  wc_load_cart();
774
 
775
  WC()->customer->set_shipping_country( $code_from_config );
@@ -787,17 +836,85 @@ class WooSEA_Get_Products {
787
  // Read cart and get schipping costs
788
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
789
  $total_cost = WC()->cart->get_total();
790
- $shipping_cost = WC()->cart->get_shipping_total();
 
 
791
  $shipping_cost = wc_format_localized_price($shipping_cost);
792
-
793
- }
794
  // Make sure to empty the cart again
795
  WC()->cart->empty_cart();
796
- // }
797
- }
798
- }
799
- }
800
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
801
 
802
  // CLASS SHIPPING COSTS
803
  if((isset($v->instance_settings[$class_cost_id])) AND ($class_cost_id != "no_class_cost")){
@@ -847,7 +964,6 @@ class WooSEA_Get_Products {
847
  $mathString = str_replace(array('\'', '"', ','), '', $mathString);
848
 
849
  if(!empty($mathString)){
850
- eval("\$mathString = $mathString;");
851
  $shipping_cost = $mathString;
852
 
853
  if($taxable == "taxable"){
@@ -931,6 +1047,16 @@ class WooSEA_Get_Products {
931
  unset($shipping_cost);
932
  }
933
  }
 
 
 
 
 
 
 
 
 
 
934
  }
935
 
936
  if(isset($zone_details)){
@@ -948,7 +1074,12 @@ class WooSEA_Get_Products {
948
  }
949
  }
950
  }
951
-
 
 
 
 
 
952
  if(isset($shipping_cost)){
953
  if(strlen($shipping_cost) > 0){
954
  if($project_config['ship_suffix'] == "false"){
@@ -957,12 +1088,9 @@ class WooSEA_Get_Products {
957
  $zone_details['price'] = trim($shipping_cost);
958
  }
959
  } else {
960
- // $shipping_cost = 0;
961
  if(isset($shipping_cost)){
962
  $zone_details['price'] = trim($currency." ".$shipping_cost);
963
  }
964
- //unset($zone_details);
965
- //unset($shipping_cost);
966
  }
967
  }
968
  }
@@ -992,12 +1120,19 @@ class WooSEA_Get_Products {
992
 
993
  // Remove other shipping classes when free shipping is relevant
994
  $free_check = "yes";
995
- //$free_check = get_option ('free_shipping');
996
 
997
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
998
  foreach($shipping_arr as $k => $v) {
999
  if(!in_array($free_check, $v)){
1000
- unset($shipping_arr[$k]);
 
 
 
 
 
 
 
 
1001
  }
1002
  }
1003
  }
@@ -1005,8 +1140,6 @@ class WooSEA_Get_Products {
1005
  // Fix empty services
1006
  foreach($shipping_arr as $k => $v){
1007
  if(empty($v['service'])){
1008
- // $lalala = get_option( 'woocommerce_default_country' );
1009
- // $shipping_arr[$k]['country'] = get_option( 'woocommerce_default_country' );
1010
  unset($shipping_arr[$k]);
1011
  }
1012
  }
@@ -1097,7 +1230,7 @@ class WooSEA_Get_Products {
1097
  // End Facebook ID's
1098
 
1099
  $xml->channel->addChild('title', htmlspecialchars($feed_config['projectname']));
1100
- $xml->channel->addChild('link', site_url());
1101
  $xml->channel->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1102
  $xml->asXML($file);
1103
  } else {
@@ -1141,20 +1274,24 @@ class WooSEA_Get_Products {
1141
  $link = $product->addChild('g:additional_image_link', $v, $namespace['g']);
1142
  //$product->$k = $v;
1143
  } elseif (preg_match("/g:product_highlight/i",$k)){
 
1144
  $product_highlight = $product->addChild('g:product_highlight', $v, $namespace['g']);
1145
  } elseif (preg_match("/g:product_detail/i",$k)){
1146
  if(!empty($v)){
1147
  $product_detail_split = explode("#", $v);
1148
- $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1149
- $name = str_replace("_", " ", $product_detail_split[0]);
1150
-
1151
- $section_name = explode(":", $name);
1152
- $section_name_start = ucfirst($section_name[0]);
1153
- $name = ucfirst(trim($section_name[1]));
1154
-
1155
- $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1156
- $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1157
- $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
 
 
 
1158
  }
1159
  } elseif ($k == "g:installment"){
1160
  if(!empty($v)){
@@ -1207,7 +1344,7 @@ class WooSEA_Get_Products {
1207
  $shop = $xml->addChild('shop');
1208
  $shop->addChild('name', htmlspecialchars($feed_config['projectname']));
1209
  $shop->addChild('company', get_bloginfo());
1210
- $shop->addChild('url', site_url());
1211
  //$shop->addChild('platform', 'WooCommerce');
1212
  $currencies = $shop->addChild('currencies');
1213
  $currency = $currencies->addChild('currency');
@@ -1259,6 +1396,9 @@ class WooSEA_Get_Products {
1259
  } elseif ($feed_config['name'] == "Glami.gr") {
1260
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><SHOP></SHOP>');
1261
  $xml->asXML($file);
 
 
 
1262
  } elseif ($feed_config['name'] == "Pricecheck.co.za") {
1263
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><Offers></Offers>');
1264
  $xml->asXML($file);
@@ -1267,7 +1407,6 @@ class WooSEA_Get_Products {
1267
  $xml->addAttribute('xmlns:content', 'http://purl.org/rss/1.0/modules/content/');
1268
  $xml->addAttribute('xmlns:wfw', 'http://wellformedweb.org/CommentAPI/');
1269
  $xml->addAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
1270
- // $xml->addAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
1271
  $xml->addAttribute('xmlns:sy', 'http://purl.org/rss/1.0/modules/syndication/');
1272
  $xml->addAttribute('xmlns:slash', 'http://purl.org/rss/1.0/modules/slash/');
1273
  $xml->addAttribute('version', '2.0');
@@ -1284,7 +1423,7 @@ class WooSEA_Get_Products {
1284
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><STORE></STORE>');
1285
  $xml->addChild('datetime', date('Y-m-d H:i:s'));
1286
  $xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1287
- $xml->addChild('link', site_url());
1288
  $xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1289
  $xml->addChild('agency', 'AdTribes.io');
1290
  $xml->addChild('email', 'support@adtribes.io');
@@ -1293,7 +1432,7 @@ class WooSEA_Get_Products {
1293
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><root></root>');
1294
  $xml->addChild('datetime', date('Y-m-d H:i:s'));
1295
  $xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1296
- $xml->addChild('link', site_url());
1297
  $xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1298
  $xml->addChild('agency', 'AdTribes.io');
1299
  $xml->addChild('email', 'support@adtribes.io');
@@ -1317,10 +1456,10 @@ class WooSEA_Get_Products {
1317
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><products></products>');
1318
  $xml->addAttribute('version', '1.0');
1319
  $xml->addAttribute('standalone', 'yes');
1320
- $xml->addChild('datetime', date('Y-m-d H:i:s'));
1321
- $xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1322
- $xml->addChild('link', site_url());
1323
- $xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1324
  $xml->asXML($file);
1325
  }
1326
  } else {
@@ -1355,194 +1494,204 @@ class WooSEA_Get_Products {
1355
 
1356
  // For Google Product review template
1357
  if (($feed_config['name'] == "Google Product Review") AND (empty($xml->channel))) {
1358
- $product = $xml->addChild('reviews');
 
 
1359
 
1360
- foreach ($products as $key => $value){
1361
 
1362
- $expl = "||";
1363
- if(strpos($value['reviews'], $expl)) {
1364
- $review_data = explode("||", $value['reviews']);
1365
- foreach($review_data as $rk => $rv){
 
1366
 
1367
- $review_comp = explode(":::", $rv);
1368
- $nr_reviews = count($review_comp);
1369
 
1370
- if($nr_reviews > 1){
1371
- $productz = $xml->reviews->addChild('review');
1372
 
1373
- foreach($review_comp as $rck => $rcv){
1374
- $nodes = explode("##", $rcv);
1375
- $nodes = str_replace("::", "", $nodes);
1376
 
1377
- if($nodes[0] == "REVIEW_RATINGS"){
1378
- // Do nothing
1379
- } elseif($nodes[0] == "REVIEW_URL"){
1380
- $rev_url = $productz->addChild(strtolower($nodes[0]), htmlspecialchars($nodes[1]));
1381
- $rev_url->addAttribute('type', 'singleton');
1382
- } elseif(($nodes[0] == "REVIEWER_NAME") OR ($nodes[0] == "REVIEWER_ID")){
1383
- if(isset($productz->reviewer)){
1384
- if($nodes[0] == "REVIEWER_NAME"){
1385
- $name = $nodes[1];
1386
- if(empty($name)){
1387
- $reviewer->addChild('name','Anonymous');
1388
- $reviewer->name->addAttribute('is_anonymous', 'true');
 
 
 
1389
  } else {
1390
- $reviewer->addChild('name',$name);
 
 
1391
  }
1392
  } else {
1393
- $reviewer->addChild('reviewer_id',$nodes[1]);
1394
- }
1395
- } else {
1396
- $reviewer = $productz->addChild('reviewer');
1397
- if($nodes[0] == "REVIEWER_NAME"){
1398
- $name = $nodes[1];
1399
- if(empty($name)){
1400
- $reviewer->addChild('name','Anonymous');
1401
- $reviewer->name->addAttribute('is_anonymous', 'true');
1402
  } else {
1403
- $reviewer->addChild('name',$name);
 
 
1404
  }
1405
- } else {
1406
- $reviewer->addChild('reviewer_id',$nodes[1]);
1407
  }
1408
- }
1409
- } else {
1410
- if(isset($nodes[1])){
1411
- $content = html_entity_decode($nodes[1]);
1412
- $content = htmlspecialchars($content);
1413
- $rev = $productz->addChild(strtolower($nodes[0]), $content);
1414
  }
1415
  }
1416
- }
1417
 
1418
- foreach($review_comp as $rck => $rcv){
1419
- $nodes = explode("##", $rcv);
1420
- $nodes = str_replace("::", "", $nodes);
1421
 
1422
- if($nodes[0] == "REVIEW_RATINGS"){
1423
- $rev = $productz->addChild('ratings');
1424
- $over = $productz->ratings->addChild('overall', $nodes[1]);
1425
- $over->addAttribute('min', '1');
1426
- $over->addAttribute('max', '5');
 
1427
  }
1428
- }
1429
-
1430
 
1431
- $yo = $productz->addChild('products');
1432
- $po = $yo->addChild('product');
1433
 
1434
- $identifiers = array("gtin","mpn","sku","brand");
1435
 
1436
- // Start determining order of product_ids in the Google review feed
1437
- $proper_order = array("product_name","gtin","mpn","sku","brand","product_url","review_url","reviews");
1438
- $order_sorted = array();
1439
- foreach ($proper_order as &$order_value){
1440
- if(isset($value[$order_value])){
1441
- $order_sorted[$order_value] = $value[$order_value];
 
1442
  }
1443
- }
1444
- // End
1445
-
1446
- foreach($order_sorted as $k => $v) {
1447
- if(($k != "product_name") AND ($k != "product_url")){
1448
- if(!in_array($k, $identifiers)){
1449
- if(($k != "reviews") AND ($k != "review_url")){
1450
- $v = str_replace("&", "and", $v);
1451
- $poa = $po->addChild($k,htmlspecialchars($v));
1452
- }
1453
- } else {
1454
- if(isset($po->product_ids)){
1455
- if ($k == "gtin"){
1456
- $poig = $poi->addChild('gtins');
1457
- $poig->$k = $v;
1458
- } elseif ($k == "mpn"){
1459
- $poim = $poi->addChild('mpns');
1460
- $poim->$k = $v;
1461
- } elseif ($k == "sku"){
1462
- $poix = $poi->addChild('skus');
1463
- $poix->$k = $v;
1464
- } elseif($k == "brand"){
1465
- $poib = $poi->addChild('brands');
1466
- $poib->$k = $v;
1467
- } else {
1468
- // Do nothing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
  }
1470
- } else {
1471
- $poi = $po->addChild('product_ids');
1472
- if ($k == "gtin"){
1473
- $poig = $poi->addChild('gtins');
1474
- $poig->$k = $v;
1475
- } elseif ($k == "mpn"){
1476
- $poim = $poi->addChild('mpns');
1477
- $poim->$k = $v;
1478
- } elseif ($k == "sku"){
1479
- $poix = $poi->addChild('skus');
1480
- $poix->$k = $v;
1481
- } elseif($k == "brand"){
1482
- $poib = $poi->addChild('brands');
1483
- $poib->$k = $v;
1484
- } else {
1485
- // Do nothing
1486
- }
1487
- }
1488
- }
1489
- }
1490
- }
1491
 
1492
- // foreach for product name and product url as order seems to mather to Google
1493
- foreach($value as $k => $v) {
1494
- if(($k == "product_name") OR ($k == "product_url")){
1495
- if(!in_array($k, $identifiers)){
1496
- if(($k != "reviews") AND ($k != "review_url")){
1497
- $v = str_replace("&", "and", $v);
1498
- $poa = $po->addChild($k,htmlspecialchars($v));
1499
- }
1500
- } else {
1501
- if(isset($po->product_ids)){
1502
- if ($k == "gtin"){
1503
- $poig = $poi->addChild('gtins');
1504
- $poig->$k = $v;
1505
- } elseif ($k == "mpn"){
1506
- $poim = $poi->addChild('mpns');
1507
- $poim->$k = $v;
1508
- } elseif($k == "sku"){
1509
- $poix = $poi->addChild('skus');
1510
- $poix->$k = $v;
1511
- } elseif($k == "brand"){
1512
- $poib = $poi->addChild('brands');
1513
- $poib->$k = $v;
1514
- } else {
1515
- // Do nothing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1516
  }
1517
- } else {
1518
- $poi = $po->addChild('product_ids');
1519
- if ($k == "gtin"){
1520
- $poig = $poi->addChild('gtins');
1521
- $poig->$k = $v;
1522
- } elseif ($k == "mpn"){
1523
- $poim = $poi->addChild('mpns');
1524
- $poim->$k = $v;
1525
- } elseif ($k == "sku"){
1526
- $poix = $poi->addChild('skus');
1527
- $poix->$k = $v;
1528
- } elseif($k == "brand"){
1529
- $poib = $poi->addChild('brands');
1530
- $poib->$k = $v;
1531
- } else {
1532
- // Do nothing
1533
- }
1534
- }
1535
- }
1536
- }
1537
- }
1538
- }
1539
  }
1540
  }
1541
  }
1542
  }
1543
 
1544
  foreach ($products as $key => $value){
1545
-
1546
  if ((is_array ( $value )) and (!empty( $value ))) {
1547
  if ($feed_config['name'] == "Yandex") {
1548
  $product = $xml->shop->offers->addChild('offer');
@@ -1566,7 +1715,9 @@ class WooSEA_Get_Products {
1566
 
1567
  } else {
1568
  if(count($value) > 0){
1569
- $product = $xml->addChild('product');
 
 
1570
  }
1571
  }
1572
 
@@ -1676,11 +1827,10 @@ class WooSEA_Get_Products {
1676
  $product->addChild("$k");
1677
  $product->$k = $v;
1678
  } else {
1679
- if ($feed_config['fields'] != 'standard'){
1680
  $k = $this->get_alternative_key ($channel_attributes, $k);
1681
  }
1682
  if(!empty($k)){
1683
-
1684
  /**
1685
  * Some Zbozi and Heureka attributes need some extra XML nodes
1686
  */
@@ -1715,7 +1865,34 @@ class WooSEA_Get_Products {
1715
  $productp = $product->addChild($p,$v);
1716
  $productp->addAttribute('name', $pieces[1]);
1717
  } elseif ($feed_config['name'] == "Google Product Review") {
 
 
 
1718
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1719
  } elseif ($feed_config['name'] == "Fruugo.nl") {
1720
  $desc_arr = array('Language','Title','Description');
1721
  $price_arr = array('Currency','NormalPriceWithoutVAT','NormalPriceWithVAT','VATRate');
@@ -1747,6 +1924,7 @@ class WooSEA_Get_Products {
1747
  }
1748
 
1749
  if(is_object($xml)){
 
1750
  $xml->asXML($file);
1751
  }
1752
  unset($product);
@@ -1798,7 +1976,7 @@ class WooSEA_Get_Products {
1798
  $channel_attributes = get_option('channel_attributes');
1799
  }
1800
  }
1801
-
1802
  // Append or write to file
1803
  $fp = fopen($file, 'a+');
1804
 
@@ -1815,7 +1993,7 @@ class WooSEA_Get_Products {
1815
  $pieces = str_replace("'", "", $pieces);
1816
 
1817
  foreach ($pieces as $k_inner => $v){
1818
- if ($feed_config['fields'] != 'standard'){
1819
  $v = $this->get_alternative_key ($channel_attributes, $v);
1820
  }
1821
 
@@ -1880,6 +2058,7 @@ class WooSEA_Get_Products {
1880
  fwrite($fp, $tab_line);
1881
  }
1882
  } else {
 
1883
  $tofile = fputcsv($fp, $pieces, $csv_delimiter, '"');
1884
  }
1885
 
@@ -1993,7 +2172,7 @@ class WooSEA_Get_Products {
1993
  $xml_piece = "";
1994
 
1995
  // Get taxonomies
1996
- $no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","yst_prominent_words","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
1997
  $taxonomies = get_taxonomies();
1998
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
1999
 
@@ -2041,6 +2220,33 @@ class WooSEA_Get_Products {
2041
  }
2042
  }
2043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2044
  // Construct WP query
2045
  $wp_query = array(
2046
  'posts_per_page' => $offset_step_size,
@@ -2048,8 +2254,10 @@ class WooSEA_Get_Products {
2048
  'post_type' => $post_type,
2049
  'post_status' => 'publish',
2050
  'fields' => 'ids',
2051
- 'no_found_rows' => true,
2052
- );
 
 
2053
  $prods = new WP_Query($wp_query);
2054
  $shipping_zones = $this->woosea_get_shipping_zones();
2055
 
@@ -2086,9 +2294,8 @@ class WooSEA_Get_Products {
2086
  if(!in_array($product_data['id'], $allowed_product_orders)){ continue; }
2087
  }
2088
  }
2089
-
2090
  $product_data['title'] = $product->get_title();
2091
- $product_data['title'] = $this->woosea_utf8_for_xml( $product_data['title'] );
2092
  $product_data['mother_title'] = $product->get_title();
2093
  $product_data['mother_title'] = $this->woosea_utf8_for_xml( $product_data['mother_title'] );
2094
  $product_data['title_hyphen'] = $product_data['title'];
@@ -2248,10 +2455,9 @@ class WooSEA_Get_Products {
2248
  // Check if there are mother categories
2249
  if(!empty($product_cat)){
2250
  $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
2251
- $category_path_skroutz = preg_replace('/&gt;/', '>', $category_path);
2252
- //$category_path_skroutz = str_replace('&gt;','>',$category_path);
2253
 
2254
- if(!is_object($category_path)){
 
2255
  $product_data['category_path'] = $category_path;
2256
  $product_data['category_path_skroutz'] = $category_path_skroutz;
2257
  $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
@@ -2290,6 +2496,21 @@ class WooSEA_Get_Products {
2290
  }
2291
  }
2292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2293
  $product_data['category_path_short'] = str_replace("Home &gt;","",$product_data['category_path']);
2294
  $product_data['category_path_short'] = str_replace("&gt;",">",$product_data['category_path_short']);
2295
  $product_data['category_link'] = $catlink;
@@ -2325,6 +2546,10 @@ class WooSEA_Get_Products {
2325
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2326
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2327
 
 
 
 
 
2328
  /**
2329
  * Check of we need to add Google Analytics UTM parameters
2330
  */
@@ -2335,6 +2560,7 @@ class WooSEA_Get_Products {
2335
  }
2336
 
2337
  $product_data['link'] = get_permalink( $product_data['id'])."$utm_part";
 
2338
  $variable_link = htmlspecialchars(get_permalink( $product_data['id']));
2339
  $vlink_piece = explode("?", $variable_link);
2340
  $qutm_part = ltrim($utm_part, "&amp;");
@@ -2342,14 +2568,20 @@ class WooSEA_Get_Products {
2342
  $qutm_part = ltrim($qutm_part, "?");
2343
  if($qutm_part){
2344
  $product_data['variable_link'] = $vlink_piece[0]."?".$qutm_part;
 
2345
  } else {
2346
  $product_data['variable_link'] = $vlink_piece[0];
 
2347
  }
2348
 
2349
  $product_data['condition'] = ucfirst( get_post_meta( $product_data['id'], '_woosea_condition', true ) );
 
 
2350
  if(empty($product_data['condition']) || $product_data['condition'] == "Array"){
2351
  $product_data['condition'] = "New";
2352
  }
 
 
2353
  $product_data['availability'] = $this->get_stock( $this->childID );
2354
 
2355
  /**
@@ -2357,18 +2589,33 @@ class WooSEA_Get_Products {
2357
  * availability will always return out of stock, even when the stock quantity > 0
2358
  * Therefor, we need to check the stock_status and overwrite te availability value
2359
  */
2360
- $stock_status = $product->get_stock_status();
 
 
 
 
 
 
2361
  if ($stock_status == "outofstock"){
2362
  $product_data['availability'] = "out of stock";
 
 
 
2363
  } elseif ($stock_status == "onbackorder") {
2364
  $product_data['availability'] = "on backorder";
 
 
 
2365
  } else {
2366
  $product_data['availability'] = "in stock";
 
 
 
2367
  }
2368
 
2369
  $product_data['author'] = get_the_author();
2370
  $product_data['quantity'] = $this->clean_quantity( $this->childID, "_stock" );
2371
- $product_data['visibility'] = $this->get_attribute_value( $this->childID,"_visibility" );
2372
  $product_data['menu_order'] = get_post_field( 'menu_order', $product_data['id'] );
2373
  $product_data['currency'] = get_woocommerce_currency();
2374
  if(isset($project_config['WCML'])){
@@ -2385,10 +2632,38 @@ class WooSEA_Get_Products {
2385
  $product_data['image_all'] = $product_data['image'];
2386
  $product_data['all_images'] = $product_data['image'];
2387
  $product_data['all_gallery_images'] = "";
2388
-
2389
- // For variable products I need to get the product gallery images of the simple mother product
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2390
  if($product_data['item_group_id'] > 0){
2391
  $parent_product = wc_get_product( $product_data['item_group_id'] );
 
2392
  if(is_object($parent_product)){
2393
  $gallery_ids = $parent_product->get_gallery_image_ids();
2394
  $product_data['image_all'] = wp_get_attachment_url($parent_product->get_image_id());
@@ -2414,7 +2689,6 @@ class WooSEA_Get_Products {
2414
  $product_data['all_images'] = ltrim($product_data['all_images'],',');
2415
  $product_data['all_images_kogan'] = preg_replace( '/,/', '|', $product_data['all_images'] );
2416
  $product_data['all_gallery_images'] = ltrim($product_data['all_gallery_images'],',');
2417
- $product_data['product_type'] = $product->get_type();
2418
 
2419
  $product_data['content_type'] = "product";
2420
  if($product_data['product_type'] == "variation"){
@@ -2430,6 +2704,8 @@ class WooSEA_Get_Products {
2430
 
2431
  $product_data['shipping'] = 0;
2432
  $tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class() );
 
 
2433
  $shipping_class_id = $product->get_shipping_class_id();
2434
  $shipping_class= $product->get_shipping_class();
2435
 
@@ -2439,6 +2715,10 @@ class WooSEA_Get_Products {
2439
  }
2440
 
2441
  $product_data['shipping_label'] = $product->get_shipping_class();
 
 
 
 
2442
 
2443
  // Get product prices
2444
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
@@ -2448,32 +2728,58 @@ class WooSEA_Get_Products {
2448
  $product_data['regular_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_regular_price()));
2449
  $product_data['regular_price'] = wc_format_decimal($product_data['regular_price'],2);
2450
 
2451
- // Untouched raw system pricing - DO NOT CHANGE THESE
2452
- $product_data['system_net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
2453
- $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2454
- $product_data['system_regular_price'] = round($product->get_regular_price(),2);
2455
- $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2456
-
2457
- $product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2458
- $product_data['system_price'] = ($product->get_regular_price()) ? $this->get_product_price($product, $product->get_regular_price()) : '';
2459
- $product_data['system_price'] = wc_format_decimal($product_data['system_price'],2);
2460
-
2461
- $product_data['system_sale_price'] = wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price()));
2462
- $sale_price = $product_data['system_sale_price'];
2463
- //$product_data['system_sale_price'] = ($product->get_sale_price() != $sale_price) ? $this->get_product_price($product, $sale_price ) : '';
2464
- $product_data['system_sale_price'] = wc_format_decimal($product_data['system_sale_price'],2);
2465
-
2466
- if(!empty($tax_rates)){
2467
-
2468
- foreach ($tax_rates as $tk => $tv){
2469
- if($tv['rate'] > 0){
2470
- $tax_rates[1]['rate'] = $tv['rate'];
2471
- } else {
2472
- $tax_rates[1]['rate'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2473
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2474
  }
2475
- } else {
2476
- $tax_rates[1]['rate'] = 0;
2477
  }
2478
 
2479
  $fullrate = 100+$tax_rates[1]['rate'];
@@ -2485,6 +2791,7 @@ class WooSEA_Get_Products {
2485
  if($product->get_type() == "bundle"){
2486
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2487
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
 
2488
  if(is_numeric($tax_rates[1]['rate'])){
2489
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2490
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
@@ -2525,9 +2832,19 @@ class WooSEA_Get_Products {
2525
 
2526
  // Make sure the product ID is not NULL either
2527
  global $woocommerce_wpml;
2528
- if(!is_null($product_data['WCML'])){
2529
- $product_data['non_geo_wcml_price'] = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $product_data['id'], $project_config['WCML'] );
2530
- }
 
 
 
 
 
 
 
 
 
 
2531
 
2532
  // When WCML manual prices have been entered
2533
  if(!is_null($product_data['id'])){
@@ -2541,9 +2858,17 @@ class WooSEA_Get_Products {
2541
  $product_data['regular_price'] = $custom_prices['_regular_price'];
2542
  }
2543
 
2544
- if($custom_prices['_sale_price'] > 0){
2545
- $product_data['sale_price'] = $custom_prices['_sale_price'];
2546
- }
 
 
 
 
 
 
 
 
2547
  }
2548
  }
2549
 
@@ -2557,21 +2882,23 @@ class WooSEA_Get_Products {
2557
  }
2558
  if($product->get_regular_price()){
2559
  $product_data['regular_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())) * (100+$tax_rates[1]['rate'])/100,2);
2560
- $product_data['net_regular_price'] = ($product->get_regular_price()/$fullrate)*100;
2561
- $product_data['net_regular_price'] = round($product_data['net_regular_price'],2);
 
2562
  }
2563
  if($product->get_sale_price()){
2564
  $product_data['sale_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())) * (100+$tax_rates[1]['rate'])/100,2);
2565
- $product_data['net_sale_price'] = ($product->get_sale_price()/$fullrate)*100;
2566
- $product_data['net_sale_price'] = round($product_data['net_sale_price'],2);
2567
-
2568
  // We do not want to have 0 sale price values in the feed
2569
  if($product_data['net_sale_price'] == 0){
2570
  $product_data['net_sale_price'] = "";
2571
  }
2572
  }
2573
- $product_data['net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
2574
-
 
 
2575
  $price = wc_get_price_including_tax($product,array('price'=> $product->get_price()));
2576
  if($product_data['sale_price'] > 0){
2577
  $price = $product_data['sale_price'];
@@ -2581,7 +2908,11 @@ class WooSEA_Get_Products {
2581
  if ($this->woosea_is_plugin_active('woo-discount-rules/woo-discount-rules.php')){
2582
  $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $product_data['sale_price'], 'discounted_price', true, true);
2583
  if($discount !== false){
2584
- $product_data['sale_price'] = $discount;
 
 
 
 
2585
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2586
  if($price_incl_tax == "yes"){
2587
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
@@ -2602,9 +2933,6 @@ class WooSEA_Get_Products {
2602
  $from_currency = $project_config['base_currency'];
2603
  }
2604
 
2605
- //$product_data['price'] = apply_filters('wc_aelia_cs_convert', $product_data['price'], $from_currency, $project_config['AELIA']);
2606
- //$product_data['regular_price'] = apply_filters('wc_aelia_cs_convert', $product_data['regular_price'], $from_currency, $project_config['AELIA']);
2607
- //$product_data['sale_price'] = apply_filters('wc_aelia_cs_convert', $product_data['sale_price'], $from_currency, $project_config['AELIA']);
2608
  $product_data['price'] = apply_filters('wc_aelia_cs_convert', $product_data['price'], $from_currency, $project_config['AELIA']);
2609
  $product_data['regular_price'] = apply_filters('wc_aelia_cs_convert', $product_data['regular_price'], $from_currency, $project_config['AELIA']);
2610
  $product_data['sale_price'] = apply_filters('wc_aelia_cs_convert', $product_data['sale_price'], $from_currency, $project_config['AELIA']);
@@ -2690,6 +3018,24 @@ class WooSEA_Get_Products {
2690
  }
2691
  }
2692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2693
  // Localize the price attributes
2694
  $decimal_separator = wc_get_price_decimal_separator();
2695
  $product_data['price'] = wc_format_localized_price($product_data['price']);
@@ -2697,12 +3043,18 @@ class WooSEA_Get_Products {
2697
  $product_data['sale_price'] = wc_format_localized_price($product_data['sale_price']);
2698
  if($product->get_price()){
2699
  $product_data['price_forced'] = wc_format_localized_price($product_data['price_forced']);
 
 
2700
  }
2701
  if($product->get_regular_price()){
2702
  $product_data['regular_price_forced'] = wc_format_localized_price($product_data['regular_price_forced']);
 
 
2703
  }
2704
  if($product->get_sale_price()){
2705
  $product_data['sale_price_forced'] = wc_format_localized_price($product_data['sale_price_forced']);
 
 
2706
  }
2707
  $product_data['net_price'] = wc_format_localized_price($product_data['net_price']);
2708
 
@@ -2716,34 +3068,74 @@ class WooSEA_Get_Products {
2716
  $product_data['net_sale_price'] = wc_format_localized_price($product_data['net_sale_price']);
2717
  }
2718
 
2719
- $product_data['system_price'] = wc_format_localized_price($product_data['system_price']);
2720
- $product_data['system_net_price'] = wc_format_localized_price($product_data['system_net_price']);
2721
- $product_data['system_regular_price'] = wc_format_localized_price($product_data['system_regular_price']);
2722
- $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
 
 
 
 
 
 
 
2723
 
2724
- // Add rounded price options
2725
- $product_data['rounded_price'] = round($product_data['price']);
2726
- $product_data['rounded_regular_price'] = round($product_data['regular_price']);
2727
- $product_data['rounded_sale_price'] = round($product_data['sale_price']);
2728
 
2729
- // Calculate discount percentage
2730
- if($product_data['sale_price'] > 0){
2731
- $product_data['discount_percentage'] = round(100-(((float)$product_data['sale_price']/(float)$product_data['regular_price'])*100),2);
 
 
 
2732
  }
2733
 
2734
- foreach($project_config['attributes'] as $attr_key => $attr_arr){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2735
  if(is_array($attr_arr)){
2736
  if($attr_arr['attribute'] == "g:shipping"){
2737
  if($product_data['price'] > 0){
2738
- $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2739
  $shipping_str = $product_data['shipping'];
2740
  }
2741
  }
2742
  }
2743
  }
2744
 
2745
- if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi")){
2746
- $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2747
  $shipping_str = $product_data['shipping'];
2748
  }
2749
 
@@ -2751,7 +3143,8 @@ class WooSEA_Get_Products {
2751
  if(!empty($shipping_str)){
2752
  $product_data['shipping_price'] = 0;
2753
  }
2754
- $shipping_arr = $product_data['shipping'];
 
2755
 
2756
  if(is_array($shipping_arr)){
2757
  foreach($shipping_arr as $akey => $arr){
@@ -2759,6 +3152,7 @@ class WooSEA_Get_Products {
2759
  $pieces_ship = explode (" ", $arr['price']);
2760
  if(isset($pieces_ship['1'])){
2761
  $product_data['shipping_price'] = $pieces_ship['1'];
 
2762
  }
2763
  }
2764
 
@@ -2773,6 +3167,28 @@ class WooSEA_Get_Products {
2773
  }
2774
  }
2775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2776
  // Google Dynamic Remarketing feeds require the English price notation
2777
  if ($project_config['name'] == "Google Remarketing - DRM"){
2778
  $thousand_separator = wc_get_price_thousand_separator();
@@ -2838,7 +3254,7 @@ class WooSEA_Get_Products {
2838
 
2839
  foreach($diff_taxonomies as $taxo){
2840
  $term_value = get_the_terms($product_data['id'], $taxo);
2841
- $product_data[$taxo] = "";
2842
 
2843
  if(is_array($term_value)){
2844
  // Do not add variation values to the feed when they are out of stock
@@ -2848,7 +3264,7 @@ class WooSEA_Get_Products {
2848
  $variations = $product_skroutz->get_available_variations();
2849
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
2850
  $skroutz_att_array = array();
2851
-
2852
  foreach($variations_id as $var_id){
2853
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
2854
  if($stock_value == "instock"){
@@ -2862,12 +3278,13 @@ class WooSEA_Get_Products {
2862
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
2863
  }
2864
  }
2865
-
2866
  foreach($skroutz_att_array as $skrtz_value){
2867
  $product_data[$taxo] .= ",". $skrtz_value;
2868
  }
2869
  $product_data[$taxo] = ltrim($product_data[$taxo],',');
2870
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
 
2871
  } else {
2872
  // Simple Skroutz product
2873
  foreach($term_value as $term){
@@ -2910,64 +3327,100 @@ class WooSEA_Get_Products {
2910
  /**
2911
  * Get Custom Attributes for Single, Bundled and Composite products
2912
  */
2913
- if (($product->is_type('simple')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('external')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product_data['product_type'] == "variable") OR ($product_data['product_type'] == "auction") OR ($product->is_type('subscription'))){
2914
  $custom_attributes = $this->get_custom_attributes( $product_data['id'] );
2915
 
2916
- if(!in_array("woosea optimized title", $custom_attributes)){
2917
- $woosea_opt = array (
2918
- "_woosea_optimized_title" => "woosea optimized title",
2919
- );
2920
- $custom_attributes = array_merge($custom_attributes, $woosea_opt);
2921
- }
2922
 
2923
- if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
2924
- $custom_attributes['_aioseop_title'] = "All in one seo pack title";
2925
- $custom_attributes['_aioseop_description'] = "All in one seo pack description";
2926
- }
2927
 
2928
- foreach($custom_attributes as $custom_kk => $custom_vv){
2929
- $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
2930
- $new_key ="custom_attributes_" . $custom_kk;
2931
-
2932
- // Just to make sure the title is never empty
2933
- if(($custom_kk == "_aioseop_title") && ($custom_value == "")){
2934
- $custom_value = $product_data['title'];
2935
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2936
 
2937
- // Just to make sure the description is never empty
2938
- if(($custom_kk == "_aioseop_description") && ($custom_value == "")){
2939
- $custom_value = $product_data['description'];
2940
- }
2941
 
2942
- // Just to make sure product names are never empty
2943
- if(($custom_kk == "_woosea_optimized_title") && ($custom_value == "")){
2944
- $custom_value = $product_data['title'];
2945
- }
2946
 
2947
- // Just to make sure the condition field is never empty
2948
- if(($custom_kk == "_woosea_condition") && ($custom_value == "")){
2949
- $custom_value = $product_data['condition'];
2950
- }
2951
 
2952
- // Need to clean up the strange price Rightpress is returning
2953
- if ($this->woosea_is_plugin_active('wc-dynamic-pricing-and-discounts/wc-dynamic-pricing-and-discounts.php')){
2954
- if($custom_kk == "rp_wcdpd_price_cache"){
2955
- if((isset($project_config['AELIA'])) AND (!empty($GLOBALS['woocommerce-aelia-currencyswitcher'])) AND (get_option ('add_aelia_support') == "yes")){
2956
- $product_data['price'] = do_shortcode('[aelia_cs_product_price product_id="'.$product_data['id'].'" formatted="0" currency="'.$project_config['AELIA'].'"]');
2957
- $product_data['sale_price'] = apply_filters('wc_aelia_cs_convert', $custom_value['sale_price']['p'], $from_currency, $project_config['AELIA']);
2958
- } else {
2959
- if(array_key_exists("price", $custom_value)){
2960
- $product_data['price'] = $custom_value['price']['p'];
2961
- }
2962
 
2963
- if(array_key_exists("sale_price", $custom_value)){
2964
- $product_data['sale_price'] = $custom_value['sale_price']['p'];
2965
- }
 
2966
  }
2967
  }
 
 
2968
  }
2969
- $product_data[$new_key] = $custom_value;
2970
- }
2971
 
2972
  /**
2973
  * We need to check if this product has individual custom product attributes
@@ -2977,7 +3430,7 @@ class WooSEA_Get_Products {
2977
  $data = $wpdb->get_results($sql);
2978
  if (count($data)) {
2979
  foreach ($data as $key => $value) {
2980
- $value_display = str_replace("_", " ",$value->name);
2981
  if (preg_match("/_product_attributes/i",$value->name)){
2982
  $product_attr = unserialize($value->type);
2983
  if(!empty($product_attr)){
@@ -2995,14 +3448,14 @@ class WooSEA_Get_Products {
2995
 
2996
  /**
2997
  * Get Product Attributes for Single products
 
2998
  */
2999
- if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')))){
3000
  $single_attributes = $product->get_attributes();
3001
-
3002
  foreach ($single_attributes as $attribute){
3003
- $attr_name = strtolower($attribute->get_name());
3004
- $attr_value = $product->get_attribute($attr_name);
3005
- $product_data[$attr_name] = $attr_value;
3006
  }
3007
  }
3008
 
@@ -3015,9 +3468,6 @@ class WooSEA_Get_Products {
3015
  }
3016
  }
3017
 
3018
- // Get product reviews for Google Product Review Feeds
3019
- // $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3020
-
3021
  /**
3022
  * Versioned products need a seperate approach
3023
  * Get data for these products based on the mother products item group id
@@ -3028,9 +3478,9 @@ class WooSEA_Get_Products {
3028
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3029
  $variations = $product_variations->get_variation_attributes();
3030
 
3031
- // For Skroutz apparal products we can only append colours to the product name
3032
  // When a product has both a size and color attribute we assume its an apparal product
3033
- if($project_config['fields'] == "skroutz"){
3034
  $size_found = "no";
3035
  $color_found = "no";
3036
 
@@ -3064,7 +3514,7 @@ class WooSEA_Get_Products {
3064
  if(isset($sz_attribute)){
3065
  $skroutz_size = get_post_meta( $product_data['id'], "attribute_".$sz_attribute, true );
3066
  }
3067
-
3068
  if((!empty($skroutz_color)) AND (!empty($skroutz_size))){
3069
 
3070
  foreach($variations as $kvar => $vvar){
@@ -3106,23 +3556,31 @@ class WooSEA_Get_Products {
3106
  }
3107
  }
3108
 
3109
-
3110
-
3111
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
3112
-
3113
  // Determine the default variation product
3114
  if( ($product_data['item_group_id'] > 0) AND (is_object(wc_get_product( $product_data['item_group_id']))) AND (($product_data['product_type'] == "variation") OR ($product_data['product_type'] == "subscription_variation"))){
3115
- $mother_product = wc_get_product($product_data['item_group_id']);
3116
- $def_attributes = $mother_product->get_default_attributes();
 
3117
 
3118
  if(isset($project_config['lowest_price_variations'])){
3119
-
3120
  // Determine lowest priced variation
3121
  $variation_min_price = $mother_product->get_variation_price('min');
3122
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3123
  $variation_min_price = wc_format_localized_price($variation_min_price);
 
 
 
 
 
 
 
 
 
 
3124
 
3125
- if($product_data['system_net_price'] == $variation_min_price){
3126
  $variation_pass = "true";
3127
  } else {
3128
  $variation_pass = "false";
@@ -3260,19 +3718,21 @@ class WooSEA_Get_Products {
3260
  /**
3261
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3262
  */
 
 
3263
  foreach($diff_taxonomies as $taxo){
3264
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3265
  unset($product_data[$taxo]);
3266
  if(is_array($term_value)){
3267
  foreach($term_value as $term){
3268
  if(empty($product_data[$taxo])){
3269
- $product_data[$taxo] = $term->name;
3270
  } else {
3271
- $product_data[$taxo] .= " ".$term->name;
3272
  }
3273
  }
3274
  }
3275
- }
3276
 
3277
  /**
3278
  * Add product tags to the product data array
@@ -3292,6 +3752,7 @@ class WooSEA_Get_Products {
3292
 
3293
  // Add attribute values to the variation product names to make them unique
3294
  $product_data['title_hyphen'] = $product_data['title']." - ";
 
3295
 
3296
  foreach($variations as $kk => $vv){
3297
  $custom_key = $kk;
@@ -3325,7 +3786,6 @@ class WooSEA_Get_Products {
3325
  /**
3326
  * Get Custom Attributes for this variable product
3327
  */
3328
-
3329
  $custom_attributes = $this->get_custom_attributes( $product_data['id'] );
3330
 
3331
  if(!in_array("woosea optimized title", $custom_attributes)){
@@ -3339,7 +3799,28 @@ class WooSEA_Get_Products {
3339
  $custom_attributes['_aioseop_title'] = "All in one seo pack title";
3340
  $custom_attributes['_aioseop_description'] = "All in one seo pack description";
3341
  }
3342
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3343
  foreach($custom_attributes as $custom_kk => $custom_vv){
3344
  $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
3345
 
@@ -3371,7 +3852,7 @@ class WooSEA_Get_Products {
3371
  $new_key = str_replace("var","product",$new_key);
3372
  if(!empty( $custom_value )){
3373
  $product_data[$new_key] = $custom_value;
3374
- }
3375
  }
3376
  }
3377
 
@@ -3386,7 +3867,7 @@ class WooSEA_Get_Products {
3386
  $value_display = str_replace("_", " ",$value->name);
3387
  if (preg_match("/_product_attributes/i",$value->name)){
3388
  $product_attr = unserialize($value->type);
3389
- if(!empty($product_attr)){
3390
  foreach ($product_attr as $key => $arr_value) {
3391
  $new_key ="custom_attributes_" . $key;
3392
  $product_data[$new_key] = $arr_value['value'];
@@ -3401,6 +3882,27 @@ class WooSEA_Get_Products {
3401
  */
3402
  $custom_attributes_mother = $this->get_custom_attributes( $product_data['item_group_id'] );
3403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3404
  foreach($custom_attributes_mother as $custom_kk_m => $custom_value_m){
3405
 
3406
  if(!array_key_exists($custom_kk_m, $product_data)){
@@ -3440,14 +3942,61 @@ class WooSEA_Get_Products {
3440
  * we will add CDATA brackets to the title and description attributes
3441
  */
3442
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
3443
- //$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3444
- //$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
 
 
 
 
 
 
 
3445
 
3446
  /**
3447
  * Get product reviews for Google Product Review Feeds
3448
  */
3449
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3451
  /**
3452
  * Check if individual products need to be excluded
3453
  */
@@ -3492,6 +4041,10 @@ class WooSEA_Get_Products {
3492
  $product_data = $this->woocommerce_sea_filters( $project_config['rules'], $product_data );
3493
  }
3494
  }
 
 
 
 
3495
 
3496
  // Check if the sale price is effective
3497
  if(isset($product_data['sale_price_start_date'])){
@@ -3513,16 +4066,19 @@ class WooSEA_Get_Products {
3513
  // For these channels parent products are allowed
3514
  $allowed_channel_parents = array(
3515
  "skroutz",
 
3516
  "google_dsa",
3517
  "google_product_review",
3518
  );
3519
 
3520
- if (!in_array($project_config['fields'], $allowed_channel_parents)){
3521
- if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
3522
- $product_data = array();
3523
- $product_data = null;
3524
- }
3525
- }
 
 
3526
 
3527
  /**
3528
  * Remove variation products that are not THE default variation product
@@ -3535,7 +4091,7 @@ class WooSEA_Get_Products {
3535
  /**
3536
  * And item_group_id is not allowed for simple products, prevent users from adding this to the feedd
3537
  */
3538
- if($product->is_type('simple') OR ($product->is_type('auction'))){
3539
  unset($product_data['item_group_id']);
3540
  }
3541
 
@@ -3549,6 +4105,91 @@ class WooSEA_Get_Products {
3549
  }
3550
  }
3551
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3552
  /**
3553
  * When product has passed the filter rules it can continue with the rest
3554
  */
@@ -3582,7 +4223,7 @@ class WooSEA_Get_Products {
3582
  }
3583
  } else {
3584
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
3585
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3586
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3587
  } else {
3588
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
@@ -3654,7 +4295,7 @@ class WooSEA_Get_Products {
3654
  }
3655
  } else {
3656
  if(strlen($product_data[$attr_value['mapfrom']])){
3657
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3658
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3659
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3660
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
@@ -3838,6 +4479,7 @@ class WooSEA_Get_Products {
3838
  $shipping_str .= ":WOOSEA_POSTAL_CODE##$v";
3839
  } elseif ($k == "price"){
3840
  $shipping_str .= ":WOOSEA_PRICE##$attr_value[prefix] $v $attr_value[suffix]";
 
3841
  } else {
3842
  // UNKNOWN, DO NOT ADD
3843
  }
@@ -3874,7 +4516,7 @@ class WooSEA_Get_Products {
3874
  }
3875
  } else {
3876
  if(strlen($product_data[$attr_value['mapfrom']])){
3877
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
3878
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3879
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3880
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
@@ -4144,9 +4786,9 @@ class WooSEA_Get_Products {
4144
  }
4145
  // New policy of Google, only when the value is yes add it to the feed
4146
  // 28 October 2019
4147
- // if($identifier_exists == "yes"){
4148
  $xml_product['g:identifier_exists'] = $identifier_exists;
4149
- //}
4150
  }
4151
  return $xml_product;
4152
  }
@@ -4404,479 +5046,485 @@ class WooSEA_Get_Products {
4404
  return $product_data;
4405
  }
4406
 
4407
- /**
4408
- * Execute project rules
4409
- */
4410
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4411
  $aantal_prods = count($product_data);
4412
- if($aantal_prods > 0){
4413
 
4414
- foreach ($project_rules2 as $pr_key => $pr_array){
4415
 
4416
- foreach ($product_data as $pd_key => $pd_value){
4417
 
4418
- // Check is there is a rule on specific attributes
4419
- if($pd_key == $pr_array['attribute']){
4420
-
4421
- // This is because for data manipulation the than attribute is empty
4422
- if(!array_key_exists('than_attribute', $pr_array)){
4423
- $pr_array['than_attribute'] = $pd_key;
4424
- }
4425
 
4426
  // Check if a rule has been set for Google categories
4427
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4428
-
4429
- $pr_array['than_attribute'] = "categories";
4430
  $category_id = explode("-", $pr_array['newvalue']);
4431
  $pr_array['newvalue'] = $category_id[0];
4432
- $product_data['categories'] = $pr_array['newvalue'];
4433
- }
4434
 
4435
- // Make sure that rules on numerics are on true numerics
4436
- if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4437
- $pd_value = strtr($pd_value, ',', '.');
4438
- }
4439
 
4440
 
4441
- // Make sure the price or sale price is numeric
4442
- if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4443
- settype($pd_value, "double");
4444
- }
4445
 
4446
- if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4447
 
4448
- // Rules for numeric values
4449
- switch ($pr_array['condition']) {
4450
- case($pr_array['condition'] = "contains"):
4451
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4452
- $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4453
- }
4454
- break;
4455
- case($pr_array['condition'] = "containsnot"):
4456
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4457
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4458
- }
4459
- break;
4460
- case($pr_array['condition'] = "="):
4461
- if (($pd_value == $pr_array['criteria'])){
4462
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4463
- }
4464
- break;
4465
- case($pr_array['condition'] = "!="):
4466
- if (($pd_value != $pr_array['criteria'])){
4467
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4468
- }
4469
- break;
4470
- case($pr_array['condition'] = ">"):
4471
- if (($pd_value > $pr_array['criteria'])){
4472
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4473
- }
4474
- break;
4475
- case($pr_array['condition'] = ">="):
4476
- if (($pd_value >= $pr_array['criteria'])){
4477
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4478
- }
4479
- break;
4480
- case($pr_array['condition'] = "<"):
4481
- if (($pd_value < $pr_array['criteria'])){
4482
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4483
- }
4484
- break;
4485
- case($pr_array['condition'] = "=<"):
4486
- if (($pd_value <= $pr_array['criteria'])){
4487
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4488
- }
4489
- break;
4490
- case($pr_array['condition'] = "empty"):
4491
- if(empty($product_data[$pr_array['attribute']])){
4492
- if ((strlen($pd_value) < 1)){
4493
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4494
- } else {
4495
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4496
- }
4497
- }
4498
- break;
4499
- case($pr_array['condition'] = "multiply"):
4500
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4501
- $convert_back = "false";
4502
- $pos = strpos($pd_value, ',');
4503
- if($pos !== false){
4504
- $convert_back = "true";
4505
- }
4506
- $pd_value = strtr($pd_value, ',', '.');
4507
- $newvalue = $pd_value*$pr_array['criteria'];
4508
- $newvalue = round($newvalue, 2);
4509
- if($convert_back == "true"){
4510
- $newvalue = strtr($newvalue, '.',',');
4511
- }
4512
- $product_data[$pr_array['attribute']] = $newvalue;
4513
- break;
4514
- case($pr_array['condition'] = "divide"):
4515
- $newvalue = ($pd_value / $pr_array['criteria']);
4516
- $newvalue = round($newvalue, 2);
4517
- $newvalue = strtr($newvalue, '.',',');
4518
- $product_data[$pr_array['attribute']] = $newvalue;
4519
- break;
4520
- case($pr_array['condition'] = "plus"):
4521
- $newvalue = ($pd_value + $pr_array['criteria']);
4522
- $product_data[$pr_array['attribute']] = $newvalue;
4523
- break;
4524
- case($pr_array['condition'] = "minus"):
4525
- $newvalue = ($pd_value - $pr_array['criteria']);
4526
- $product_data[$pr_array['attribute']] = $newvalue;
4527
- break;
4528
- case($pr_array['condition'] = "findreplace"):
4529
- if (strpos($pd_value, $pr_array['criteria']) !== false){
4530
  // Make sure that a new value has been set
4531
- if(!empty($pr_array['newvalue'])){
4532
- // Find and replace only work on same attribute field, otherwise create a contains rule
4533
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4534
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4535
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4536
  }
4537
- }
4538
- }
4539
- break;
4540
- default:
4541
- break;
4542
- }
4543
- } elseif (is_array($pd_value)) {
4544
-
4545
- // For now only shipping details are in an array
4546
- foreach ($pd_value as $k => $v){
4547
- if(is_array($v)){
4548
- foreach ($v as $kk => $vv){
4549
- // Only shipping detail rule can be on price for now
4550
- if($kk == "price"){
4551
- switch ($pr_array['condition']) {
4552
- case($pr_array['condition'] = "contains"):
4553
- if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4554
- $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4555
- $product_data[$pr_array['than_attribute']] = $pd_value;
4556
- }
4557
- break;
4558
- case($pr_array['condition'] = "containsnot"):
4559
- if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4560
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4561
- $product_data[$pr_array['than_attribute']] = $pd_value;
4562
- }
4563
- break;
4564
- case($pr_array['condition'] = "="):
4565
- if (($vv == $pr_array['criteria'])){
4566
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4567
- $product_data[$pr_array['than_attribute']] = $pd_value;
4568
- }
4569
- break;
4570
- case($pr_array['condition'] = "!="):
4571
- if (($vv != $pr_array['criteria'])){
4572
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4573
- $product_data[$pr_array['than_attribute']] = $pd_value;
4574
- }
4575
- break;
4576
- case($pr_array['condition'] = ">"):
4577
- if (($vv > $pr_array['criteria'])){
4578
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4579
- $product_data[$pr_array['than_attribute']] = $pd_value;
4580
- }
4581
- break;
4582
- case($pr_array['condition'] = ">="):
4583
- if (($vv >= $pr_array['criteria'])){
4584
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4585
- $product_data[$pr_array['than_attribute']] = $pd_value;
4586
- }
4587
- break;
4588
- case($pr_array['condition'] = "<"):
4589
- if (($vv < $pr_array['criteria'])){
4590
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4591
- $product_data[$pr_array['than_attribute']] = $pd_value;
4592
- }
4593
- break;
4594
- case($pr_array['condition'] = "=<"):
4595
- if (($vv <= $pr_array['criteria'])){
4596
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4597
- $product_data[$pr_array['than_attribute']] = $pd_value;
4598
- }
4599
- break;
4600
- case($pr_array['condition'] = "empty"):
4601
- if ((strlen($vv) < 1)){
4602
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4603
- $product_data[$pr_array['than_attribute']] = $pd_value;
4604
- }
4605
- break;
4606
- case($pr_array['condition'] = "multiply"):
4607
- // Only shipping array
4608
- if(is_array($pd_value)){
4609
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4610
- foreach ($pd_value as $ship_a_key => $shipping_arr){
4611
- foreach($shipping_arr as $ship_key => $ship_value){
4612
- if($ship_key == "price"){
4613
- $ship_pieces = explode(" ", $ship_value);
4614
- $pd_value = strtr($ship_pieces[1], ',', '.');
4615
- $newvalue = $pd_value*$pr_array['criteria'];
4616
- $newvalue = round($newvalue, 2);
4617
- $newvalue = strtr($newvalue, '.',',');
4618
- $newvalue = $ship_pieces[0]." ".$newvalue;
4619
- $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4620
- }
4621
- }
4622
- }
4623
- }
4624
- break;
4625
- default:
4626
- break;
4627
- }
4628
- }
4629
- }
4630
- } else {
4631
- // Rules on product tags
4632
- foreach ($pd_value as $k => $v){
4633
-
4634
- // Rules for string values
4635
- if (!array_key_exists('cs', $pr_array)){
4636
- $v = strtolower($v);
4637
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
4638
- }
4639
-
4640
- switch ($pr_array['condition']) {
4641
- case($pr_array['condition'] = "contains"):
4642
- if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
4643
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4644
- }
4645
- break;
4646
- case($pr_array['condition'] = "containsnot"):
4647
- if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
4648
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4649
- }
4650
- break;
4651
- case($pr_array['condition'] = "="):
4652
- if (($v == $pr_array['criteria'])){
4653
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4654
- }
4655
- break;
4656
- case($pr_array['condition'] = "!="):
4657
- if (($v != $pr_array['criteria'])){
4658
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4659
- }
4660
- break;
4661
- case($pr_array['condition'] = ">"):
4662
- if (($v > $pr_array['criteria'])){
4663
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4664
- }
4665
- break;
4666
- case($pr_array['condition'] = ">="):
4667
- if (($v >= $pr_array['criteria'])){
4668
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4669
- }
4670
- break;
4671
- case($pr_array['condition'] = "<"):
4672
- if (($v < $pr_array['criteria'])){
4673
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4674
- }
4675
- break;
4676
- case($pr_array['condition'] = "=<"):
4677
- if (($v <= $pr_array['criteria'])){
4678
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4679
- }
4680
- break;
4681
- case($pr_array['condition'] = "empty"):
4682
- if ((strlen($v) < 1)){
4683
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4684
- }
4685
- break;
4686
- case($pr_array['condition'] = "multiply"):
4687
- // Only shipping array
4688
- if(is_array($v)){
4689
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4690
- foreach ($v as $ship_a_key => $shipping_arr){
4691
- foreach($shipping_arr as $ship_key => $ship_value){
4692
- if($ship_key == "price"){
4693
- $ship_pieces = explode(" ", $ship_value);
4694
- $pd_value = strtr($ship_pieces[1], ',', '.');
4695
- $newvalue = $pd_value*$pr_array['criteria'];
4696
- $newvalue = round($newvalue, 2);
4697
- $newvalue = strtr($newvalue, '.',',');
4698
- $newvalue = $ship_pieces[0]." ".$newvalue;
4699
- $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4700
- }
4701
- }
4702
- }
4703
- }
4704
- break;
4705
- default:
4706
- break;
4707
- }
4708
- }
4709
- }
4710
- }
4711
- } else {
4712
- // Rules for string values
4713
- if (!array_key_exists('cs', $pr_array)){
4714
- $pd_value = strtolower($pd_value);
4715
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
4716
- }
4717
-
4718
- switch ($pr_array['condition']) {
4719
- case($pr_array['condition'] = "contains"):
4720
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4721
- // Specifically for shipping price rules
4722
- if(!empty($product_data[$pr_array['than_attribute']])){
4723
- if(is_array($product_data[$pr_array['than_attribute']])){
4724
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4725
- for ($x = 0; $x <= $arr_size; $x++) {
4726
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4727
- }
4728
- } else {
4729
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4730
- }
4731
- } else {
4732
- // This attribute value is empty for this product
4733
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4734
- }
4735
- }
4736
- break;
4737
- case($pr_array['condition'] = "containsnot"):
4738
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4739
- // Specifically for shipping price rules
4740
- if(is_array($product_data[$pr_array['than_attribute']])){
4741
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4742
- for ($x = 0; $x <= $arr_size; $x++) {
4743
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4744
- }
4745
- } else {
4746
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4747
- }
4748
- }
4749
- break;
4750
- case($pr_array['condition'] = "="):
4751
- if (($pr_array['criteria'] == "$pd_value")){
4752
- // Specifically for shipping price rules
4753
- if(is_array($product_data[$pr_array['than_attribute']])){
4754
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4755
- for ($x = 0; $x <= $arr_size; $x++) {
4756
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4757
- }
4758
- } else {
4759
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4760
- }
4761
- }
4762
- $ship = $product_data['shipping'];
4763
- break;
4764
- case($pr_array['condition'] = "!="):
4765
- if (($pr_array['criteria'] != "$pd_value")){
4766
- // Specifically for shipping price rules
4767
- if(is_array($product_data[$pr_array['than_attribute']])){
4768
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4769
- for ($x = 0; $x <= $arr_size; $x++) {
4770
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4771
- }
4772
- } else {
4773
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4774
- }
4775
- }
4776
- break;
4777
- case($pr_array['condition'] = ">"):
4778
- // Use a lexical order on relational string operators
4779
- if (($pd_value > $pr_array['criteria'])){
4780
- // Specifically for shipping price rules
4781
- if(is_array($product_data[$pr_array['than_attribute']])){
4782
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4783
- for ($x = 0; $x <= $arr_size; $x++) {
4784
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4785
- }
4786
- } else {
4787
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4788
- }
4789
- }
4790
- break;
4791
- case($pr_array['condition'] = ">="):
4792
- // Use a lexical order on relational string operators
4793
- if (($pd_value >= $pr_array['criteria'])){
4794
- // Specifically for shipping price rules
4795
- if(is_array($product_data[$pr_array['than_attribute']])){
4796
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4797
- for ($x = 0; $x <= $arr_size; $x++) {
4798
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4799
- }
4800
- } else {
4801
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4802
- }
4803
- }
4804
- break;
4805
- case($pr_array['condition'] = "<"):
4806
- // Use a lexical order on relational string operators
4807
- if (($pd_value < $pr_array['criteria'])){
4808
- // Specifically for shipping price rules
4809
- if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
4810
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4811
- for ($x = 0; $x <= $arr_size; $x++) {
4812
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4813
- }
4814
- } else {
4815
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4816
- }
4817
- }
4818
- break;
4819
- case($pr_array['condition'] = "=<"):
4820
- // Use a lexical order on relational string operators
4821
- if (($pd_value <= $pr_array['criteria'])){
4822
- // Specifically for shipping price rules
4823
- if(is_array($product_data[$pr_array['than_attribute']])){
4824
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4825
- for ($x = 0; $x <= $arr_size; $x++) {
4826
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4827
- }
4828
- } else {
4829
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4830
- }
4831
- }
4832
- break;
4833
 
4834
- case($pr_array['condition'] = "empty"):
4835
- if(empty($product_data[$pr_array['attribute']])){
4836
- if(empty($product_data[$pr_array['than_attribute']])){
4837
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4838
- } else {
4839
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4840
- }
4841
- }
4842
- break;
4843
- case($pr_array['condition'] = "replace"):
4844
- $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
4845
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4846
  case($pr_array['condition'] = "findreplace"):
4847
  if (strpos($pd_value, $pr_array['criteria']) !== false){
4848
- // Make sure that a new value has been set
4849
- if(!empty($pr_array['newvalue'])){
4850
- // Find and replace only work on same attribute field, otherwise create a contains rule
4851
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4852
- $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4853
- $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4854
- }
4855
- }
4856
- }
 
4857
  break;
4858
- default:
4859
- break;
4860
- }
4861
- }
4862
- } else {
4863
- // When a rule has been set on an attribute that is not in product_data
4864
- // Add the newvalue to product_data
4865
- if (!array_key_exists($pr_array['attribute'], $product_data)){
4866
  if(!empty($pr_array['newvalue'])){
4867
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
 
 
4868
  } else {
4869
- if(array_key_exists($pr_array['than_attribute'], $product_data)){
4870
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
 
 
4871
  }
4872
- }
4873
- }
4874
- }
4875
- }
4876
- }
4877
- }
4878
- return $product_data;
4879
- }
4880
 
4881
  /**
4882
  * Function to exclude products based on individual product exclusions
@@ -4899,525 +5547,574 @@ class WooSEA_Get_Products {
4899
  }
4900
  }
4901
 
4902
- /**
4903
- * Execute project filters (include / exclude)
4904
- */
 
4905
  private function woocommerce_sea_filters( $project_rules, $product_data ){
4906
- $allowed = 1;
4907
 
4908
- // Check if product was already excluded from the feed
4909
- $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
4910
 
4911
- if( $product_excluded == "Yes"){
4912
- $allowed = 0;
4913
- }
4914
 
4915
- foreach ($project_rules as $pr_key => $pr_array){
4916
 
4917
- if($pr_array['attribute'] == "categories"){
4918
- $pr_array['attribute'] = "raw_categories";
4919
  }
4920
 
4921
- //if(array_key_exists($pr_array['attribute'], $product_data)){
4922
-
4923
- if(!array_key_exists($pr_array['attribute'], $product_data)) {
4924
- $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
4925
- }
4926
 
4927
- foreach ($product_data as $pd_key => $pd_value){
4928
- // Check is there is a rule on specific attributes
 
 
 
 
 
4929
 
4930
- if(in_array($pd_key, $pr_array, TRUE)){
 
 
 
 
4931
 
4932
- if($pd_key == "price"){
4933
- //$pd_value = @number_format($pd_value,2);
4934
- $pd_value = wc_format_decimal($pd_value);
4935
- }
4936
-
4937
- if (is_numeric($pd_value)){
4938
- $old_value = $pd_value;
4939
- if($pd_key == "price"){
4940
- $pd_value = @number_format($pd_value,2);
4941
- }
4942
-
4943
- // Rules for numeric values
4944
- switch ($pr_array['condition']) {
4945
- case($pr_array['condition'] = "contains"):
4946
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
4947
- $allowed = 0;
4948
- } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
4949
- $allowed = 0;
4950
- }
4951
- break;
4952
- case($pr_array['condition'] = "containsnot"):
4953
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
4954
- $allowed = 0;
4955
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
4956
- $allowed = 0;
4957
- }
4958
- break;
4959
  case($pr_array['condition'] = "="):
4960
- if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4961
- $allowed = 0;
4962
- } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4963
- $allowed = 0;
4964
- }
4965
- break;
4966
- case($pr_array['condition'] = "!="):
4967
- if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4968
- if($allowed <> 0){
4969
- $allowed = 1;
4970
- }
4971
- } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4972
- $allowed = 0;
4973
- }
4974
- break;
4975
- case($pr_array['condition'] = ">"):
4976
- if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4977
- $allowed = 0;
4978
- } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4979
- $allowed = 0;
4980
- }
4981
- break;
4982
- case($pr_array['condition'] = ">="):
4983
- if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4984
- $allowed = 0;
4985
- } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4986
- $allowed = 0;
4987
- }
4988
- break;
4989
- case($pr_array['condition'] = "<"):
4990
- if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4991
- $allowed = 0;
4992
- } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4993
- $allowed = 0;
4994
- }
4995
- break;
4996
- case($pr_array['condition'] = "=<"):
4997
- if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4998
- $allowed = 0;
4999
- } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5000
- $allowed = 0;
5001
- }
5002
- break;
5003
- case($pr_array['condition'] = "empty"):
5004
- if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5005
- $allowed = 0;
5006
- } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5007
- $allowed = 0;
5008
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5009
  break;
5010
- default:
 
 
 
 
 
5011
  break;
5012
- }
5013
- } elseif (is_array($pd_value)){
5014
- // Tis can either be a shipping or product_tag array
5015
- if($pr_array['attribute'] == "product_tag"){
5016
- $in_tag_array = "not";
5017
-
5018
- foreach($pd_value as $pt_key => $pt_value){
5019
- // Rules for string values
5020
- if (!array_key_exists('cs', $pr_array)){
5021
- $pt_value = strtolower($pt_value);
5022
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
5023
- }
5024
-
5025
- if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5026
- $in_tag_array = "yes";
5027
- }
5028
- }
5029
-
5030
- if($in_tag_array == "yes"){
5031
- //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5032
- $v = $pr_array['criteria'];
5033
-
5034
- switch ($pr_array['condition']) {
5035
- case($pr_array['condition'] = "contains"):
5036
- if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5037
- if($pr_array['than'] == "include_only"){
5038
- if($allowed <> 0){
5039
- $allowed = 1;
5040
- }
5041
- } else {
5042
- $allowed = 0;
5043
- }
5044
- } else {
5045
- $allowed = 0;
5046
- }
5047
- break;
5048
- case($pr_array['condition'] = "containsnot"):
5049
- if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5050
- if($pr_array['than'] == "include_only"){
5051
- if($allowed <> 0){
5052
- $allowed = 1;
5053
- }
5054
- } else {
5055
- $allowed = 0;
5056
- }
5057
- } else {
5058
- $allowed = 0;
5059
- }
5060
- break;
5061
- case($pr_array['condition'] = "="):
5062
- if (($v == $pr_array['criteria'])){
5063
- if($pr_array['than'] == "include_only"){
5064
- if($allowed <> 0){
5065
- $allowed = 1;
5066
- }
5067
- } else {
5068
- $allowed = 0;
5069
- }
5070
- } else {
5071
- $allowed = 0;
5072
- }
5073
- break;
5074
- case($pr_array['condition'] = "!="):
5075
- if (($v != $pr_array['criteria'])){
5076
- if($pr_array['than'] == "include_only"){
5077
- if($allowed <> 0){
5078
- $allowed = 1;
5079
- }
5080
- } else {
5081
- $allowed = 0;
5082
- }
5083
- }
5084
- break;
5085
- case($pr_array['condition'] = ">"):
5086
- if (($v > $pr_array['criteria'])){
5087
- if($pr_array['than'] == "include_only"){
5088
- if($allowed <> 0){
5089
- $allowed = 1;
5090
- }
5091
- } else {
5092
- $allowed = 0;
5093
- }
5094
- }
5095
- break;
5096
- case($pr_array['condition'] = ">="):
5097
- if (($v >= $pr_array['criteria'])){
5098
- if($pr_array['than'] == "include_only"){
5099
- if($allowed <> 0){
5100
- $allowed = 1;
5101
- }
5102
- } else {
5103
- $allowed = 0;
5104
- }
5105
- }
5106
- break;
5107
- case($pr_array['condition'] = "<"):
5108
- if (($v < $pr_array['criteria'])){
5109
- if($pr_array['than'] == "include_only"){
5110
- if($allowed <> 0){
5111
- $allowed = 1;
5112
- }
5113
- } else {
5114
- $allowed = 0;
5115
- }
5116
- }
5117
- break;
5118
- case($pr_array['condition'] = "=<"):
5119
- if (($v <= $pr_array['criteria'])){
5120
- if($pr_array['than'] == "include_only"){
5121
- if($allowed <> 0){
5122
- $allowed = 1;
5123
- }
5124
- } else {
5125
- $allowed = 0;
5126
- }
5127
- }
5128
- break;
5129
- case($pr_array['condition'] = "empty"):
5130
- if (strlen($v) < 1){
5131
- if($pr_array['than'] == "include_only"){
5132
- if($allowed <> 0){
5133
- $allowed = 1;
5134
- }
5135
- } else {
5136
- $allowed = 0;
5137
- }
5138
- }
5139
- break;
5140
- default:
5141
- break;
5142
- }
5143
- } else {
5144
- switch ($pr_array['condition']) {
5145
- case($pr_array['condition'] = "contains"):
5146
- if($pr_array['than'] == "include_only"){
5147
- $allowed = 0;
5148
- } else {
5149
- if($allowed <> 0){
5150
- $allowed = 1;
5151
- }
5152
- }
5153
- break;
5154
- case($pr_array['condition'] = "containsnot"):
5155
- if($pr_array['than'] == "include_only"){
5156
- if($allowed <> 0){
5157
- $allowed = 1;
5158
- }
5159
- } else {
5160
- $allowed = 0;
5161
- }
5162
- break;
5163
- case($pr_array['condition'] = "="):
5164
- if($pr_array['than'] == "include_only"){
5165
- $allowed = 0;
5166
- } else {
5167
- if($allowed <> 0){
5168
- $allowed = 1;
5169
- }
5170
- }
5171
- break;
5172
- case($pr_array['condition'] = "!="):
5173
- if($pr_array['than'] == "include_only"){
5174
- if($allowed <> 0){
5175
- $allowed = 1;
5176
- }
5177
- } else {
5178
- $allowed = 0;
5179
- }
5180
- break;
5181
- case($pr_array['condition'] = ">"):
5182
- if($pr_array['than'] == "include_only"){
5183
- $allowed = 0;
5184
- } else {
5185
- $allowed = 0;
5186
- }
5187
- break;
5188
- case($pr_array['condition'] = ">="):
5189
- if($pr_array['than'] == "include_only"){
5190
- $allowed = 0;
5191
- } else {
5192
- $allowed = 0;
5193
- }
5194
- break;
5195
- case($pr_array['condition'] = "<"):
5196
- if($pr_array['than'] == "include_only"){
5197
- $allowed = 0;
5198
- } else {
5199
- $allowed = 0;
5200
- }
5201
  break;
5202
- case($pr_array['condition'] = "=<"):
5203
- if($pr_array['than'] == "include_only"){
5204
- $allowed = 0;
5205
- } else {
5206
- $allowed = 0;
5207
- }
 
 
 
 
 
 
 
 
5208
  break;
5209
- case($pr_array['condition'] = "empty"):
5210
- if($pr_array['than'] == "include_only"){
5211
- if($allowed <> 0){
5212
- $allowed = 1;
5213
- }
5214
- } else {
5215
- $allowed = 0;
5216
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5217
  break;
5218
- default:
 
 
 
 
 
 
 
5219
  break;
5220
- }
5221
- }
5222
- } else {
5223
- // For now only shipping details are in an array
5224
- foreach ($pd_value as $k => $v){
5225
- foreach ($v as $kk => $vv){
5226
- // Only shipping detail rule can be on price for now
5227
- if($kk == "price"){
5228
- switch ($pr_array['condition']) {
5229
- case($pr_array['condition'] = "contains"):
5230
- if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5231
- $allowed = 0;
5232
- }
5233
- break;
5234
- case($pr_array['condition'] = "containsnot"):
5235
- if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5236
- $allowed = 0;
5237
- }
5238
- break;
5239
- case($pr_array['condition'] = "="):
5240
- if (($vv == $pr_array['criteria'])){
5241
- $allowed = 0;
5242
- }
5243
- break;
5244
- case($pr_array['condition'] = "!="):
5245
- if (($vv != $pr_array['criteria'])){
5246
- $allowed = 0;
5247
- }
5248
- break;
5249
- case($pr_array['condition'] = ">"):
5250
- if (($vv > $pr_array['criteria'])){
5251
- $allowed = 0;
5252
- }
5253
- break;
5254
- case($pr_array['condition'] = ">="):
5255
- if (($vv >= $pr_array['criteria'])){
5256
- $allowed = 0;
5257
- }
5258
- break;
5259
- case($pr_array['condition'] = "<"):
5260
- if (($vv < $pr_array['criteria'])){
5261
- $allowed = 0;
5262
- }
5263
- break;
5264
- case($pr_array['condition'] = "=<"):
5265
- if (($vv <= $pr_array['criteria'])){
5266
- $allowed = 0;
5267
- }
5268
- break;
5269
- case($pr_array['condition'] = "empty"):
5270
- if (strlen($vv) < 1){
5271
- $allowed = 0;
5272
- }
 
 
5273
  break;
5274
- default:
 
 
 
5275
  break;
5276
- }
5277
- }
5278
- }
5279
- }
5280
- }
5281
- } else {
5282
- // Filters for string values
5283
- // If case-sensitve is off than lowercase both the criteria and attribute value
5284
- if (array_key_exists('cs', $pr_array)){
5285
- if ($pr_array['cs'] != "on"){
5286
- $pd_value = strtolower($pd_value);
5287
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
5288
- }
5289
- }
5290
- $pos = strpos($pd_value, '&amp;');
5291
- $pos_slash = strpos($pr_array['criteria'], '\\');
5292
- if($pos !== false){
5293
- $pd_value = str_replace("&amp;","&",$pd_value);
5294
- }
5295
- if($pos_slash !== false){
5296
- $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5297
- }
 
 
5298
 
5299
- switch ($pr_array['condition']) {
5300
- case($pr_array['condition'] = "contains"):
5301
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5302
- $allowed = 0;
5303
- } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5304
- $allowed = 0;
5305
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5306
- if($allowed <> 0){
5307
- $allowed = 1;
5308
- }
5309
- }
5310
- break;
5311
- case($pr_array['condition'] = "containsnot"):
5312
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5313
- $allowed = 0;
5314
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5315
- $allowed = 0;
5316
- }
5317
- break;
5318
  case($pr_array['condition'] = "="):
5319
- if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5320
  $allowed = 0;
5321
  } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5322
  $found = strpos($pd_value,$pr_array['criteria']);
5323
- if ($found !== false) {
5324
- //for category mapping check if its an array
5325
- if($pr_array['attribute'] == "raw_categories"){
5326
- $raw_cats_arr = explode("||",$pd_value);
5327
- if(is_array($raw_cats_arr)){
5328
- if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5329
- if($allowed <> 0){
5330
- $allowed = 1;
5331
- }
5332
- } else {
5333
- $allowed = 0;
5334
- }
5335
- }
5336
- } else {
5337
- if($allowed <> 0){
5338
- $allowed = 1;
5339
- }
5340
- }
5341
- } else {
5342
- $allowed = 0;
5343
- }
5344
- } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5345
- if($allowed <> 0){
5346
- $allowed = 1;
5347
- }
5348
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5349
- $allowed = 0;
5350
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5351
- $allowed = 1;
5352
- }
5353
- break;
5354
- case($pr_array['condition'] = "!="):
5355
- if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5356
  if($allowed <> 0){
5357
- $allowed = 1;
5358
- }
5359
- } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5360
- $allowed = 0;
5361
- } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5362
- $allowed = 0;
5363
- }
5364
- break;
5365
- case($pr_array['condition'] = ">"):
5366
- // Use a lexical order on relational string operators
5367
- if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5368
- $allowed = 0;
5369
- } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5370
- $allowed = 0;
5371
- }
5372
- break;
5373
- case($pr_array['condition'] = ">="):
5374
- // Use a lexical order on relational string operators
5375
- if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5376
- $allowed = 0;
5377
- } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5378
- $allowed = 0;
5379
- }
5380
- break;
5381
- case($pr_array['condition'] = "<"):
5382
- // Use a lexical order on relational string operators
5383
- if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5384
- $allowed = 0;
5385
- } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5386
- $allowed = 0;
5387
- }
5388
- break;
5389
- case($pr_array['condition'] = "=<"):
5390
- // Use a lexical order on relational string operators
5391
- if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5392
- $allowed = 0;
5393
- } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5394
- $allowed = 0;
5395
- }
5396
- break;
5397
- case($pr_array['condition'] = "empty"):
 
 
 
 
 
 
 
 
 
 
 
 
 
5398
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5399
- $allowed = 0;
5400
- } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5401
- if($allowed <> 0){
5402
- $allowed = 1;
5403
- }
5404
- } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5405
- $allowed = 0;
5406
- }
5407
- break;
5408
- default:
5409
  break;
5410
- }
5411
- }
5412
- }
5413
- }
5414
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
5415
 
5416
- if ($allowed < 1){
5417
- $product_data = array();
5418
- $product_data = null;
5419
- } else {
5420
- return $product_data;
5421
- }
5422
- }
5423
  }
23
  * Function to add CDATA brackets to title, short_description and description attributes
24
  */
25
  protected function woosea_append_cdata( $string ){
26
+ if(!empty($string)){
27
+ return "<![CDATA[$string]]>";
28
+ }
29
  }
30
 
 
31
  /**
32
  * Check if a plugin is active
33
  */
58
  * Get all approved product review comments for Google's Product Review Feeds
59
  */
60
  public function woosea_get_reviews ( $product_data, $product ) {
61
+ // Rwviews for the parent variable product itself can be skipped, the review is added for the variation
62
+ if($product_data['product_type'] == "variable"){
63
+ return;
64
+ }
65
+
66
  $approved_reviews = array();
67
  $prod_id = $product_data['id'];
68
 
79
 
80
  // Loop through all product reviews for this specific products (ternary operators)
81
  foreach($reviews as $review_raw){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
+ // Only reviews that are approved will make it to the feed
84
+ if($review_raw->comment_approved == 1){
85
+
86
+ $review = array();
87
+ $review['review_reviewer_image'] = empty($product_data['reviewer_image']) ? '' : $product_data['reviewer_image'];
88
+ $review['review_ratings'] = get_comment_meta( $review_raw->comment_ID, 'rating', true);
89
+ $review['review_id'] = $review_raw->comment_ID;
90
+
91
+ // Names need to be anonomyzed
92
+ $name_pieces = explode(" ", $review_raw->comment_author);
93
+ $nr_name_pieces = count($name_pieces);
94
+ $cnt = 0;
95
+ $name = "";
96
+ foreach($name_pieces as $n_piece){
97
+ $n_piece = str_replace("&amp;", "", $n_piece);
98
+
99
+ if($cnt > 0){
100
+ $n_piece = ucfirst(substr($n_piece, 0, 1));
101
+ }
102
+ $name .= $n_piece." ";
103
+ $cnt++;
104
+ }
105
+
106
+ // Remove strange charachters from reviewer name
107
+ $review['reviewer_name'] = $this->rip_tags(trim(ucfirst($name)));
108
+ $review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
109
+ $review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
110
+ $review['reviewer_name'] = str_replace("&#xa0;", "", $review['reviewer_name']);
111
+ $review['reviewer_name'] = str_replace(":", "", $review['reviewer_name']);
112
+ $review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
113
+
114
+ $review['reviewer_id'] = $review_raw->user_id;
115
+ $review['review_timestamp'] = $review_raw->comment_date;
116
+
117
+ // Remove strange characters from review title
118
+ $review['title'] = empty($product_data['title']) ? '' : $product_data['title'];
119
+ $review['title'] = $this->rip_tags($review['title']);
120
+ $review['title'] = html_entity_decode((str_replace("\r", "", $review['title'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
121
+ $review['title'] = preg_replace( '/\[(.*?)\]/', ' ', $review['title'] );
122
+ $review['title'] = str_replace("&#xa0;", "", $review['title']);
123
+ $review['title'] = $this->woosea_utf8_for_xml( $review['title'] );
124
+
125
+ // Remove strange charchters from review content
126
+ $review['content'] = $review_raw->comment_content;
127
+ $review['content'] = $this->rip_tags($review['content']);
128
+ $review['content'] = html_entity_decode((str_replace("\r", "", $review['content'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
129
+ $review['content'] = preg_replace( '/\[(.*?)\]/', ' ', $review['content'] );
130
+ $review['content'] = str_replace("&#xa0;", "", $review['content']);
131
+ $review['content'] = $this->woosea_utf8_for_xml( $review['content'] );
132
+
133
+ $review['review_product_name'] = $product_data['title'];
134
+ $review['review_url'] = $product_data['link'];
135
+ $review['review_product_url'] = $product_data['link'];
136
+ array_push($approved_reviews, $review);
137
+ }
138
  }
139
  $review_count = $product->get_review_count();
140
  $review_average = $product->get_average_rating();
188
  if($feed_config['fields'] == "google_drm"){
189
  $utm_part .= "&$key=$value";
190
  } else {
191
+ $utm_part .= "&$key=$value";
192
  }
193
  }
194
 
214
  if($parentId > 0){
215
  # Even though variation products always have parameters in the URL we still need to check and make sure they are there
216
  if(strpos($link, '?') !== false){
217
+ $utm_part = "&".ltrim($utm_part, '&amp;');
218
  } else {
219
  $utm_part = "?".ltrim($utm_part, '&amp;');
220
  }
262
  $data = $wpdb->get_results($sql);
263
 
264
  if (count($data)) {
 
265
  foreach ($data as $key => $value) {
266
  $value_display = str_replace("_", " ",$value->name);
267
+ if (!preg_match("/_product_attributes/i",$value->name)){
268
  $list[$value->name] = ucfirst($value_display);
269
+
270
+ // Adding support for the Yoast WooCommerce SEO unique identifiers
271
+ if($value->name == "wpseo_global_identifier_values"){
272
+ $type_expl = explode("\";", $value->type);
273
+
274
+ $yoast_gtin8_value = explode(":\"", $type_expl[1]);
275
+ $yoast_gtin12_value = explode(":\"", $type_expl[3]);
276
+ $yoast_gtin13_value = explode(":\"", $type_expl[5]);
277
+ $yoast_gtin14_value = explode(":\"", $type_expl[7]);
278
+ $yoast_isbn_value = explode(":\"", $type_expl[9]);
279
+ $yoast_mpn_value = explode(":\"", $type_expl[11]);
280
+
281
+ $list["yoast_gtin8"] = $yoast_gtin8_value[1];
282
+ $list["yoast_gtin12"] = $yoast_gtin12_value[1];
283
+ $list["yoast_gtin13"] = $yoast_gtin13_value[1];
284
+ $list["yoast_gtin14"] = $yoast_gtin14_value[1];
285
+ $list["yoast_isbn"] = $yoast_isbn_value[1];
286
+ $list["yoast_mpn"] = $yoast_mpn_value[1];
287
+ }
288
+ } else {
289
+ $product_attr = unserialize($value->type);
290
+ if((!empty($product_attr)) AND (is_array($product_attr))){
291
+ foreach ($product_attr as $key_inner => $arr_value) {
292
+ if(is_array($arr_value)){
293
+ if(!array_key_exists('name', $arr_value)){
294
+ $value_display = @str_replace("_", " ",$arr_value['name']);
295
+ $list[$key_inner] = ucfirst($value_display);
296
+ }
297
+ }
298
  }
299
  }
300
  }
301
+ }
302
  return $list;
303
  }
304
  return false;
360
  /**
361
  * Get category path (needed for Prisjakt)
362
  */
363
+ public function woosea_get_term_parents( $id, $taxonomy, string $link = null, $project_taxonomy, $nicename = false, $visited = array() ) {
364
  // Only add Home to the beginning of the chain when we start buildin the chain
365
  if(empty($visited)){
366
  $chain = 'Home';
399
  return $chain;
400
  }
401
 
402
+ /**
403
+ * Create a floatval for prices
404
+ */
405
+ public function woosea_floatvalue($val){
406
+ $val = str_replace(",",".",$val);
407
+ $val = preg_replace('/\.(?=.*\.)/', '', $val);
408
+ return floatval($val);
409
+ }
410
+
411
  /**
412
  * Get all configured shipping zones
413
  */
697
  /**
698
  * Get shipping cost for product
699
  */
700
+ public function woosea_get_shipping_cost ($class_cost_id, $project_config, $price, $tax_rates, $fullrate, $shipping_zones, $product_id, $item_group_id) {
701
+ $shipping_cost = "";
702
  $shipping_arr = array();
703
  $zone_count = 0;
704
  $nr_shipping_zones = count($shipping_zones);
757
  $shipping_methods = $zone['shipping_methods'];
758
 
759
  foreach ($shipping_methods as $k => $v){
760
+ $method = $v->method_title;
761
+ $shipping_rate_id = $v->instance_id;
762
 
763
  if($v->enabled == "yes"){
764
  if(empty($zone_details['country'])){
768
  }
769
  $taxable = $v->tax_status;
770
 
771
+ if(isset($v->instance_settings['cost'])){
772
+ $shipping_cost = $v->instance_settings['cost'];
773
+ $shipping_cost = str_replace("* [qty]", "", $shipping_cost);
774
+ $shipping_cost = trim($shipping_cost); // trim white spaces
 
775
 
776
+ if($shipping_cost > 0){
777
+
778
+ // Do we need to convert the shipping costs with the Aelia Currency Switcher
779
+ if((isset($project_config['AELIA'])) AND (!empty($GLOBALS['woocommerce-aelia-currencyswitcher'])) AND (get_option ('add_aelia_support') == "yes")){
780
 
781
+ if(!array_key_exists('base_currency', $project_config)){
782
+ $from_currency = get_woocommerce_currency();
783
+ } else {
784
+ $from_currency = $project_config['base_currency'];
785
+ }
786
+
787
+ // Get Aelia currency conversion prices
788
+ $shipping_cost = apply_filters('wc_aelia_cs_convert', $shipping_cost, $from_currency, $project_config['AELIA']);
789
+ }
790
 
791
+ if($taxable == "taxable"){
792
+ foreach ($tax_rates as $k_inner => $w){
793
+ if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
794
+ $rate = (($fullrate)/100);
795
 
796
+ $shipping_cost = str_replace(",", ".", $shipping_cost);
797
+ $shipping_cost = $shipping_cost*$rate;
798
+ $shipping_cost = round($shipping_cost, 2);
799
+ $shipping_cost = wc_format_localized_price($shipping_cost);
800
+ }
801
  }
802
  }
803
  }
804
+ }
805
+
806
+ // WooCommerce Table Rate - Bolder Elements
807
+ if($method == "Table Rate"){
808
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
809
+ // Set shipping cost
810
+ $shipping_cost = 0;
811
+ if(!empty($product_id)){
812
+ // Add product to cart
813
+ if ((isset($product_id)) AND ($product_id > 0)){
814
+ $quantity = 1;
815
+ if(!empty($code_from_config)){
816
+ defined( 'WC_ABSPATH' ) || exit;
817
+
818
+ // Load cart functions which are loaded only on the front-end.
819
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
820
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
821
+
822
  wc_load_cart();
823
 
824
  WC()->customer->set_shipping_country( $code_from_config );
836
  // Read cart and get schipping costs
837
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
838
  $total_cost = WC()->cart->get_total();
839
+ $shipping_cost = WC()->cart->get_shipping_total();
840
+ $shipping_tax = WC()->cart->get_shipping_tax();
841
+ $shipping_cost = ($shipping_cost+$shipping_tax);
842
  $shipping_cost = wc_format_localized_price($shipping_cost);
843
+ }
 
844
  // Make sure to empty the cart again
845
  WC()->cart->empty_cart();
846
+ }
847
+ }
848
+ }
849
+ }
850
+ }
851
+
852
+ // Official WooCommerce Table Rate plugin
853
+ if($method == "Table rates"){
854
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
855
+ // Set shipping cost
856
+ $shipping_cost = 0;
857
+ if(!empty($product_id)){
858
+ // Add product to cart
859
+ if ((isset($product_id)) AND ($product_id > 0)){
860
+ $quantity = 1;
861
+ if(!empty($code_from_config)){
862
+ defined( 'WC_ABSPATH' ) || exit;
863
+
864
+ // Load cart functions which are loaded only on the front-end.
865
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
866
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
867
+
868
+ wc_load_cart();
869
+
870
+ WC()->shipping()->reset_shipping();
871
+ WC()->customer->set_shipping_country( $code_from_config );
872
+
873
+ if(isset($zone_details['region'])){
874
+ WC()->customer->set_shipping_state(wc_clean( $zone_details['region'] ));
875
+ }
876
+
877
+ if(isset($zone_details['postal_code'])){
878
+ WC()->customer->set_shipping_postcode(wc_clean( $zone_details['postal_code'] ));
879
+ }
880
+ WC()->cart->add_to_cart( $product_id, $quantity );
881
+
882
+ // Read cart and get schipping costs
883
+ foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
884
+ // Loop though shipping packages
885
+ foreach ( WC()->shipping->get_packages() as $key => $package ) {
886
+ // Loop through Shipping rates
887
+ foreach($package['rates'] as $rate_id => $rate ){
888
+ if($rate->instance_id == $shipping_rate_id){
889
+ $shipping_cost = $rate->cost;
890
+ }
891
+ }
892
+ }
893
+ $shipping_tax = WC()->cart->get_shipping_tax();
894
+ $shipping_cost = ($shipping_cost+$shipping_tax);
895
+ $shipping_cost = wc_format_localized_price($shipping_cost);
896
+ }
897
+
898
+ if($taxable == "taxable"){
899
+ foreach ($tax_rates as $k_inner => $w){
900
+ if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
901
+ $rate = (($w['rate']+100)/100);
902
+
903
+ $shipping_cost = str_replace(",", ".", $shipping_cost);
904
+ $shipping_cost = $shipping_cost*$rate;
905
+ $shipping_cost = round($shipping_cost, 2);
906
+ $shipping_cost = wc_format_localized_price($shipping_cost);
907
+ }
908
+ }
909
+ }
910
+
911
+ // Make sure to empty the cart again
912
+ WC()->cart->empty_cart();
913
+ }
914
+ }
915
+ }
916
+ }
917
+ }
918
 
919
  // CLASS SHIPPING COSTS
920
  if((isset($v->instance_settings[$class_cost_id])) AND ($class_cost_id != "no_class_cost")){
964
  $mathString = str_replace(array('\'', '"', ','), '', $mathString);
965
 
966
  if(!empty($mathString)){
 
967
  $shipping_cost = $mathString;
968
 
969
  if($taxable == "taxable"){
1047
  unset($shipping_cost);
1048
  }
1049
  }
1050
+
1051
+ // User do not want to have free shipping in their feed
1052
+ $remove_free_shipping = "no";
1053
+ $remove_free_shipping = get_option ('remove_free_shipping');
1054
+
1055
+ if($remove_free_shipping == "yes"){
1056
+ unset($zone_details['service']);
1057
+ unset($zone_details['price']);
1058
+ unset($shipping_cost);
1059
+ }
1060
  }
1061
 
1062
  if(isset($zone_details)){
1074
  }
1075
  }
1076
  }
1077
+
1078
+ // For Heureka remove currency
1079
+ if($project_config['fields'] == "heureka"){
1080
+ $currency = "";
1081
+ }
1082
+
1083
  if(isset($shipping_cost)){
1084
  if(strlen($shipping_cost) > 0){
1085
  if($project_config['ship_suffix'] == "false"){
1088
  $zone_details['price'] = trim($shipping_cost);
1089
  }
1090
  } else {
 
1091
  if(isset($shipping_cost)){
1092
  $zone_details['price'] = trim($currency." ".$shipping_cost);
1093
  }
 
 
1094
  }
1095
  }
1096
  }
1120
 
1121
  // Remove other shipping classes when free shipping is relevant
1122
  $free_check = "yes";
 
1123
 
1124
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
1125
  foreach($shipping_arr as $k => $v) {
1126
  if(!in_array($free_check, $v)){
1127
+
1128
+ // User do not want to have free shipping in their feed
1129
+ // Only remove the other shipping classes when free shipping is not being removed
1130
+ $remove_free_shipping = "no";
1131
+ $remove_free_shipping = get_option ('remove_free_shipping');
1132
+
1133
+ if($remove_free_shipping == "no"){
1134
+ unset($shipping_arr[$k]);
1135
+ }
1136
  }
1137
  }
1138
  }
1140
  // Fix empty services
1141
  foreach($shipping_arr as $k => $v){
1142
  if(empty($v['service'])){
 
 
1143
  unset($shipping_arr[$k]);
1144
  }
1145
  }
1230
  // End Facebook ID's
1231
 
1232
  $xml->channel->addChild('title', htmlspecialchars($feed_config['projectname']));
1233
+ $xml->channel->addChild('link', home_url());
1234
  $xml->channel->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1235
  $xml->asXML($file);
1236
  } else {
1274
  $link = $product->addChild('g:additional_image_link', $v, $namespace['g']);
1275
  //$product->$k = $v;
1276
  } elseif (preg_match("/g:product_highlight/i",$k)){
1277
+ $v = preg_replace('/&/', '&#38;', $v);
1278
  $product_highlight = $product->addChild('g:product_highlight', $v, $namespace['g']);
1279
  } elseif (preg_match("/g:product_detail/i",$k)){
1280
  if(!empty($v)){
1281
  $product_detail_split = explode("#", $v);
1282
+ $detail_complete = count($product_detail_split);
1283
+ if($detail_complete == 2){
1284
+ $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1285
+ $name = str_replace("_", " ", $product_detail_split[0]);
1286
+
1287
+ $section_name = explode(":", $name);
1288
+ $section_name_start = ucfirst($section_name[0]);
1289
+ $name = ucfirst(trim($section_name[1]));
1290
+
1291
+ $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1292
+ $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1293
+ $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
1294
+ }
1295
  }
1296
  } elseif ($k == "g:installment"){
1297
  if(!empty($v)){
1344
  $shop = $xml->addChild('shop');
1345
  $shop->addChild('name', htmlspecialchars($feed_config['projectname']));
1346
  $shop->addChild('company', get_bloginfo());
1347
+ $shop->addChild('url', home_url());
1348
  //$shop->addChild('platform', 'WooCommerce');
1349
  $currencies = $shop->addChild('currencies');
1350
  $currency = $currencies->addChild('currency');
1396
  } elseif ($feed_config['name'] == "Glami.gr") {
1397
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><SHOP></SHOP>');
1398
  $xml->asXML($file);
1399
+ } elseif ($feed_config['name'] == "Vivino") {
1400
+ $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><vivino-product-list></vivino-product-list>');
1401
+ $xml->asXML($file);
1402
  } elseif ($feed_config['name'] == "Pricecheck.co.za") {
1403
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><Offers></Offers>');
1404
  $xml->asXML($file);
1407
  $xml->addAttribute('xmlns:content', 'http://purl.org/rss/1.0/modules/content/');
1408
  $xml->addAttribute('xmlns:wfw', 'http://wellformedweb.org/CommentAPI/');
1409
  $xml->addAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
 
1410
  $xml->addAttribute('xmlns:sy', 'http://purl.org/rss/1.0/modules/syndication/');
1411
  $xml->addAttribute('xmlns:slash', 'http://purl.org/rss/1.0/modules/slash/');
1412
  $xml->addAttribute('version', '2.0');
1423
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><STORE></STORE>');
1424
  $xml->addChild('datetime', date('Y-m-d H:i:s'));
1425
  $xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1426
+ $xml->addChild('link', home_url());
1427
  $xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1428
  $xml->addChild('agency', 'AdTribes.io');
1429
  $xml->addChild('email', 'support@adtribes.io');
1432
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><root></root>');
1433
  $xml->addChild('datetime', date('Y-m-d H:i:s'));
1434
  $xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1435
+ $xml->addChild('link', home_url());
1436
  $xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1437
  $xml->addChild('agency', 'AdTribes.io');
1438
  $xml->addChild('email', 'support@adtribes.io');
1456
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><products></products>');
1457
  $xml->addAttribute('version', '1.0');
1458
  $xml->addAttribute('standalone', 'yes');
1459
+ //$xml->addChild('datetime', date('Y-m-d H:i:s'));
1460
+ //$xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1461
+ //$xml->addChild('link', home_url());
1462
+ //$xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1463
  $xml->asXML($file);
1464
  }
1465
  } else {
1494
 
1495
  // For Google Product review template
1496
  if (($feed_config['name'] == "Google Product Review") AND (empty($xml->channel))) {
1497
+
1498
+ if(!is_bool($xml)){
1499
+ $product = $xml->addChild('reviews');
1500
 
1501
+ foreach ($products as $key => $value){
1502
 
1503
+ $expl = "||";
1504
+
1505
+ if(array_key_exists('reviews', $value)) {
1506
+ $review_data = explode("||", $value['reviews']);
1507
+ foreach($review_data as $rk => $rv){
1508
 
1509
+ $review_comp = explode(":::", $rv);
1510
+ $nr_reviews = count($review_comp);
1511
 
1512
+ if($nr_reviews > 1){
1513
+ $productz = $xml->reviews->addChild('review');
1514
 
1515
+ foreach($review_comp as $rck => $rcv){
1516
+ $nodes = explode("##", $rcv);
1517
+ $nodes = str_replace("::", "", $nodes);
1518
 
1519
+ if($nodes[0] == "REVIEW_RATINGS"){
1520
+ // Do nothing
1521
+ } elseif($nodes[0] == "REVIEW_URL"){
1522
+ $rev_url = $productz->addChild(strtolower($nodes[0]), htmlspecialchars($nodes[1]));
1523
+ $rev_url->addAttribute('type', 'singleton');
1524
+ } elseif(($nodes[0] == "REVIEWER_NAME") OR ($nodes[0] == "REVIEWER_ID")){
1525
+ if(isset($productz->reviewer)){
1526
+ if($nodes[0] == "REVIEWER_NAME"){
1527
+ $name = $nodes[1];
1528
+ if(empty($name)){
1529
+ $reviewer->addChild('name','Anonymous');
1530
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1531
+ } else {
1532
+ $reviewer->addChild('name',$name);
1533
+ }
1534
  } else {
1535
+ if(is_numeric($nodes[1])){
1536
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1537
+ }
1538
  }
1539
  } else {
1540
+ $reviewer = $productz->addChild('reviewer');
1541
+ if($nodes[0] == "REVIEWER_NAME"){
1542
+ $name = $nodes[1];
1543
+ if(empty($name)){
1544
+ $reviewer->addChild('name','Anonymous');
1545
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1546
+ } else {
1547
+ $reviewer->addChild('name',$name);
1548
+ }
1549
  } else {
1550
+ if(is_numeric($nodes[1])){
1551
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1552
+ }
1553
  }
 
 
1554
  }
1555
+ } else {
1556
+ if(isset($nodes[1])){
1557
+ $content = html_entity_decode($nodes[1]);
1558
+ $content = htmlspecialchars($content);
1559
+ $rev = $productz->addChild(strtolower($nodes[0]), $content);
1560
+ }
1561
  }
1562
  }
 
1563
 
1564
+ foreach($review_comp as $rck => $rcv){
1565
+ $nodes = explode("##", $rcv);
1566
+ $nodes = str_replace("::", "", $nodes);
1567
 
1568
+ if($nodes[0] == "REVIEW_RATINGS"){
1569
+ $rev = $productz->addChild('ratings');
1570
+ $over = $productz->ratings->addChild('overall', $nodes[1]);
1571
+ $over->addAttribute('min', '1');
1572
+ $over->addAttribute('max', '5');
1573
+ }
1574
  }
 
 
1575
 
1576
+ $yo = $productz->addChild('products');
1577
+ $po = $yo->addChild('product');
1578
 
1579
+ $identifiers = array("gtin","mpn","sku","brand");
1580
 
1581
+ // Start determining order of product_ids in the Google review feed
1582
+ $proper_order = array("product_name","gtin","mpn","sku","brand","product_url","review_url","reviews");
1583
+ $order_sorted = array();
1584
+ foreach ($proper_order as &$order_value){
1585
+ if(isset($value[$order_value])){
1586
+ $order_sorted[$order_value] = $value[$order_value];
1587
+ }
1588
  }
1589
+ // End
1590
+
1591
+ foreach($order_sorted as $k => $v) {
1592
+ if(($k != "product_name") AND ($k != "product_url")){
1593
+ if(!in_array($k, $identifiers)){
1594
+ if(($k != "reviews") AND ($k != "review_url")){
1595
+ if($k != "product_url"){
1596
+ $v = str_replace("&", "and", $v);
1597
+ }
1598
+ $poa = $po->addChild($k,htmlspecialchars($v));
1599
+ }
1600
+ } else {
1601
+ if(isset($po->product_ids)){
1602
+ if ($k == "gtin"){
1603
+ $poig = $poi->addChild('gtins');
1604
+ $poig->$k = $v;
1605
+ } elseif ($k == "mpn"){
1606
+ $poim = $poi->addChild('mpns');
1607
+ $poim->$k = $v;
1608
+ } elseif ($k == "sku"){
1609
+ $poix = $poi->addChild('skus');
1610
+ $poix->$k = $v;
1611
+ } elseif($k == "brand"){
1612
+ $poib = $poi->addChild('brands');
1613
+ $poib->$k = $v;
1614
+ } else {
1615
+ // Do nothing
1616
+ }
1617
+ } else {
1618
+ $poi = $po->addChild('product_ids');
1619
+ if ($k == "gtin"){
1620
+ $poig = $poi->addChild('gtins');
1621
+ $poig->$k = $v;
1622
+ } elseif ($k == "mpn"){
1623
+ $poim = $poi->addChild('mpns');
1624
+ $poim->$k = $v;
1625
+ } elseif ($k == "sku"){
1626
+ $poix = $poi->addChild('skus');
1627
+ $poix->$k = $v;
1628
+ } elseif($k == "brand"){
1629
+ $poib = $poi->addChild('brands');
1630
+ $poib->$k = $v;
1631
+ } else {
1632
+ // Do nothing
1633
+ }
1634
  }
1635
+ }
1636
+ }
1637
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1638
 
1639
+ // foreach for product name and product url as order seems to mather to Google
1640
+ foreach($value as $k => $v) {
1641
+ if(($k == "product_name") OR ($k == "product_url")){
1642
+ if(!in_array($k, $identifiers)){
1643
+ if(($k != "reviews") AND ($k != "review_url")){
1644
+ if($k != "product_url"){
1645
+ $v = str_replace("&", "and", $v);
1646
+ }
1647
+ $poa = $po->addChild($k,htmlspecialchars($v));
1648
+ }
1649
+ } else {
1650
+ if(isset($po->product_ids)){
1651
+ if ($k == "gtin"){
1652
+ $poig = $poi->addChild('gtins');
1653
+ $poig->$k = $v;
1654
+ } elseif ($k == "mpn"){
1655
+ $poim = $poi->addChild('mpns');
1656
+ $poim->$k = $v;
1657
+ } elseif($k == "sku"){
1658
+ $poix = $poi->addChild('skus');
1659
+ $poix->$k = $v;
1660
+ } elseif($k == "brand"){
1661
+ $poib = $poi->addChild('brands');
1662
+ $poib->$k = $v;
1663
+ } else {
1664
+ // Do nothing
1665
+ }
1666
+ } else {
1667
+ $poi = $po->addChild('product_ids');
1668
+ if ($k == "gtin"){
1669
+ $poig = $poi->addChild('gtins');
1670
+ $poig->$k = $v;
1671
+ } elseif ($k == "mpn"){
1672
+ $poim = $poi->addChild('mpns');
1673
+ $poim->$k = $v;
1674
+ } elseif ($k == "sku"){
1675
+ $poix = $poi->addChild('skus');
1676
+ $poix->$k = $v;
1677
+ } elseif($k == "brand"){
1678
+ $poib = $poi->addChild('brands');
1679
+ $poib->$k = $v;
1680
+ } else {
1681
+ // Do nothing
1682
+ }
1683
  }
1684
+ }
1685
+ }
1686
+ }
1687
+ }
1688
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1689
  }
1690
  }
1691
  }
1692
  }
1693
 
1694
  foreach ($products as $key => $value){
 
1695
  if ((is_array ( $value )) and (!empty( $value ))) {
1696
  if ($feed_config['name'] == "Yandex") {
1697
  $product = $xml->shop->offers->addChild('offer');
1715
 
1716
  } else {
1717
  if(count($value) > 0){
1718
+ if(is_object($xml)){
1719
+ $product = $xml->addChild('product');
1720
+ }
1721
  }
1722
  }
1723
 
1827
  $product->addChild("$k");
1828
  $product->$k = $v;
1829
  } else {
1830
+ if (($feed_config['fields'] != 'standard') AND ($feed_config['fields'] != "customfeed")){
1831
  $k = $this->get_alternative_key ($channel_attributes, $k);
1832
  }
1833
  if(!empty($k)){
 
1834
  /**
1835
  * Some Zbozi and Heureka attributes need some extra XML nodes
1836
  */
1865
  $productp = $product->addChild($p,$v);
1866
  $productp->addAttribute('name', $pieces[1]);
1867
  } elseif ($feed_config['name'] == "Google Product Review") {
1868
+ } elseif ($feed_config['name'] == "Vivino") {
1869
+ $extra_arr = array('ean','jan','upc','producer','wine-name','appellation','vintage','country','color','image','description','alcohol','producer-address','importer-address','varietal','ageing','closure','winemaker','production-size','residual-sugar','acidity','ph','contains-milk-allergens','contains-egg-allergens','non-alcoholic');
1870
+ $unit_arr = array ('production-size','residual-sugar','acidity');
1871
 
1872
+ if(in_array($k, $extra_arr)){
1873
+ if(!isset($product->extras)){
1874
+ $productp = $product->addChild('extras');
1875
+ }
1876
+
1877
+ // Add units to it
1878
+ if(in_array($k, $unit_arr)){
1879
+ $productk = $productp->addChild($k,$v);
1880
+ if($k == "acidity"){
1881
+ $productk->addAttribute('unit', 'g/l');
1882
+ }
1883
+ if($k == "production-size"){
1884
+ $productk->addAttribute('unit', 'bottles');
1885
+ }
1886
+ if($k == "residual-sugar"){
1887
+ $productk->addAttribute('unit', 'g/l');
1888
+ }
1889
+ } else {
1890
+ $productp->$k = $v;
1891
+ }
1892
+ } else {
1893
+ $product->addChild("$k");
1894
+ $product->$k = $v;
1895
+ }
1896
  } elseif ($feed_config['name'] == "Fruugo.nl") {
1897
  $desc_arr = array('Language','Title','Description');
1898
  $price_arr = array('Currency','NormalPriceWithoutVAT','NormalPriceWithVAT','VATRate');
1924
  }
1925
 
1926
  if(is_object($xml)){
1927
+ //$xml = html_entity_decode($xml->asXML());
1928
  $xml->asXML($file);
1929
  }
1930
  unset($product);
1976
  $channel_attributes = get_option('channel_attributes');
1977
  }
1978
  }
1979
+
1980
  // Append or write to file
1981
  $fp = fopen($file, 'a+');
1982
 
1993
  $pieces = str_replace("'", "", $pieces);
1994
 
1995
  foreach ($pieces as $k_inner => $v){
1996
+ if (($feed_config['fields'] != 'standard') AND ($feed_config['fields'] != "customfeed")){
1997
  $v = $this->get_alternative_key ($channel_attributes, $v);
1998
  }
1999
 
2058
  fwrite($fp, $tab_line);
2059
  }
2060
  } else {
2061
+ $pieces = array_map('trim', $pieces);
2062
  $tofile = fputcsv($fp, $pieces, $csv_delimiter, '"');
2063
  }
2064
 
2172
  $xml_piece = "";
2173
 
2174
  // Get taxonomies
2175
+ $no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
2176
  $taxonomies = get_taxonomies();
2177
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
2178
 
2220
  }
2221
  }
2222
 
2223
+ // Get WooCommerce categories
2224
+ $product_categories = get_terms( 'product_cat', 'hide_empty=0' );
2225
+ $prod_cats = array();
2226
+ if ( ! empty( $product_categories ) && ! is_wp_error( $product_categories ) ) {
2227
+ foreach ( $product_categories as $category ) {
2228
+ $prod_cats[$category->slug] = $category->name;
2229
+ }
2230
+ }
2231
+
2232
+ // Get Fiters on categories
2233
+ $prod_cats_slugs = array();
2234
+ if(isset($project_config['rules'])){
2235
+ foreach ($project_config['rules'] as $rule){
2236
+ if(($rule['attribute'] == "categories") AND ($rule['condition'] == "=")){
2237
+ $slug = array_search($rule['criteria'], $prod_cats);
2238
+ array_push($prod_cats_slugs, $slug);
2239
+ }
2240
+ }
2241
+ }
2242
+
2243
+ $product_cat = "";
2244
+ if(count($prod_cats_slugs) > 0){
2245
+ foreach ( $prod_cats_slugs as $cat_slug ){
2246
+ $product_cat .= $cat_slug .",";
2247
+ }
2248
+ }
2249
+
2250
  // Construct WP query
2251
  $wp_query = array(
2252
  'posts_per_page' => $offset_step_size,
2254
  'post_type' => $post_type,
2255
  'post_status' => 'publish',
2256
  'fields' => 'ids',
2257
+ 'no_found_rows' => true,
2258
+ // 'product_cat' => $product_cat
2259
+ );
2260
+
2261
  $prods = new WP_Query($wp_query);
2262
  $shipping_zones = $this->woosea_get_shipping_zones();
2263
 
2294
  if(!in_array($product_data['id'], $allowed_product_orders)){ continue; }
2295
  }
2296
  }
 
2297
  $product_data['title'] = $product->get_title();
2298
+ $product_data['title'] = $this->woosea_utf8_for_xml( $product_data['title'] );
2299
  $product_data['mother_title'] = $product->get_title();
2300
  $product_data['mother_title'] = $this->woosea_utf8_for_xml( $product_data['mother_title'] );
2301
  $product_data['title_hyphen'] = $product_data['title'];
2455
  // Check if there are mother categories
2456
  if(!empty($product_cat)){
2457
  $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
 
 
2458
 
2459
+ if(!is_object($category_path)){
2460
+ $category_path_skroutz = preg_replace('/&gt;/', '>', $category_path);
2461
  $product_data['category_path'] = $category_path;
2462
  $product_data['category_path_skroutz'] = $category_path_skroutz;
2463
  $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
2496
  }
2497
  }
2498
 
2499
+ // Get the RankMath primary category
2500
+ if ($this->woosea_is_plugin_active('seo-by-rank-math/rank-math.php')){
2501
+ $item_id = $product_data['id'];
2502
+ if($product_data['item_group_id'] > 0){
2503
+ $item_id = $product_data['item_group_id'];
2504
+ }
2505
+ $primary_cat_id = get_post_meta( $item_id, 'rank_math_primary_product_cat', true );
2506
+ if ( $primary_cat_id ) {
2507
+ $product_cat = get_term( $primary_cat_id, 'product_cat' );
2508
+ if(!empty($product_cat->name)){
2509
+ $product_data['one_category'] = $product_cat->name;
2510
+ }
2511
+ }
2512
+ }
2513
+
2514
  $product_data['category_path_short'] = str_replace("Home &gt;","",$product_data['category_path']);
2515
  $product_data['category_path_short'] = str_replace("&gt;",">",$product_data['category_path_short']);
2516
  $product_data['category_link'] = $catlink;
2546
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2547
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2548
 
2549
+ // Parent variable description
2550
+ $product_data['mother_description'] = $product_data['description'];
2551
+ $product_data['mother_short_description'] = $product_data['short_description'];
2552
+
2553
  /**
2554
  * Check of we need to add Google Analytics UTM parameters
2555
  */
2560
  }
2561
 
2562
  $product_data['link'] = get_permalink( $product_data['id'])."$utm_part";
2563
+ $product_data['link_no_tracking'] = get_permalink( $product_data['id']);
2564
  $variable_link = htmlspecialchars(get_permalink( $product_data['id']));
2565
  $vlink_piece = explode("?", $variable_link);
2566
  $qutm_part = ltrim($utm_part, "&amp;");
2568
  $qutm_part = ltrim($qutm_part, "?");
2569
  if($qutm_part){
2570
  $product_data['variable_link'] = $vlink_piece[0]."?".$qutm_part;
2571
+ $product_data['link_no_tracking'] = $vlink_piece[0];
2572
  } else {
2573
  $product_data['variable_link'] = $vlink_piece[0];
2574
+ $product_data['link_no_tracking'] = $vlink_piece[0];
2575
  }
2576
 
2577
  $product_data['condition'] = ucfirst( get_post_meta( $product_data['id'], '_woosea_condition', true ) );
2578
+ $product_data['purchase_note'] = get_post_meta( $product_data['id'], '_purchase_note' );
2579
+
2580
  if(empty($product_data['condition']) || $product_data['condition'] == "Array"){
2581
  $product_data['condition'] = "New";
2582
  }
2583
+
2584
+ // get_stock only works as of WC 5 and higher?
2585
  $product_data['availability'] = $this->get_stock( $this->childID );
2586
 
2587
  /**
2589
  * availability will always return out of stock, even when the stock quantity > 0
2590
  * Therefor, we need to check the stock_status and overwrite te availability value
2591
  */
2592
+ if(!is_bool($product)){
2593
+ $stock_status = $product->get_stock_status();
2594
+ } else {
2595
+ $stock_status = "instock";
2596
+ }
2597
+ $product_data['stock_status'] = $stock_status;
2598
+
2599
  if ($stock_status == "outofstock"){
2600
  $product_data['availability'] = "out of stock";
2601
+ if (($project_config['taxonomy'] == "google_shopping") AND ($project_config['fields'] == "google_shopping")) {
2602
+ $product_data['availability'] = "out_of_stock";
2603
+ }
2604
  } elseif ($stock_status == "onbackorder") {
2605
  $product_data['availability'] = "on backorder";
2606
+ if (($project_config['taxonomy'] == "google_shopping") AND ($project_config['fields'] == "google_shopping")) {
2607
+ $product_data['availability'] = "backorder";
2608
+ }
2609
  } else {
2610
  $product_data['availability'] = "in stock";
2611
+ if (($project_config['taxonomy'] == "google_shopping") AND ($project_config['fields'] == "google_shopping")) {
2612
+ $product_data['availability'] = "in_stock";
2613
+ }
2614
  }
2615
 
2616
  $product_data['author'] = get_the_author();
2617
  $product_data['quantity'] = $this->clean_quantity( $this->childID, "_stock" );
2618
+ $product_data['visibility'] = $product->get_catalog_visibility();
2619
  $product_data['menu_order'] = get_post_field( 'menu_order', $product_data['id'] );
2620
  $product_data['currency'] = get_woocommerce_currency();
2621
  if(isset($project_config['WCML'])){
2632
  $product_data['image_all'] = $product_data['image'];
2633
  $product_data['all_images'] = $product_data['image'];
2634
  $product_data['all_gallery_images'] = "";
2635
+ $product_data['product_type'] = $product->get_type();
2636
+
2637
+ // Get the number of active variations that are on stock for variable products
2638
+ if(($product_data['item_group_id'] > 0) AND ($product_data['product_type'] == "variation")){
2639
+ $parent_product = wc_get_product( $product_data['item_group_id'] );
2640
+
2641
+ if(is_object($parent_product)){
2642
+ $current_products = $parent_product->get_children();
2643
+ $product_data['nr_variations'] = count( $current_products );
2644
+ $vcnt = 0;
2645
+
2646
+ foreach ($current_products as $ckey => $cvalue){
2647
+ $stock_value = get_post_meta( $cvalue, "_stock_status", true );
2648
+ if($stock_value == "instock"){
2649
+ $vcnt++;
2650
+
2651
+ }
2652
+ }
2653
+ $product_data['nr_variations_stock'] = $vcnt;
2654
+ } else {
2655
+ $product_data['nr_variations'] = 9999;
2656
+ $product_data['nr_variations_stock'] = 9999;
2657
+ }
2658
+ } else {
2659
+ $product_data['nr_variations'] = 9999;
2660
+ $product_data['nr_variations_stock'] = 9999;
2661
+ }
2662
+
2663
+ // For variable products I need to get the product gallery images of the simple mother product
2664
  if($product_data['item_group_id'] > 0){
2665
  $parent_product = wc_get_product( $product_data['item_group_id'] );
2666
+
2667
  if(is_object($parent_product)){
2668
  $gallery_ids = $parent_product->get_gallery_image_ids();
2669
  $product_data['image_all'] = wp_get_attachment_url($parent_product->get_image_id());
2689
  $product_data['all_images'] = ltrim($product_data['all_images'],',');
2690
  $product_data['all_images_kogan'] = preg_replace( '/,/', '|', $product_data['all_images'] );
2691
  $product_data['all_gallery_images'] = ltrim($product_data['all_gallery_images'],',');
 
2692
 
2693
  $product_data['content_type'] = "product";
2694
  if($product_data['product_type'] == "variation"){
2704
 
2705
  $product_data['shipping'] = 0;
2706
  $tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class() );
2707
+ $all_standard_taxes = WC_Tax::get_rates_for_tax_class( '' );
2708
+
2709
  $shipping_class_id = $product->get_shipping_class_id();
2710
  $shipping_class= $product->get_shipping_class();
2711
 
2715
  }
2716
 
2717
  $product_data['shipping_label'] = $product->get_shipping_class();
2718
+ $term = get_term_by( 'slug', $product->get_shipping_class(), 'product_shipping_class' );
2719
+ if(is_object($term)){
2720
+ $product_data['shipping_label_name'] = $term->name;
2721
+ }
2722
 
2723
  // Get product prices
2724
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2728
  $product_data['regular_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_regular_price()));
2729
  $product_data['regular_price'] = wc_format_decimal($product_data['regular_price'],2);
2730
 
2731
+ // Untouched raw system pricing - DO NOT CHANGE THESE
2732
+ $float_system_net_price = floatval(wc_get_price_excluding_tax( $product ));
2733
+ $product_data['system_net_price'] = round($float_system_net_price, 2);
2734
+ $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2735
+ $product_data['system_net_sale_price'] = wc_format_decimal(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())),2);
2736
+ $product_data['system_net_regular_price'] = wc_format_decimal(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())),2);
2737
+
2738
+ // System regular price
2739
+ $float_system_regular_price = floatval($product->get_regular_price());
2740
+ $product_data['system_regular_price'] = round($float_system_regular_price,2);
2741
+ $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2742
+
2743
+ // System sale price
2744
+ $float_system_sale_price = floatval($product->get_sale_price());
2745
+ if($float_system_sale_price > 0){
2746
+ $product_data['system_sale_price'] = round($float_system_sale_price,2);
2747
+ $product_data['system_sale_price'] = wc_format_decimal($product_data['system_sale_price'],2);
2748
+ $sale_price = $product_data['system_sale_price'];
2749
+ }
2750
+ $code_from_config = $this->woosea_country_to_code($project_config['countries']);
2751
+
2752
+ $nr_standard_rates = count($all_standard_taxes);
2753
+ if(!empty($all_standard_taxes) AND ($nr_standard_rates > 1)){
2754
+ foreach ($all_standard_taxes as $rate){
2755
+ $rate_arr = get_object_vars($rate);
2756
+ if($rate_arr['tax_rate_country'] == $code_from_config){
2757
+ $tax_rates[1]['rate'] = $rate_arr['tax_rate'];
2758
+ }
2759
+ }
2760
+ } else {
2761
+ if(!empty($tax_rates)){
2762
+ foreach ($tax_rates as $tk => $tv){
2763
+ if($tv['rate'] > 0){
2764
+ $tax_rates[1]['rate'] = $tv['rate'];
2765
+ } else {
2766
+ $tax_rates[1]['rate'] = 0;
2767
+ }
2768
  }
2769
+ } else {
2770
+ $tax_rates[1]['rate'] = 0;
2771
+ }
2772
+ }
2773
+
2774
+ if(empty($tax_rates[1]['rate'])){
2775
+ if(!empty($all_standard_taxes) AND ($nr_standard_rates > 1)){
2776
+ foreach ($all_standard_taxes as $rate){
2777
+ $rate_arr = get_object_vars($rate);
2778
+ if($rate_arr['tax_rate_country'] == ""){
2779
+ $tax_rates[1]['rate'] = $rate_arr['tax_rate'];
2780
+ }
2781
+ }
2782
  }
 
 
2783
  }
2784
 
2785
  $fullrate = 100+$tax_rates[1]['rate'];
2791
  if($product->get_type() == "bundle"){
2792
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2793
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
2794
+ $product_data['sale_price'] = get_post_meta($product_data['id'], '_sale_price', true);
2795
  if(is_numeric($tax_rates[1]['rate'])){
2796
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2797
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2832
 
2833
  // Make sure the product ID is not NULL either
2834
  global $woocommerce_wpml;
2835
+ if(!is_null($project_config['WCML'])){
2836
+ //$product_data['non_geo_wcml_price'] = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $product_data['id'], $project_config['WCML'] );
2837
+ $product_data['non_geo_wcml_price'] = wc_format_decimal(get_post_meta( $product_data['id'], '_regular_price', true),2);
2838
+ $product_data['non_geo_wcml_price'] = wc_format_localized_price($product_data['non_geo_wcml_price']);
2839
+ $product_data['non_geo_wcml_price_net_price'] = $product_data['non_geo_wcml_price']/((100+$tax_rates[1]['rate'])/100);
2840
+
2841
+ $non_geo_sale = get_post_meta( $product_data['id'], '_sale_price', true );
2842
+ if(!empty($non_geo_sale)){
2843
+ $product_data['non_geo_wcml_sale_price'] = wc_format_decimal(get_post_meta( $product_data['id'], '_sale_price', true),2);
2844
+ $product_data['non_geo_wcml_sale_price'] = wc_format_localized_price($product_data['non_geo_wcml_sale_price']);
2845
+ $product_data['non_geo_wcml_sale_price_net_price'] = $product_data['non_geo_wcml_sale_price']/((100-$tax_rates[1]['rate'])/100);
2846
+ }
2847
+ }
2848
 
2849
  // When WCML manual prices have been entered
2850
  if(!is_null($product_data['id'])){
2858
  $product_data['regular_price'] = $custom_prices['_regular_price'];
2859
  }
2860
 
2861
+ if(isset($custom_prices['_sale_price'])){
2862
+ if($custom_prices['_sale_price'] > 0){
2863
+ $product_data['sale_price'] = $custom_prices['_sale_price'];
2864
+ } else {
2865
+ // Unset these values as WCML prices have been filled in manually
2866
+ unset($product_data['sale_price']);
2867
+ unset($product_data['system_regular_price']);
2868
+ unset($product_data['system_price']);
2869
+ unset($product_data['system_sale_price']);
2870
+ }
2871
+ }
2872
  }
2873
  }
2874
 
2882
  }
2883
  if($product->get_regular_price()){
2884
  $product_data['regular_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())) * (100+$tax_rates[1]['rate'])/100,2);
2885
+ $product_data['net_regular_price'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())),2);
2886
+ //$product_data['net_regular_price'] = ($product->get_regular_price()/$fullrate)*100;
2887
+ //$product_data['net_regular_price'] = round($product_data['net_regular_price'],2);
2888
  }
2889
  if($product->get_sale_price()){
2890
  $product_data['sale_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())) * (100+$tax_rates[1]['rate'])/100,2);
2891
+ $product_data['net_sale_price'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())),2);
2892
+
 
2893
  // We do not want to have 0 sale price values in the feed
2894
  if($product_data['net_sale_price'] == 0){
2895
  $product_data['net_sale_price'] = "";
2896
  }
2897
  }
2898
+ $float_net_price = floatval(wc_get_price_excluding_tax( $product ));
2899
+ $product_data['net_price'] = round($float_net_price, 2);
2900
+ $product_data['net_price'] = wc_format_decimal($product_data['net_price'],2);
2901
+
2902
  $price = wc_get_price_including_tax($product,array('price'=> $product->get_price()));
2903
  if($product_data['sale_price'] > 0){
2904
  $price = $product_data['sale_price'];
2908
  if ($this->woosea_is_plugin_active('woo-discount-rules/woo-discount-rules.php')){
2909
  $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $product_data['sale_price'], 'discounted_price', true, true);
2910
  if($discount !== false){
2911
+ // round discounted price on 2 decimals
2912
+ $discount = round($discount,2);
2913
+ $product_data['sale_price'] = @number_format($discount,2);
2914
+ $product_data['price'] = $discount;
2915
+
2916
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2917
  if($price_incl_tax == "yes"){
2918
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
2933
  $from_currency = $project_config['base_currency'];
2934
  }
2935
 
 
 
 
2936
  $product_data['price'] = apply_filters('wc_aelia_cs_convert', $product_data['price'], $from_currency, $project_config['AELIA']);
2937
  $product_data['regular_price'] = apply_filters('wc_aelia_cs_convert', $product_data['regular_price'], $from_currency, $project_config['AELIA']);
2938
  $product_data['sale_price'] = apply_filters('wc_aelia_cs_convert', $product_data['sale_price'], $from_currency, $project_config['AELIA']);
3018
  }
3019
  }
3020
 
3021
+ // Is the Mix and Match plugin active
3022
+ if ($this->woosea_is_plugin_active('woocommerce-mix-and-match-products/woocommerce-mix-and-match-products.php')){
3023
+ if($product->is_type('mix-and-match')){
3024
+ if($product_data['price'] == "0.00"){
3025
+ $product_data['price'] = "";
3026
+ $product_data['regular_price'] = "";
3027
+ }
3028
+
3029
+ // Get minimum prices
3030
+ $product_data['mm_min_price'] = wc_format_localized_price($product->get_mnm_price());
3031
+ $product_data['mm_min_regular_price'] = wc_format_localized_price($product->get_mnm_regular_price());
3032
+
3033
+ // Get maximum prices
3034
+ $product_data['mm_max_price'] = wc_format_localized_price($product->get_mnm_price('max'));
3035
+ $product_data['mm_max_regular_price'] = wc_format_localized_price($product->get_mnm_regular_price('max'));
3036
+ }
3037
+ }
3038
+
3039
  // Localize the price attributes
3040
  $decimal_separator = wc_get_price_decimal_separator();
3041
  $product_data['price'] = wc_format_localized_price($product_data['price']);
3043
  $product_data['sale_price'] = wc_format_localized_price($product_data['sale_price']);
3044
  if($product->get_price()){
3045
  $product_data['price_forced'] = wc_format_localized_price($product_data['price_forced']);
3046
+ //$product_data['price_forced'] = (float)$product_data['price_forced'];
3047
+ //$product_data['price_forced_rounded'] = round($product_data['price_forced'],0);
3048
  }
3049
  if($product->get_regular_price()){
3050
  $product_data['regular_price_forced'] = wc_format_localized_price($product_data['regular_price_forced']);
3051
+ //$product_data['regular_price_forced'] = (float)$product_data['regular_price_forced'];
3052
+ //$product_data['regular_price_forced_rounded'] = round($product_data['regular_price_forced'],0);
3053
  }
3054
  if($product->get_sale_price()){
3055
  $product_data['sale_price_forced'] = wc_format_localized_price($product_data['sale_price_forced']);
3056
+ //$product_data['sale_price_forced_rounded'] = round($product_data['sale_price_forced'],0);
3057
+
3058
  }
3059
  $product_data['net_price'] = wc_format_localized_price($product_data['net_price']);
3060
 
3068
  $product_data['net_sale_price'] = wc_format_localized_price($product_data['net_sale_price']);
3069
  }
3070
 
3071
+ if(!empty($product_data['system_price'])){
3072
+ $product_data['system_price'] = wc_format_localized_price($product_data['system_price']);
3073
+ }
3074
+
3075
+ if(!empty($product_data['system_net_price'])){
3076
+ $product_data['system_net_price'] = wc_format_localized_price($product_data['system_net_price']);
3077
+ }
3078
+
3079
+ if(!empty($product_data['system_net_sale_price'])){
3080
+ $product_data['system_net_sale_price'] = wc_format_localized_price($product_data['system_net_sale_price']);
3081
+ }
3082
 
3083
+ if(!empty($product_data['system_net_regular_price'])){
3084
+ $product_data['system_net_regular_price'] = wc_format_localized_price($product_data['system_net_regular_price']);
3085
+ }
 
3086
 
3087
+ if(!empty($product_data['system_regular_price'])){
3088
+ $product_data['system_regular_price'] = wc_format_localized_price($product_data['system_regular_price']);
3089
+ }
3090
+
3091
+ if(!empty($product_data['system_sale_price'])){
3092
+ $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
3093
  }
3094
 
3095
+ // Add rounded price options
3096
+ $decimal_separator = wc_get_price_decimal_separator();
3097
+ $float_price = floatval($product_data['price']);
3098
+ $float_regular_price = floatval($product_data['regular_price']);
3099
+ $float_sale_price = floatval($product_data['sale_price']);
3100
+
3101
+ if($decimal_separator == ","){
3102
+ $product_data['rounded_price'] = str_replace(',', '.', $product_data['price']);
3103
+ $product_data['rounded_price'] = round(number_format($product_data['rounded_price'], 2, '.', ''));
3104
+ $product_data['rounded_regular_price'] = str_replace(',', '.', $product_data['regular_price']);
3105
+ $product_data['rounded_regular_price'] = round(number_format($product_data['rounded_regular_price'], 2, '.', ''));
3106
+
3107
+ if($product_data['sale_price'] > 0){
3108
+ $product_data['rounded_sale_price'] = str_replace(',', '.', $product_data['sale_price']);
3109
+ $product_data['rounded_sale_price'] = round(number_format($float_sale_price, 2, '.', ''));
3110
+ }
3111
+ } else {
3112
+ $product_data['rounded_price'] = round($float_price,0);
3113
+ $product_data['rounded_regular_price'] = (string) round($float_regular_price,0);
3114
+ $product_data['rounded_sale_price'] = round($float_sale_price,0);
3115
+ }
3116
+
3117
+ // Calculate discount percentage
3118
+ if(isset($product_data['rounded_sale_price'])){
3119
+ if($product_data['rounded_regular_price'] > 0){
3120
+ $disc = round(($product_data['rounded_sale_price'] * 100) / $product_data['rounded_regular_price'], 2);
3121
+ $product_data['discount_percentage'] = 100-$disc;
3122
+ //$product_data['discount_percentage'] = round(100-(($product_data['sale_price']/$product_data['regular_price'])*100),2);
3123
+ }
3124
+ }
3125
+
3126
+ foreach($project_config['attributes'] as $attr_key => $attr_arr){
3127
  if(is_array($attr_arr)){
3128
  if($attr_arr['attribute'] == "g:shipping"){
3129
  if($product_data['price'] > 0){
3130
+ $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $fullrate, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
3131
  $shipping_str = $product_data['shipping'];
3132
  }
3133
  }
3134
  }
3135
  }
3136
 
3137
+ if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('lowest_shipping_costs', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi") OR ($project_config['fields'] == "customfeed")){
3138
+ $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $fullrate, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
3139
  $shipping_str = $product_data['shipping'];
3140
  }
3141
 
3143
  if(!empty($shipping_str)){
3144
  $product_data['shipping_price'] = 0;
3145
  }
3146
+ $lowest_shipping_price = array();
3147
+ $shipping_arr = $product_data['shipping'];
3148
 
3149
  if(is_array($shipping_arr)){
3150
  foreach($shipping_arr as $akey => $arr){
3152
  $pieces_ship = explode (" ", $arr['price']);
3153
  if(isset($pieces_ship['1'])){
3154
  $product_data['shipping_price'] = $pieces_ship['1'];
3155
+ $lowest_shipping_price[] = $pieces_ship['1'];
3156
  }
3157
  }
3158
 
3167
  }
3168
  }
3169
 
3170
+ // Get the lowest shipping costs
3171
+ if(!empty($lowest_shipping_price)){
3172
+ $decimal_separator = wc_get_price_decimal_separator();
3173
+ if($decimal_separator == ","){
3174
+ $numeric_lowest_shipping_price = array();
3175
+ foreach ($lowest_shipping_price as &$value) {
3176
+ $number = str_replace(',', '.', $value);
3177
+ if (is_numeric($number)) {
3178
+ $value = number_format($number, 2, '.', '');
3179
+ $numeric_lowest_shipping_price[] = $value;
3180
+ }
3181
+ }
3182
+ $lowest_shipping_price = $numeric_lowest_shipping_price;
3183
+ unset($value);
3184
+ }
3185
+ $product_data['lowest_shipping_costs'] = min($lowest_shipping_price);
3186
+
3187
+ if($decimal_separator == ","){
3188
+ $product_data['lowest_shipping_costs'] = str_replace('.', ',', $product_data['lowest_shipping_costs']);
3189
+ }
3190
+ }
3191
+
3192
  // Google Dynamic Remarketing feeds require the English price notation
3193
  if ($project_config['name'] == "Google Remarketing - DRM"){
3194
  $thousand_separator = wc_get_price_thousand_separator();
3254
 
3255
  foreach($diff_taxonomies as $taxo){
3256
  $term_value = get_the_terms($product_data['id'], $taxo);
3257
+ $product_data["$taxo"] = "";
3258
 
3259
  if(is_array($term_value)){
3260
  // Do not add variation values to the feed when they are out of stock
3264
  $variations = $product_skroutz->get_available_variations();
3265
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
3266
  $skroutz_att_array = array();
3267
+
3268
  foreach($variations_id as $var_id){
3269
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
3270
  if($stock_value == "instock"){
3278
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
3279
  }
3280
  }
3281
+
3282
  foreach($skroutz_att_array as $skrtz_value){
3283
  $product_data[$taxo] .= ",". $skrtz_value;
3284
  }
3285
  $product_data[$taxo] = ltrim($product_data[$taxo],',');
3286
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
3287
+
3288
  } else {
3289
  // Simple Skroutz product
3290
  foreach($term_value as $term){
3327
  /**
3328
  * Get Custom Attributes for Single, Bundled and Composite products
3329
  */
3330
+ if (($product->is_type('simple')) OR ($product->is_type('woosb')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('external')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product_data['product_type'] == "variable") OR ($product_data['product_type'] == "auction") OR ($product->is_type('subscription'))){
3331
  $custom_attributes = $this->get_custom_attributes( $product_data['id'] );
3332
 
3333
+ if(is_array($custom_attributes)){
 
 
 
 
 
3334
 
 
 
 
 
3335
 
3336
+ if(!in_array("woosea optimized title", $custom_attributes)){
3337
+ $woosea_opt = array (
3338
+ "_woosea_optimized_title" => "woosea optimized title",
3339
+ );
3340
+ $custom_attributes = array_merge($custom_attributes, $woosea_opt);
 
 
3341
  }
3342
+
3343
+ if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
3344
+ $custom_attributes['_aioseop_title'] = "All in one seo pack title";
3345
+ $custom_attributes['_aioseop_description'] = "All in one seo pack description";
3346
+ }
3347
+
3348
+ if ( class_exists( 'Yoast_WooCommerce_SEO' ) ) {
3349
+ if(array_key_exists("yoast_gtin8", $custom_attributes)){
3350
+ $product_data["yoast_gtin8"] = $custom_attributes["yoast_gtin8"];
3351
+ }
3352
+ if(array_key_exists("yoast_gtin12", $custom_attributes)){
3353
+ $product_data["yoast_gtin12"] = $custom_attributes["yoast_gtin12"];
3354
+ }
3355
+ if(array_key_exists("yoast_gtin13", $custom_attributes)){
3356
+ $product_data["yoast_gtin13"] = $custom_attributes["yoast_gtin13"];
3357
+ }
3358
+ if(array_key_exists("yoast_gtin14", $custom_attributes)){
3359
+ $product_data["yoast_gtin14"] = $custom_attributes["yoast_gtin14"];
3360
+ }
3361
+ if(array_key_exists("yoast_isbn", $custom_attributes)){
3362
+ $product_data["yoast_isbn"] = $custom_attributes["yoast_isbn"];
3363
+ }
3364
+ if(array_key_exists("yoast_mpn", $custom_attributes)){
3365
+ $product_data["yoast_mpn"] = $custom_attributes["yoast_mpn"];
3366
+ }
3367
+ }
3368
+
3369
+ foreach($custom_attributes as $custom_kk => $custom_vv){
3370
+ $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
3371
+ $new_key ="custom_attributes_" . $custom_kk;
3372
+
3373
+ // This is a ACF image field (PLEASE NOTE: the ACF field needs to contain image or bild in the name)
3374
+ if(preg_match("/image|bild/i", $custom_kk)) {
3375
+ if (class_exists('ACF') AND ($custom_value > 0)) {
3376
+ //$image = wp_get_attachment_image_src($custom_value, "large");
3377
+ if(isset($image[0])){
3378
+ $custom_value = $image[0];
3379
+ }
3380
+ }
3381
+ }
3382
+
3383
+ // Just to make sure the title is never empty
3384
+ if(($custom_kk == "_aioseop_title") && ($custom_value == "")){
3385
+ $custom_value = $product_data['title'];
3386
+ }
3387
 
3388
+ // Just to make sure the description is never empty
3389
+ if(($custom_kk == "_aioseop_description") && ($custom_value == "")){
3390
+ $custom_value = $product_data['description'];
3391
+ }
3392
 
3393
+ // Just to make sure product names are never empty
3394
+ if(($custom_kk == "_woosea_optimized_title") && ($custom_value == "")){
3395
+ $custom_value = $product_data['title'];
3396
+ }
3397
 
3398
+ // Just to make sure the condition field is never empty
3399
+ if(($custom_kk == "_woosea_condition") && ($custom_value == "")){
3400
+ $custom_value = $product_data['condition'];
3401
+ }
3402
 
3403
+ // Need to clean up the strange price Rightpress is returning
3404
+ if ($this->woosea_is_plugin_active('wc-dynamic-pricing-and-discounts/wc-dynamic-pricing-and-discounts.php')){
3405
+ if($custom_kk == "rp_wcdpd_price_cache"){
3406
+ if((isset($project_config['AELIA'])) AND (!empty($GLOBALS['woocommerce-aelia-currencyswitcher'])) AND (get_option ('add_aelia_support') == "yes")){
3407
+ $product_data['price'] = do_shortcode('[aelia_cs_product_price product_id="'.$product_data['id'].'" formatted="0" currency="'.$project_config['AELIA'].'"]');
3408
+ $product_data['sale_price'] = apply_filters('wc_aelia_cs_convert', $custom_value['sale_price']['p'], $from_currency, $project_config['AELIA']);
3409
+ } else {
3410
+ if(array_key_exists("price", $custom_value)){
3411
+ $product_data['price'] = $custom_value['price']['p'];
3412
+ }
3413
 
3414
+ if(array_key_exists("sale_price", $custom_value)){
3415
+ $product_data['sale_price'] = $custom_value['sale_price']['p'];
3416
+ }
3417
+ }
3418
  }
3419
  }
3420
+ $product_data[$new_key] = $custom_value;
3421
+
3422
  }
3423
+ }
 
3424
 
3425
  /**
3426
  * We need to check if this product has individual custom product attributes
3430
  $data = $wpdb->get_results($sql);
3431
  if (count($data)) {
3432
  foreach ($data as $key => $value) {
3433
+ $value_display = str_replace("_", " ",$value->name);
3434
  if (preg_match("/_product_attributes/i",$value->name)){
3435
  $product_attr = unserialize($value->type);
3436
  if(!empty($product_attr)){
3448
 
3449
  /**
3450
  * Get Product Attributes for Single products
3451
+ * These are the attributes users create themselves in WooCommerce
3452
  */
3453
+ if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('woosb')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')) OR ($product->is_type('variable')))){
3454
  $single_attributes = $product->get_attributes();
 
3455
  foreach ($single_attributes as $attribute){
3456
+ $attr_name = strtolower($attribute->get_name());
3457
+ $attr_value = $product->get_attribute($attr_name);
3458
+ $product_data[$attr_name] = $attr_value;
3459
  }
3460
  }
3461
 
3468
  }
3469
  }
3470
 
 
 
 
3471
  /**
3472
  * Versioned products need a seperate approach
3473
  * Get data for these products based on the mother products item group id
3478
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3479
  $variations = $product_variations->get_variation_attributes();
3480
 
3481
+ // For Skroutz and Bestprice apparal products we can only append colours to the product name
3482
  // When a product has both a size and color attribute we assume its an apparal product
3483
+ if(($project_config['fields'] == "skroutz") OR ($project_config['fields'] == "bestprice")){
3484
  $size_found = "no";
3485
  $color_found = "no";
3486
 
3514
  if(isset($sz_attribute)){
3515
  $skroutz_size = get_post_meta( $product_data['id'], "attribute_".$sz_attribute, true );
3516
  }
3517
+
3518
  if((!empty($skroutz_color)) AND (!empty($skroutz_size))){
3519
 
3520
  foreach($variations as $kvar => $vvar){
3556
  }
3557
  }
3558
 
 
 
3559
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
 
3560
  // Determine the default variation product
3561
  if( ($product_data['item_group_id'] > 0) AND (is_object(wc_get_product( $product_data['item_group_id']))) AND (($product_data['product_type'] == "variation") OR ($product_data['product_type'] == "subscription_variation"))){
3562
+ $mother_product = new WC_Product_Variable($product_data['item_group_id']);
3563
+ //$mother_product = wc_get_product($product_data['item_group_id']);
3564
+ $def_attributes = $mother_product->get_default_attributes();
3565
 
3566
  if(isset($project_config['lowest_price_variations'])){
3567
+
3568
  // Determine lowest priced variation
3569
  $variation_min_price = $mother_product->get_variation_price('min');
3570
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3571
  $variation_min_price = wc_format_localized_price($variation_min_price);
3572
+ $var_price = get_post_meta($product_data['id'], '_price', true);
3573
+ $var_price = wc_format_decimal($var_price,2);
3574
+ $var_price = wc_format_localized_price($var_price);
3575
+ $variation_prices = $mother_product->get_variation_prices();
3576
+ $variation_prices_price = array_values($variation_prices['price']);
3577
+ if(!empty($variation_prices_price)){
3578
+ $lowest_price = min($variation_prices_price);
3579
+ } else {
3580
+ $lowest_price = 0;
3581
+ }
3582
 
3583
+ if(($var_price == $lowest_price) OR ($var_price == $variation_min_price) OR ($product_data['system_regular_price'] == $variation_min_price) OR ($product_data['system_net_price'] == $variation_min_price)){
3584
  $variation_pass = "true";
3585
  } else {
3586
  $variation_pass = "false";
3718
  /**
3719
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3720
  */
3721
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3722
+ //if($stock_value == "instock"){
3723
  foreach($diff_taxonomies as $taxo){
3724
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3725
  unset($product_data[$taxo]);
3726
  if(is_array($term_value)){
3727
  foreach($term_value as $term){
3728
  if(empty($product_data[$taxo])){
3729
+ $product_data[$taxo] = $term->name;
3730
  } else {
3731
+ $product_data[$taxo] .= " ".$term->name;
3732
  }
3733
  }
3734
  }
3735
+ }
3736
 
3737
  /**
3738
  * Add product tags to the product data array
3752
 
3753
  // Add attribute values to the variation product names to make them unique
3754
  $product_data['title_hyphen'] = $product_data['title']." - ";
3755
+ $product_data['mother_title_hyphen'] = $product_data['mother_title']." - ";
3756
 
3757
  foreach($variations as $kk => $vv){
3758
  $custom_key = $kk;
3786
  /**
3787
  * Get Custom Attributes for this variable product
3788
  */
 
3789
  $custom_attributes = $this->get_custom_attributes( $product_data['id'] );
3790
 
3791
  if(!in_array("woosea optimized title", $custom_attributes)){
3799
  $custom_attributes['_aioseop_title'] = "All in one seo pack title";
3800
  $custom_attributes['_aioseop_description'] = "All in one seo pack description";
3801
  }
3802
+
3803
+ if ( class_exists( 'Yoast_WooCommerce_SEO' ) ) {
3804
+ if(array_key_exists("yoast_gtin8", $custom_attributes)){
3805
+ $product_data["yoast_gtin8"] = $custom_attributes["yoast_gtin8"];
3806
+ }
3807
+ if(array_key_exists("yoast_gtin12", $custom_attributes)){
3808
+ $product_data["yoast_gtin12"] = $custom_attributes["yoast_gtin12"];
3809
+ }
3810
+ if(array_key_exists("yoast_gtin13", $custom_attributes)){
3811
+ $product_data["yoast_gtin13"] = $custom_attributes["yoast_gtin13"];
3812
+ }
3813
+ if(array_key_exists("yoast_gtin14", $custom_attributes)){
3814
+ $product_data["yoast_gtin14"] = $custom_attributes["yoast_gtin14"];
3815
+ }
3816
+ if(array_key_exists("yoast_isbn", $custom_attributes)){
3817
+ $product_data["yoast_isbn"] = $custom_attributes["yoast_isbn"];
3818
+ }
3819
+ if(array_key_exists("yoast_mpn", $custom_attributes)){
3820
+ $product_data["yoast_mpn"] = $custom_attributes["yoast_mpn"];
3821
+ }
3822
+ }
3823
+
3824
  foreach($custom_attributes as $custom_kk => $custom_vv){
3825
  $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
3826
 
3852
  $new_key = str_replace("var","product",$new_key);
3853
  if(!empty( $custom_value )){
3854
  $product_data[$new_key] = $custom_value;
3855
+ }
3856
  }
3857
  }
3858
 
3867
  $value_display = str_replace("_", " ",$value->name);
3868
  if (preg_match("/_product_attributes/i",$value->name)){
3869
  $product_attr = unserialize($value->type);
3870
+ if((!empty($product_attr)) AND (is_array($product_attr))){
3871
  foreach ($product_attr as $key => $arr_value) {
3872
  $new_key ="custom_attributes_" . $key;
3873
  $product_data[$new_key] = $arr_value['value'];
3882
  */
3883
  $custom_attributes_mother = $this->get_custom_attributes( $product_data['item_group_id'] );
3884
 
3885
+ if ( class_exists( 'Yoast_WooCommerce_SEO' ) ) {
3886
+ if(array_key_exists("yoast_gtin8", $custom_attributes_mother)){
3887
+ $product_data["yoast_gtin8"] = $custom_attributes_mother["yoast_gtin8"];
3888
+ }
3889
+ if(array_key_exists("yoast_gtin12", $custom_attributes_mother)){
3890
+ $product_data["yoast_gtin12"] = $custom_attributes_mother["yoast_gtin12"];
3891
+ }
3892
+ if(array_key_exists("yoast_gtin13", $custom_attributes_mother)){
3893
+ $product_data["yoast_gtin13"] = $custom_attributes_mother["yoast_gtin13"];
3894
+ }
3895
+ if(array_key_exists("yoast_gtin14", $custom_attributes_mother)){
3896
+ $product_data["yoast_gtin14"] = $custom_attributes_mother["yoast_gtin14"];
3897
+ }
3898
+ if(array_key_exists("yoast_isbn", $custom_attributes_mother)){
3899
+ $product_data["yoast_isbn"] = $custom_attributes_mother["yoast_isbn"];
3900
+ }
3901
+ if(array_key_exists("yoast_mpn", $custom_attributes_mother)){
3902
+ $product_data["yoast_mpn"] = $custom_attributes_mother["yoast_mpn"];
3903
+ }
3904
+ }
3905
+
3906
  foreach($custom_attributes_mother as $custom_kk_m => $custom_value_m){
3907
 
3908
  if(!array_key_exists($custom_kk_m, $product_data)){
3942
  * we will add CDATA brackets to the title and description attributes
3943
  */
3944
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
3945
+ $product_data['title_lcw'] = ucwords(strtolower($product_data['title']));
3946
+
3947
+ // Add CDATA to title and descriptions
3948
+ //$add_woosea_cdata = get_option ('add_woosea_cdata');
3949
+ //if($add_woosea_cdata == "yes"){
3950
+ // $product_data['title'] = $this->woosea_append_cdata ( $product_data['title'] );
3951
+ // $product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3952
+ // $product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3953
+ //}
3954
 
3955
  /**
3956
  * Get product reviews for Google Product Review Feeds
3957
  */
3958
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3959
 
3960
+
3961
+ /**
3962
+ * Filter out reviews that do not have text
3963
+ */
3964
+ if(!empty($product_data['reviews'])){
3965
+ foreach($product_data['reviews'] as $review_id => $review_details){
3966
+ if(empty($review_details['content'])){
3967
+ unset($product_data['reviews'][$review_id]);
3968
+ }
3969
+ }
3970
+ }
3971
+
3972
+ /**
3973
+ * Filter out reviews that do not have a rating
3974
+ */
3975
+ if(!empty($product_data['reviews'])){
3976
+ foreach($product_data['reviews'] as $review_id => $review_details){
3977
+ if(empty($review_details['review_ratings'])){
3978
+ unset($product_data['reviews'][$review_id]);
3979
+ }
3980
+ }
3981
+ }
3982
+
3983
+ /**
3984
+ * Filter out reviews that have a link in the review text / content as that is now allowed by Google
3985
+ */
3986
+ if(!empty($product_data['reviews'])){
3987
+ foreach($product_data['reviews'] as $review_id => $review_details){
3988
+ $pos = strpos($review_details['content'], 'www');
3989
+ if($pos !== false){
3990
+ unset($product_data['reviews'][$review_id]);
3991
+ }
3992
+
3993
+ $pos = strpos($review_details['content'], 'http');
3994
+ if($pos !== false){
3995
+ unset($product_data['reviews'][$review_id]);
3996
+ }
3997
+ }
3998
+ }
3999
+
4000
  /**
4001
  * Check if individual products need to be excluded
4002
  */
4041
  $product_data = $this->woocommerce_sea_filters( $project_config['rules'], $product_data );
4042
  }
4043
  }
4044
+
4045
+ if(isset($product_data['title_lcw'])){
4046
+ $product_data['title_lcw'] = ucwords($product_data['title_lcw']);
4047
+ }
4048
 
4049
  // Check if the sale price is effective
4050
  if(isset($product_data['sale_price_start_date'])){
4066
  // For these channels parent products are allowed
4067
  $allowed_channel_parents = array(
4068
  "skroutz",
4069
+ "bestprice",
4070
  "google_dsa",
4071
  "google_product_review",
4072
  );
4073
 
4074
+ if(array_key_exists('fields', $project_config)){
4075
+ if (!in_array($project_config['fields'], $allowed_channel_parents)){
4076
+ if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
4077
+ $product_data = array();
4078
+ $product_data = null;
4079
+ }
4080
+ }
4081
+ }
4082
 
4083
  /**
4084
  * Remove variation products that are not THE default variation product
4091
  /**
4092
  * And item_group_id is not allowed for simple products, prevent users from adding this to the feedd
4093
  */
4094
+ if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('woosb')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')) OR ($product->is_type('variable')))){
4095
  unset($product_data['item_group_id']);
4096
  }
4097
 
4105
  }
4106
  }
4107
 
4108
+ /**
4109
+ * Do final check on Skroutz out of stock sizes
4110
+ * When a size is not on stock remove it
4111
+ */
4112
+ if($project_config['fields'] == "skroutz"){
4113
+
4114
+ if(isset($product_data['id'])){
4115
+
4116
+ foreach($project_config['attributes'] as $ky => $vy){
4117
+ if(isset($vy['attribute'])){
4118
+ if($vy['attribute'] == "size"){
4119
+ $size_found = "yes";
4120
+ $sz_attribute = $vy['mapfrom'];
4121
+ }
4122
+ if($vy['attribute'] == "color"){
4123
+ $color_found = "yes";
4124
+ $clr_attribute = $vy['mapfrom'];
4125
+ }
4126
+ }
4127
+ }
4128
+
4129
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
4130
+ $sz_attr_value = get_post_meta( $product_data['id'], $sz_attribute, true );
4131
+
4132
+ if(!empty($clr_attribute)){
4133
+ $clr_attr_value = get_post_meta( $product_data['id'], "attribute_".$clr_attribute, true );
4134
+ } else {
4135
+ $clr_attr_value = "";
4136
+ }
4137
+
4138
+ if(isset($product_data['item_group_id']) AND ($product_data['product_type'] == "variation")){
4139
+ if($product_data['item_group_id'] > 0){
4140
+ $product_skroutz = wc_get_product($product_data['item_group_id']);
4141
+ $variations = $product_skroutz->get_available_variations();
4142
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
4143
+
4144
+ foreach($variations_id as $var_id){
4145
+ $clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
4146
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
4147
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
4148
+
4149
+ if($clr_variation == $clr_attr_value){
4150
+ if($stock_variation == "outofstock"){
4151
+ // Remove this size as it is not on stock
4152
+ if(array_key_exists($sz_attribute, $product_data)){
4153
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
4154
+ $product_data[$sz_attribute] = str_replace(", , ",",",$product_data[$sz_attribute]);
4155
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], " ");
4156
+ $product_data[$sz_attribute] = trim($product_data[$sz_attribute], ",");
4157
+ }
4158
+ } else {
4159
+ // Add comma's in the size field and put availability on stock as at least one variation is on stock
4160
+ $size_variation_new = $size_variation.",";
4161
+ $product_data[$sz_attribute] = str_replace($size_variation,$size_variation_new,$product_data[$sz_attribute]);
4162
+ $product_data[$sz_attribute] = trim($product_data[$sz_attribute], ",");
4163
+ $product_data['availability'] = "in stock";
4164
+ }
4165
+ }
4166
+ }
4167
+ } else {
4168
+ // This is a parent variable product
4169
+ $product_skroutz = wc_get_product($product_data['id']);
4170
+ $variations = $product_skroutz->get_available_variations();
4171
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
4172
+
4173
+ foreach($variations_id as $var_id){
4174
+ //$clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
4175
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
4176
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
4177
+ if($stock_variation == "outofstock"){
4178
+ // Remove this size as it is not on stock
4179
+ if(array_key_exists($sz_attribute, $product_data)){
4180
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
4181
+ $product_data[$sz_attribute] = str_replace(", , ",",",$product_data[$sz_attribute]);
4182
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], " ");
4183
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], ",");
4184
+
4185
+ }
4186
+ }
4187
+ }
4188
+ }
4189
+ }
4190
+ }
4191
+ }
4192
+
4193
  /**
4194
  * When product has passed the filter rules it can continue with the rest
4195
  */
4223
  }
4224
  } else {
4225
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
4226
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
4227
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
4228
  } else {
4229
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
4295
  }
4296
  } else {
4297
  if(strlen($product_data[$attr_value['mapfrom']])){
4298
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
4299
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4300
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4301
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
4479
  $shipping_str .= ":WOOSEA_POSTAL_CODE##$v";
4480
  } elseif ($k == "price"){
4481
  $shipping_str .= ":WOOSEA_PRICE##$attr_value[prefix] $v $attr_value[suffix]";
4482
+ //$shipping_str .= ":WOOSEA_PRICE##$v";
4483
  } else {
4484
  // UNKNOWN, DO NOT ADD
4485
  }
4516
  }
4517
  } else {
4518
  if(strlen($product_data[$attr_value['mapfrom']])){
4519
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
4520
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4521
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4522
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
4786
  }
4787
  // New policy of Google, only when the value is yes add it to the feed
4788
  // 28 October 2019
4789
+ if(array_key_exists('calculated', $project_config['attributes'])){
4790
  $xml_product['g:identifier_exists'] = $identifier_exists;
4791
+ }
4792
  }
4793
  return $xml_product;
4794
  }
5046
  return $product_data;
5047
  }
5048
 
5049
+ /**
5050
+ * Execute project rules
5051
+ */
5052
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
5053
  $aantal_prods = count($product_data);
5054
+ if($aantal_prods > 0){
5055
 
5056
+ foreach ($project_rules2 as $pr_key => $pr_array){
5057
 
5058
+ foreach ($product_data as $pd_key => $pd_value){
5059
 
5060
+ // Check is there is a rule on specific attributes
5061
+ if($pd_key == $pr_array['attribute']){
5062
+ // This is because for data manipulation the than attribute is empty
5063
+ if(!array_key_exists('than_attribute', $pr_array)){
5064
+ $pr_array['than_attribute'] = $pd_key;
5065
+ }
 
5066
 
5067
  // Check if a rule has been set for Google categories
5068
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
5069
+
5070
+ $pr_array['than_attribute'] = "categories";
5071
  $category_id = explode("-", $pr_array['newvalue']);
5072
  $pr_array['newvalue'] = $category_id[0];
5073
+ $product_data['categories'] = $pr_array['newvalue'];
5074
+ }
5075
 
5076
+ // Make sure that rules on numerics are on true numerics
5077
+ if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
5078
+ $pd_value = strtr($pd_value, ',', '.');
5079
+ }
5080
 
5081
 
5082
+ // Make sure the price or sale price is numeric
5083
+ if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
5084
+ settype($pd_value, "double");
5085
+ }
5086
 
5087
+ if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
5088
 
5089
+ // Rules for numeric values
5090
+ switch ($pr_array['condition']) {
5091
+ case($pr_array['condition'] = "contains"):
5092
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5093
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
5094
+ }
5095
+ break;
5096
+ case($pr_array['condition'] = "containsnot"):
5097
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5098
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5099
+ }
5100
+ break;
5101
+ case($pr_array['condition'] = "="):
5102
+ if (($pd_value == $pr_array['criteria'])){
5103
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5104
+ }
5105
+ break;
5106
+ case($pr_array['condition'] = "!="):
5107
+ if (($pd_value != $pr_array['criteria'])){
5108
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5109
+ }
5110
+ break;
5111
+ case($pr_array['condition'] = ">"):
5112
+ if (($pd_value > $pr_array['criteria'])){
5113
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5114
+ }
5115
+ break;
5116
+ case($pr_array['condition'] = ">="):
5117
+ if (($pd_value >= $pr_array['criteria'])){
5118
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5119
+ }
5120
+ break;
5121
+ case($pr_array['condition'] = "<"):
5122
+ if (($pd_value < $pr_array['criteria'])){
5123
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5124
+ }
5125
+ break;
5126
+ case($pr_array['condition'] = "=<"):
5127
+ if (($pd_value <= $pr_array['criteria'])){
5128
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5129
+ }
5130
+ break;
5131
+ case($pr_array['condition'] = "empty"):
5132
+ if(empty($product_data[$pr_array['attribute']])){
5133
+ if ((strlen($pd_value) < 1)){
5134
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5135
+ } else {
5136
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5137
+ }
5138
+ }
5139
+ break;
5140
+ case($pr_array['condition'] = "multiply"):
5141
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
5142
+ $convert_back = "false";
5143
+ $pos = strpos($pd_value, ',');
5144
+ if($pos !== false){
5145
+ $convert_back = "true";
5146
+ }
5147
+ $pd_value = strtr($pd_value, ',', '.');
5148
+ $newvalue = $pd_value*$pr_array['criteria'];
5149
+ $newvalue = round($newvalue, 2);
5150
+ if($convert_back == "true"){
5151
+ $newvalue = strtr($newvalue, '.',',');
5152
+ }
5153
+ $product_data[$pr_array['attribute']] = $newvalue;
5154
+ break;
5155
+ case($pr_array['condition'] = "divide"):
5156
+ $newvalue = ($pd_value / $pr_array['criteria']);
5157
+ $newvalue = round($newvalue, 2);
5158
+ $newvalue = strtr($newvalue, '.',',');
5159
+ $product_data[$pr_array['attribute']] = $newvalue;
5160
+ break;
5161
+ case($pr_array['condition'] = "plus"):
5162
+ $newvalue = ($pd_value + $pr_array['criteria']);
5163
+ $product_data[$pr_array['attribute']] = $newvalue;
5164
+ break;
5165
+ case($pr_array['condition'] = "minus"):
5166
+ $newvalue = ($pd_value - $pr_array['criteria']);
5167
+ $product_data[$pr_array['attribute']] = $newvalue;
5168
+ break;
5169
+ case($pr_array['condition'] = "findreplace"):
5170
+ if (strpos($pd_value, $pr_array['criteria']) !== false){
5171
  // Make sure that a new value has been set
5172
+ if(!empty($pr_array['newvalue'])){
5173
+ // Find and replace only work on same attribute field, otherwise create a contains rule
5174
  if($pr_array['attribute'] == $pr_array['than_attribute']){
5175
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
5176
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
5177
  }
5178
+ }
5179
+ }
5180
+ break;
5181
+ default:
5182
+ break;
5183
+ }
5184
+ } elseif (is_array($pd_value)) {
5185
+
5186
+ // For now only shipping details are in an array
5187
+ foreach ($pd_value as $k => $v){
5188
+ if(is_array($v)){
5189
+ foreach ($v as $kk => $vv){
5190
+ // Only shipping detail rule can be on price for now
5191
+ if($kk == "price"){
5192
+ switch ($pr_array['condition']) {
5193
+ case($pr_array['condition'] = "contains"):
5194
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5195
+ $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
5196
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5197
+ }
5198
+ break;
5199
+ case($pr_array['condition'] = "containsnot"):
5200
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5201
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5202
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5203
+ }
5204
+ break;
5205
+ case($pr_array['condition'] = "="):
5206
+ if (($vv == $pr_array['criteria'])){
5207
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5208
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5209
+ }
5210
+ break;
5211
+ case($pr_array['condition'] = "!="):
5212
+ if (($vv != $pr_array['criteria'])){
5213
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5214
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5215
+ }
5216
+ break;
5217
+ case($pr_array['condition'] = ">"):
5218
+ if (($vv > $pr_array['criteria'])){
5219
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5220
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5221
+ }
5222
+ break;
5223
+ case($pr_array['condition'] = ">="):
5224
+ if (($vv >= $pr_array['criteria'])){
5225
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5226
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5227
+ }
5228
+ break;
5229
+ case($pr_array['condition'] = "<"):
5230
+ if (($vv < $pr_array['criteria'])){
5231
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5232
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5233
+ }
5234
+ break;
5235
+ case($pr_array['condition'] = "=<"):
5236
+ if (($vv <= $pr_array['criteria'])){
5237
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5238
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5239
+ }
5240
+ break;
5241
+ case($pr_array['condition'] = "empty"):
5242
+ if ((strlen($vv) < 1)){
5243
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5244
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5245
+ }
5246
+ break;
5247
+ case($pr_array['condition'] = "multiply"):
5248
+ // Only shipping array
5249
+ if(is_array($pd_value)){
5250
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
5251
+ foreach ($pd_value as $ship_a_key => $shipping_arr){
5252
+ foreach($shipping_arr as $ship_key => $ship_value){
5253
+ if($ship_key == "price"){
5254
+ $ship_pieces = explode(" ", $ship_value);
5255
+ $pd_value = strtr($ship_pieces[1], ',', '.');
5256
+ $newvalue = $pd_value*$pr_array['criteria'];
5257
+ $newvalue = round($newvalue, 2);
5258
+ $newvalue = strtr($newvalue, '.',',');
5259
+ $newvalue = $ship_pieces[0]." ".$newvalue;
5260
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
5261
+ }
5262
+ }
5263
+ }
5264
+ }
5265
+ break;
5266
+ default:
5267
+ break;
5268
+ }
5269
+ }
5270
+ }
5271
+ } else {
5272
+ // Rules on product tags
5273
+ foreach ($pd_value as $k => $v){
5274
+
5275
+ // Rules for string values
5276
+ if (!array_key_exists('cs', $pr_array)){
5277
+ $v = strtolower($v);
5278
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5279
+ }
5280
+
5281
+ switch ($pr_array['condition']) {
5282
+ case($pr_array['condition'] = "contains"):
5283
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5284
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5285
+ }
5286
+ break;
5287
+ case($pr_array['condition'] = "containsnot"):
5288
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5289
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5290
+ }
5291
+ break;
5292
+ case($pr_array['condition'] = "="):
5293
+ if (($v == $pr_array['criteria'])){
5294
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5295
+ }
5296
+ break;
5297
+ case($pr_array['condition'] = "!="):
5298
+ if (($v != $pr_array['criteria'])){
5299
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5300
+ }
5301
+ break;
5302
+ case($pr_array['condition'] = ">"):
5303
+ if (($v > $pr_array['criteria'])){
5304
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5305
+ }
5306
+ break;
5307
+ case($pr_array['condition'] = ">="):
5308
+ if (($v >= $pr_array['criteria'])){
5309
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5310
+ }
5311
+ break;
5312
+ case($pr_array['condition'] = "<"):
5313
+ if (($v < $pr_array['criteria'])){
5314
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5315
+ }
5316
+ break;
5317
+ case($pr_array['condition'] = "=<"):
5318
+ if (($v <= $pr_array['criteria'])){
5319
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5320
+ }
5321
+ break;
5322
+ case($pr_array['condition'] = "empty"):
5323
+ if ((strlen($v) < 1)){
5324
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5325
+ }
5326
+ break;
5327
+ case($pr_array['condition'] = "multiply"):
5328
+ // Only shipping array
5329
+ if(is_array($v)){
5330
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
5331
+ foreach ($v as $ship_a_key => $shipping_arr){
5332
+ foreach($shipping_arr as $ship_key => $ship_value){
5333
+ if($ship_key == "price"){
5334
+ $ship_pieces = explode(" ", $ship_value);
5335
+ $pd_value = strtr($ship_pieces[1], ',', '.');
5336
+ $newvalue = $pd_value*$pr_array['criteria'];
5337
+ $newvalue = round($newvalue, 2);
5338
+ $newvalue = strtr($newvalue, '.',',');
5339
+ $newvalue = $ship_pieces[0]." ".$newvalue;
5340
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
5341
+ }
5342
+ }
5343
+ }
5344
+ }
5345
+ break;
5346
+ default:
5347
+ break;
5348
+ }
5349
+ }
5350
+ }
5351
+ }
5352
+ } else {
5353
+ // Rules for string values
5354
+ if (!array_key_exists('cs', $pr_array)){
5355
+ if($pr_array['attribute'] != "image"){
5356
+ $pd_value = strtolower($pd_value);
5357
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5358
+ }
5359
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5360
 
5361
+ switch ($pr_array['condition']) {
5362
+ case($pr_array['condition'] = "contains"):
5363
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5364
+ // Specifically for shipping price rules
5365
+ if(!empty($product_data[$pr_array['than_attribute']])){
5366
+ if(is_array($product_data[$pr_array['than_attribute']])){
5367
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5368
+ for ($x = 0; $x <= $arr_size; $x++) {
5369
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5370
+ }
5371
+ } else {
5372
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5373
+ }
5374
+ } else {
5375
+ // This attribute value is empty for this product
5376
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5377
+ }
5378
+ }
5379
+ break;
5380
+ case($pr_array['condition'] = "containsnot"):
5381
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5382
+ // Specifically for shipping price rules
5383
+ if(is_array($product_data[$pr_array['than_attribute']])){
5384
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5385
+ for ($x = 0; $x <= $arr_size; $x++) {
5386
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5387
+ }
5388
+ } else {
5389
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5390
+ }
5391
+ }
5392
+ break;
5393
+ case($pr_array['condition'] = "="):
5394
+ if (($pr_array['criteria'] == "$pd_value")){
5395
+ // Specifically for shipping price rules
5396
+ if(is_array($product_data[$pr_array['than_attribute']])){
5397
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5398
+ for ($x = 0; $x <= $arr_size; $x++) {
5399
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5400
+ }
5401
+ } else {
5402
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5403
+ }
5404
+ }
5405
+ $ship = $product_data['shipping'];
5406
+ break;
5407
+ case($pr_array['condition'] = "!="):
5408
+ if (($pr_array['criteria'] != "$pd_value")){
5409
+ // Specifically for shipping price rules
5410
+ if(is_array($product_data[$pr_array['than_attribute']])){
5411
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5412
+ for ($x = 0; $x <= $arr_size; $x++) {
5413
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5414
+ }
5415
+ } else {
5416
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5417
+ }
5418
+ }
5419
+ break;
5420
+ case($pr_array['condition'] = ">"):
5421
+ // Use a lexical order on relational string operators
5422
+ if (($pd_value > $pr_array['criteria'])){
5423
+ // Specifically for shipping price rules
5424
+ if(is_array($product_data[$pr_array['than_attribute']])){
5425
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5426
+ for ($x = 0; $x <= $arr_size; $x++) {
5427
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5428
+ }
5429
+ } else {
5430
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5431
+ }
5432
+ }
5433
+ break;
5434
+ case($pr_array['condition'] = ">="):
5435
+ // Use a lexical order on relational string operators
5436
+ if (($pd_value >= $pr_array['criteria'])){
5437
+ // Specifically for shipping price rules
5438
+ if(is_array($product_data[$pr_array['than_attribute']])){
5439
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5440
+ for ($x = 0; $x <= $arr_size; $x++) {
5441
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5442
+ }
5443
+ } else {
5444
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5445
+ }
5446
+ }
5447
+ break;
5448
+ case($pr_array['condition'] = "<"):
5449
+ // Use a lexical order on relational string operators
5450
+ if (($pd_value < $pr_array['criteria'])){
5451
+ // Specifically for shipping price rules
5452
+ if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
5453
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5454
+ for ($x = 0; $x <= $arr_size; $x++) {
5455
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5456
+ }
5457
+ } else {
5458
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5459
+ }
5460
+ }
5461
+ break;
5462
+ case($pr_array['condition'] = "=<"):
5463
+ // Use a lexical order on relational string operators
5464
+ if (($pd_value <= $pr_array['criteria'])){
5465
+ // Specifically for shipping price rules
5466
+ if(is_array($product_data[$pr_array['than_attribute']])){
5467
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5468
+ for ($x = 0; $x <= $arr_size; $x++) {
5469
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5470
+ }
5471
+ } else {
5472
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5473
+ }
5474
+ }
5475
+ break;
5476
+
5477
+ case($pr_array['condition'] = "empty"):
5478
+ if(empty($product_data[$pr_array['attribute']])){
5479
+ if(empty($product_data[$pr_array['than_attribute']])){
5480
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5481
+ } else {
5482
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5483
+ }
5484
+ }
5485
+ break;
5486
+ case($pr_array['condition'] = "replace"):
5487
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
5488
+ break;
5489
  case($pr_array['condition'] = "findreplace"):
5490
  if (strpos($pd_value, $pr_array['criteria']) !== false){
5491
+ // Make sure that a new value has been set
5492
+ if(!empty($pr_array['newvalue'])){
5493
+ // Find and replace only work on same attribute field, otherwise create a contains rule
5494
  if($pr_array['attribute'] == $pr_array['than_attribute']){
5495
+ $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
5496
+ //$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
5497
+ $product_data[$pr_array['than_attribute']] = $newvalue;
5498
+ }
5499
+ }
5500
+ }
5501
  break;
5502
+ default:
5503
+ break;
5504
+ }
5505
+ }
5506
+ } else {
5507
+ // When a rule has been set on an attribute that is not in product_data
5508
+ // Add the newvalue to product_data
5509
+ if (!array_key_exists($pr_array['attribute'], $product_data)){
5510
  if(!empty($pr_array['newvalue'])){
5511
+ if ($pr_array['condition'] == "empty") {
5512
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5513
+ }
5514
  } else {
5515
+ if(!empty($pr_array['than_attribute'])){
5516
+ if(array_key_exists($pr_array['than_attribute'], $product_data)){
5517
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5518
+ }
5519
  }
5520
+ }
5521
+ }
5522
+ }
5523
+ }
5524
+ }
5525
+ }
5526
+ return $product_data;
5527
+ }
5528
 
5529
  /**
5530
  * Function to exclude products based on individual product exclusions
5547
  }
5548
  }
5549
 
5550
+
5551
+ /**
5552
+ * Execute project filters (include / exclude)
5553
+ */
5554
  private function woocommerce_sea_filters( $project_rules, $product_data ){
5555
+ $allowed = 1;
5556
 
5557
+ // Check if product was already excluded from the feed
5558
+ $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
5559
 
5560
+ if( $product_excluded == "Yes"){
5561
+ $allowed = 0;
5562
+ }
5563
 
5564
+ foreach ($project_rules as $pr_key => $pr_array){
5565
 
5566
+ if($pr_array['attribute'] == "categories"){
5567
+ $pr_array['attribute'] = "raw_categories";
5568
  }
5569
 
5570
+ if(!array_key_exists($pr_array['attribute'], $product_data)) {
5571
+ $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
5572
+ }
 
 
5573
 
5574
+ foreach ($product_data as $pd_key => $pd_value){
5575
+ // Check is there is a rule on specific attributes
5576
+ if(in_array($pd_key, $pr_array, TRUE)){
5577
+ if($pd_key == "price" || $pd_key == "regular_price"){
5578
+ //$pd_value = @number_format($pd_value,2);
5579
+ $pd_value = wc_format_decimal($pd_value);
5580
+ }
5581
 
5582
+ if (is_numeric($pd_value)){
5583
+ $old_value = $pd_value;
5584
+ if($pd_key == "price" || $pd_key == "regular_price"){
5585
+ $pd_value = @number_format($pd_value,2);
5586
+ }
5587
 
5588
+ // Rules for numeric values
5589
+ switch ($pr_array['condition']) {
5590
+ case($pr_array['condition'] = "contains"):
5591
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5592
+ $allowed = 0;
5593
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5594
+ $allowed = 0;
5595
+ }
5596
+ break;
5597
+ case($pr_array['condition'] = "containsnot"):
5598
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5599
+ $allowed = 0;
5600
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5601
+ $allowed = 0;
5602
+ }
5603
+ break;
 
 
 
 
 
 
 
 
 
 
 
5604
  case($pr_array['condition'] = "="):
5605
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5606
+ $allowed = 0;
5607
+ } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5608
+ $allowed = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5609
  }
5610
+ break;
5611
+ case($pr_array['condition'] = "!="):
5612
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5613
+ if($allowed <> 0){
5614
+ $allowed = 1;
5615
+ }
5616
+ } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5617
+ $allowed = 0;
5618
+ }
5619
+ break;
5620
+ case($pr_array['condition'] = ">"):
5621
+ if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5622
+ $allowed = 0;
5623
+ } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5624
+ $allowed = 0;
5625
+ }
5626
+ break;
5627
+ case($pr_array['condition'] = ">="):
5628
+ if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5629
+ $allowed = 0;
5630
+ } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5631
+ $allowed = 0;
5632
+ }
5633
+ break;
5634
+ case($pr_array['condition'] = "<"):
5635
+ if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5636
+ $allowed = 0;
5637
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5638
+ $allowed = 0;
5639
+ }
5640
+ break;
5641
+ case($pr_array['condition'] = "=<"):
5642
+ if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5643
+ $allowed = 0;
5644
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5645
+ $allowed = 0;
5646
+ }
5647
+ break;
5648
+ case($pr_array['condition'] = "empty"):
5649
+ if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5650
+ $allowed = 0;
5651
+ } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5652
+ $allowed = 0;
5653
+ }
5654
  break;
5655
+ case($pr_array['condition'] = "notempty"):
5656
+ if ((strlen($pd_value) > 1) && ($pr_array['than'] == "exclude")){
5657
+ $allowed = 0;
5658
+ } elseif ((strlen($pd_value < 0)) && ($pr_array['than'] == "include_only")){
5659
+ $allowed = 0;
5660
+ }
5661
  break;
5662
+ default:
5663
+ break;
5664
+ }
5665
+ } elseif (is_array($pd_value)){
5666
+ // Tis can either be a shipping or product_tag array
5667
+ if(($pr_array['attribute'] == "product_tag") OR ($pr_array['attribute'] == "purchase_note")){
5668
+ $in_tag_array = "not";
5669
+
5670
+ foreach($pd_value as $pt_key => $pt_value){
5671
+ // Rules for string values
5672
+ if (!array_key_exists('cs', $pr_array)){
5673
+ $pt_value = strtolower($pt_value);
5674
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5675
+ }
5676
+
5677
+ if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5678
+ $in_tag_array = "yes";
5679
+ }
5680
+ }
5681
+
5682
+ if($in_tag_array == "yes"){
5683
+ //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5684
+ $v = $pr_array['criteria'];
5685
+ switch ($pr_array['condition']) {
5686
+ case($pr_array['condition'] = "contains"):
5687
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5688
+ if($pr_array['than'] == "include_only"){
5689
+ if($allowed <> 0){
5690
+ $allowed = 1;
5691
+ }
5692
+ } else {
5693
+ $allowed = 0;
5694
+ }
5695
+ } else {
5696
+ $allowed = 0;
5697
+ }
5698
+ break;
5699
+ case($pr_array['condition'] = "containsnot"):
5700
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5701
+ if($pr_array['than'] == "include_only"){
5702
+ if($allowed <> 0){
5703
+ $allowed = 1;
5704
+ }
5705
+ } else {
5706
+ $allowed = 0;
5707
+ }
5708
+ } else {
5709
+ $allowed = 0;
5710
+ }
5711
+ break;
5712
+ case($pr_array['condition'] = "="):
5713
+ if (($v == $pr_array['criteria'])){
5714
+ if($pr_array['than'] == "include_only"){
5715
+ if($allowed <> 0){
5716
+ $allowed = 1;
5717
+ }
5718
+ } else {
5719
+ $allowed = 0;
5720
+ }
5721
+ } else {
5722
+ $allowed = 0;
5723
+ }
5724
+ break;
5725
+ case($pr_array['condition'] = "!="):
5726
+ if (($v != $pr_array['criteria'])){
5727
+ if($pr_array['than'] == "include_only"){
5728
+ if($allowed <> 0){
5729
+ $allowed = 1;
5730
+ }
5731
+ } else {
5732
+ $allowed = 0;
5733
+ }
5734
+ }
5735
+ break;
5736
+ case($pr_array['condition'] = ">"):
5737
+ if (($v > $pr_array['criteria'])){
5738
+ if($pr_array['than'] == "include_only"){
5739
+ if($allowed <> 0){
5740
+ $allowed = 1;
5741
+ }
5742
+ } else {
5743
+ $allowed = 0;
5744
+ }
5745
+ }
5746
+ break;
5747
+ case($pr_array['condition'] = ">="):
5748
+ if (($v >= $pr_array['criteria'])){
5749
+ if($pr_array['than'] == "include_only"){
5750
+ if($allowed <> 0){
5751
+ $allowed = 1;
5752
+ }
5753
+ } else {
5754
+ $allowed = 0;
5755
+ }
5756
+ }
5757
+ break;
5758
+ case($pr_array['condition'] = "<"):
5759
+ if (($v < $pr_array['criteria'])){
5760
+ if($pr_array['than'] == "include_only"){
5761
+ if($allowed <> 0){
5762
+ $allowed = 1;
5763
+ }
5764
+ } else {
5765
+ $allowed = 0;
5766
+ }
5767
+ }
5768
+ break;
5769
+ case($pr_array['condition'] = "=<"):
5770
+ if (($v <= $pr_array['criteria'])){
5771
+ if($pr_array['than'] == "include_only"){
5772
+ if($allowed <> 0){
5773
+ $allowed = 1;
5774
+ }
5775
+ } else {
5776
+ $allowed = 0;
5777
+ }
5778
+ }
5779
+ break;
5780
+ case($pr_array['condition'] = "empty"):
5781
+ if (strlen($v) < 1){
5782
+ if($pr_array['than'] == "include_only"){
5783
+ if($allowed <> 0){
5784
+ $allowed = 1;
5785
+ }
5786
+ } else {
5787
+ if(!empty($pt_value)){
5788
+ $allowed = 1;
5789
+ } else {
5790
+ $allowed = 0;
5791
+ }
5792
+ }
5793
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5794
  break;
5795
+ case($pr_array['condition'] = "notempty"):
5796
+ if (strlen($v) > 1){
5797
+ if($pr_array['than'] == "include_only"){
5798
+ if($allowed <> 0){
5799
+ $allowed = 1;
5800
+ }
5801
+ } else {
5802
+ if(!empty($pt_value)){
5803
+ $allowed = 1;
5804
+ } else {
5805
+ $allowed = 0;
5806
+ }
5807
+ }
5808
+ }
5809
  break;
5810
+ default:
5811
+ break;
5812
+ }
5813
+ } else {
5814
+ switch ($pr_array['condition']) {
5815
+ case($pr_array['condition'] = "contains"):
5816
+ if($pr_array['than'] == "include_only"){
5817
+ $allowed = 0;
5818
+ } else {
5819
+ if($allowed <> 0){
5820
+ $allowed = 1;
5821
+ }
5822
+ }
5823
+ break;
5824
+ case($pr_array['condition'] = "containsnot"):
5825
+ if($pr_array['than'] == "include_only"){
5826
+ if($allowed <> 0){
5827
+ $allowed = 1;
5828
+ }
5829
+ } else {
5830
+ $allowed = 0;
5831
+ }
5832
+ break;
5833
+ case($pr_array['condition'] = "="):
5834
+ if($pr_array['than'] == "include_only"){
5835
+ $allowed = 0;
5836
+ } else {
5837
+ if($allowed <> 0){
5838
+ $allowed = 1;
5839
+ }
5840
+ }
5841
+ break;
5842
+ case($pr_array['condition'] = "!="):
5843
+ if($pr_array['than'] == "include_only"){
5844
+ if($allowed <> 0){
5845
+ $allowed = 1;
5846
+ }
5847
+ } else {
5848
+ $allowed = 0;
5849
+ }
5850
+ break;
5851
+ case($pr_array['condition'] = ">"):
5852
+ if($pr_array['than'] == "include_only"){
5853
+ $allowed = 0;
5854
+ } else {
5855
+ $allowed = 0;
5856
+ }
5857
+ break;
5858
+ case($pr_array['condition'] = ">="):
5859
+ if($pr_array['than'] == "include_only"){
5860
+ $allowed = 0;
5861
+ } else {
5862
+ $allowed = 0;
5863
+ }
5864
+ break;
5865
+ case($pr_array['condition'] = "<"):
5866
+ if($pr_array['than'] == "include_only"){
5867
+ $allowed = 0;
5868
+ } else {
5869
+ $allowed = 0;
5870
+ }
5871
+ break;
5872
+ case($pr_array['condition'] = "=<"):
5873
+ if($pr_array['than'] == "include_only"){
5874
+ $allowed = 0;
5875
+ } else {
5876
+ $allowed = 0;
5877
+ }
5878
+ break;
5879
+ case($pr_array['condition'] = "empty"):
5880
+ if($pr_array['than'] == "include_only"){
5881
+ if($allowed <> 0){
5882
+ $allowed = 1;
5883
+ }
5884
+ } else {
5885
+ $allowed = 0;
5886
+ }
5887
  break;
5888
+ case($pr_array['condition'] = "notempty"):
5889
+ if($pr_array['than'] == "include_only"){
5890
+ if($allowed <> 0){
5891
+ $allowed = 0;
5892
+ }
5893
+ } else {
5894
+ $allowed = 1;
5895
+ }
5896
  break;
5897
+ default:
5898
+ break;
5899
+ }
5900
+ }
5901
+ } else {
5902
+ // For now only shipping details are in an array
5903
+ foreach ($pd_value as $k => $v){
5904
+ foreach ($v as $kk => $vv){
5905
+ // Only shipping detail rule can be on price for now
5906
+ if($kk == "price"){
5907
+ switch ($pr_array['condition']) {
5908
+ case($pr_array['condition'] = "contains"):
5909
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5910
+ $allowed = 0;
5911
+ }
5912
+ break;
5913
+ case($pr_array['condition'] = "containsnot"):
5914
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5915
+ $allowed = 0;
5916
+ }
5917
+ break;
5918
+ case($pr_array['condition'] = "="):
5919
+ if (($vv == $pr_array['criteria'])){
5920
+ $allowed = 0;
5921
+ }
5922
+ break;
5923
+ case($pr_array['condition'] = "!="):
5924
+ if (($vv != $pr_array['criteria'])){
5925
+ $allowed = 0;
5926
+ }
5927
+ break;
5928
+ case($pr_array['condition'] = ">"):
5929
+ if (($vv > $pr_array['criteria'])){
5930
+ $allowed = 0;
5931
+ }
5932
+ break;
5933
+ case($pr_array['condition'] = ">="):
5934
+ if (($vv >= $pr_array['criteria'])){
5935
+ $allowed = 0;
5936
+ }
5937
+ break;
5938
+ case($pr_array['condition'] = "<"):
5939
+ if (($vv < $pr_array['criteria'])){
5940
+ $allowed = 0;
5941
+ }
5942
+ break;
5943
+ case($pr_array['condition'] = "=<"):
5944
+ if (($vv <= $pr_array['criteria'])){
5945
+ $allowed = 0;
5946
+ }
5947
+ break;
5948
+ case($pr_array['condition'] = "empty"):
5949
+ if (strlen($vv) < 1){
5950
+ $allowed = 0;
5951
+ }
5952
  break;
5953
+ case($pr_array['condition'] = "notempty"):
5954
+ if (strlen($vv) > 1){
5955
+ $allowed = 0;
5956
+ }
5957
  break;
5958
+ default:
5959
+ break;
5960
+ }
5961
+ }
5962
+ }
5963
+ }
5964
+ }
5965
+ } else {
5966
+ // Filters for string values
5967
+ // If case-sensitve is off than lowercase both the criteria and attribute value
5968
+ if (array_key_exists('cs', $pr_array)){
5969
+ if ($pr_array['cs'] != "on"){
5970
+ $pd_value = strtolower($pd_value);
5971
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5972
+ }
5973
+ }
5974
+ $pos = strpos($pd_value, '&amp;');
5975
+ $pos_slash = strpos($pr_array['criteria'], '\\');
5976
+ if($pos !== false){
5977
+ $pd_value = str_replace("&amp;","&",$pd_value);
5978
+ }
5979
+ if($pos_slash !== false){
5980
+ $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5981
+ }
5982
 
5983
+ switch ($pr_array['condition']) {
5984
+ case($pr_array['condition'] = "contains"):
5985
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5986
+ $allowed = 0;
5987
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5988
+ $allowed = 0;
5989
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5990
+ if($allowed <> 0){
5991
+ $allowed = 1;
5992
+ }
5993
+ }
5994
+ break;
5995
+ case($pr_array['condition'] = "containsnot"):
5996
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5997
+ $allowed = 0;
5998
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5999
+ $allowed = 0;
6000
+ }
6001
+ break;
6002
  case($pr_array['condition'] = "="):
6003
+ if (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
6004
  $allowed = 0;
6005
  } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
6006
  $found = strpos($pd_value,$pr_array['criteria']);
6007
+ if ($found !== false) {
6008
+ //for category mapping check if its an array
6009
+ if($pr_array['attribute'] == "raw_categories"){
6010
+ $raw_cats_arr = explode("||",$pd_value);
6011
+ if(is_array($raw_cats_arr)){
6012
+ if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
6013
+ if($allowed <> 0){
6014
+ $allowed = 1;
6015
+ }
6016
+ } else {
6017
+ $allowed = 0;
6018
+ }
6019
+ }
6020
+ } else {
6021
+ if($allowed <> 0){
6022
+ $allowed = 1;
6023
+ }
6024
+ }
6025
+ } else {
6026
+ $allowed = 0;
6027
+ }
6028
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
 
 
 
 
 
 
 
 
 
 
 
6029
  if($allowed <> 0){
6030
+ $allowed = 1;
6031
+ }
6032
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
6033
+ // $allowed = 0;
6034
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
6035
+ $allowed = 1;
6036
+ } else {
6037
+ // $allowed = 1; // Change made on February 24th 2021
6038
+ }
6039
+ break;
6040
+ case($pr_array['condition'] = "!="):
6041
+ if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
6042
+ if($allowed <> 0){
6043
+ $allowed = 1;
6044
+ }
6045
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
6046
+ $allowed = 0;
6047
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
6048
+ $allowed = 0;
6049
+ }
6050
+ break;
6051
+ case($pr_array['condition'] = ">"):
6052
+ // Use a lexical order on relational string operators
6053
+ if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
6054
+ $allowed = 0;
6055
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
6056
+ $allowed = 0;
6057
+ }
6058
+ break;
6059
+ case($pr_array['condition'] = ">="):
6060
+ // Use a lexical order on relational string operators
6061
+ if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
6062
+ $allowed = 0;
6063
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
6064
+ $allowed = 0;
6065
+ }
6066
+ break;
6067
+ case($pr_array['condition'] = "<"):
6068
+ // Use a lexical order on relational string operators
6069
+ if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
6070
+ $allowed = 0;
6071
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
6072
+ $allowed = 0;
6073
+ }
6074
+ break;
6075
+ case($pr_array['condition'] = "=<"):
6076
+ // Use a lexical order on relational string operators
6077
+ if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
6078
+ $allowed = 0;
6079
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
6080
+ $allowed = 0;
6081
+ }
6082
+ break;
6083
+ case($pr_array['condition'] = "empty"):
6084
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
6085
+ $allowed = 0;
6086
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
6087
+ if($allowed <> 0){
6088
+ $allowed = 1;
6089
+ }
6090
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
6091
+ $allowed = 0;
6092
+ }
 
 
6093
  break;
6094
+ case($pr_array['condition'] = "notempty"):
6095
+ if ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
6096
+ $allowed = 0;
6097
+ } elseif ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
6098
+ if($allowed <> 0){
6099
+ $allowed = 1;
6100
+ }
6101
+ } elseif ((strlen($pd_value) < 1) && ($pr_array['than'] == "include_only")){
6102
+ $allowed = 0;
6103
+ }
6104
+ break;
6105
+ default:
6106
+ break;
6107
+ }
6108
+ }
6109
+ }
6110
+ }
6111
+ }
6112
 
6113
+ if ($allowed < 1){
6114
+ $product_data = array();
6115
+ $product_data = null;
6116
+ } else {
6117
+ return $product_data;
6118
+ }
6119
+ }
6120
  }
css/woosea_admin.css CHANGED
@@ -5,7 +5,7 @@
5
  margin-right: 24px;
6
  padding: 8px 12px;
7
  position: absolute;
8
- z-index: 1000;
9
  }
10
  .typeahead {
11
  background-color: #FFFFFF;
@@ -260,13 +260,16 @@ input:checked + .woo-product-feed-pro-slider:before {
260
  .woo-product-feed-pro-form-style-2 .input-field-midsmall:focus,
261
  .woo-product-feed-pro-form-style-2 .input-field-small:focus,
262
  .woo-product-feed-pro-form-style-2 .input-field-medium:focus,
 
263
  .woo-product-feed-pro-form-style-2 .textarea-field:focus,
 
264
  .woo-product-feed-pro-form-style-2 .select-field:focus{
265
  border: 1px solid #0C0;
266
  }
267
  .woo-product-feed-pro-form-style-2 .textarea-field{
268
  height:100px;
269
  width: 55%;
 
270
  }
271
  .woo-product-feed-pro-form-style-2 input[type=submit],
272
  .woo-product-feed-pro-form-style-2 input[type=button]{
5
  margin-right: 24px;
6
  padding: 8px 12px;
7
  position: absolute;
8
+ /* z-index: 1000;*/
9
  }
10
  .typeahead {
11
  background-color: #FFFFFF;
260
  .woo-product-feed-pro-form-style-2 .input-field-midsmall:focus,
261
  .woo-product-feed-pro-form-style-2 .input-field-small:focus,
262
  .woo-product-feed-pro-form-style-2 .input-field-medium:focus,
263
+ /*
264
  .woo-product-feed-pro-form-style-2 .textarea-field:focus,
265
+ */
266
  .woo-product-feed-pro-form-style-2 .select-field:focus{
267
  border: 1px solid #0C0;
268
  }
269
  .woo-product-feed-pro-form-style-2 .textarea-field{
270
  height:100px;
271
  width: 55%;
272
+ word-break: break-all;
273
  }
274
  .woo-product-feed-pro-form-style-2 input[type=submit],
275
  .woo-product-feed-pro-form-style-2 input[type=button]{
js/woosea_add_cart.js CHANGED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ //localStorage.removeItem("attributes");
3
+ $( "select" ).change(function() {
4
+
5
+ //localStorage.removeItem("attributes");
6
+ var productId = $('input[name=product_id]').val();
7
+ var selectedName = $(this).attr("name");
8
+ var selectedValue = $(this).find('option:selected').text();
9
+ var storedAttributes = JSON.parse(localStorage.getItem("attributes"));
10
+
11
+ // Already saved a selection in local storage
12
+ if(storedAttributes){
13
+ // Only add new selections to the local storage
14
+ var len_value = selectedValue.length;
15
+ if(len_value > 0){
16
+ storedAttributes[selectedName] = selectedValue;
17
+ localStorage.setItem("attributes", JSON.stringify(storedAttributes));
18
+ }
19
+ } else {
20
+ var json_attributes = new Object();
21
+ json_attributes.productId = productId;
22
+ json_attributes[selectedName] = selectedValue;
23
+ localStorage.setItem("attributes", JSON.stringify(json_attributes));
24
+ }
25
+
26
+ var storedAttributes = JSON.parse(localStorage.getItem("attributes"));
27
+
28
+ // Now AJAX call to save in options
29
+ var inputdata = {
30
+ 'action': 'woosea_storedattributes_details',
31
+ 'data_to_pass': productId,
32
+ 'storedAttributes': storedAttributes,
33
+ }
34
+
35
+ $.post(frontEndAjax.ajaxurl, inputdata, function( response ) {
36
+ }, 'json' );
37
+
38
+ console.log(storedAttributes);
39
+ });
40
+
41
+ // For shop pages
42
+ $(".add_to_cart_button").click(function(){
43
+ var productId = $(this).attr('data-product_id');
44
+
45
+ console.log(productId);
46
+
47
+ // Ajax frontend
48
+ var inputdata = {
49
+ 'action': 'woosea_addtocart_details',
50
+ 'data_to_pass': productId,
51
+ }
52
+
53
+ $.post(frontEndAjax.ajaxurl, inputdata, function( response ) {
54
+ fbq("track", "AddToCart", {
55
+ content_ids: "['" + response.product_id + "']",
56
+ content_name: response.product_name,
57
+ content_category: response.product_cats,
58
+ content_type: "product",
59
+ value: response.product_price,
60
+ currency: response.product_currency,
61
+ });
62
+ }, 'json' );
63
+ });
64
+
65
+ // For product pages
66
+ $(".single_add_to_cart_button").click(function(){
67
+ var productId = $('input[name=product_id]').val();
68
+
69
+ if(!productId){
70
+ productId = $(this).attr('value');
71
+ }
72
+
73
+ console.log(productId);
74
+
75
+ // Ajax frontend
76
+ var inputdata = {
77
+ 'action': 'woosea_addtocart_details',
78
+ 'data_to_pass': productId,
79
+ }
80
+
81
+ $.post(frontEndAjax.ajaxurl, inputdata, function( response ) {
82
+
83
+ fbq("track", "AddToCart", {
84
+ content_ids: "['" + response.product_id + "']",
85
+ content_name: response.product_name,
86
+ content_category: response.product_cats,
87
+ content_type: "product",
88
+ value: response.product_price,
89
+ currency: response.product_currency,
90
+ });
91
+ }, 'json' );
92
+ });
93
+ });
js/woosea_autocomplete.js CHANGED
@@ -5586,6 +5586,7 @@ jQuery(document).ready(function($) {
5586
  ];
5587
 
5588
  jQuery(".dashicons-arrow-down").on('click', function(){
 
5589
  var className = $(this).attr("class").split(' ')[2];
5590
  var rowCount = className.split("_")[2];
5591
  var map_to_category = $(".autocomplete_" + rowCount).val();
@@ -5617,11 +5618,15 @@ jQuery(document).ready(function($) {
5617
  $('.autocomplete_' + rowCountLoop).addClass("input-field-large-active");
5618
  });
5619
 
5620
-
5621
  jQuery.ajax({
5622
  method: "POST",
5623
  url: ajaxurl,
5624
- data: { 'action': 'woosea_add_mass_cat_mapping', 'project_hash': project_hash, 'catMappings': toAjax }
 
 
 
 
 
5625
  })
5626
 
5627
  .done(function( data ) {
@@ -5638,6 +5643,7 @@ jQuery(document).ready(function($) {
5638
 
5639
 
5640
  jQuery(".dashicons-arrow-down-alt").on('click',function(){
 
5641
  var className = $(this).attr("class").split(' ')[2];
5642
  var rowCount = className.split("_")[2]
5643
  var map_to_category = $(".autocomplete_" + rowCount).val();
@@ -5674,7 +5680,12 @@ jQuery(document).ready(function($) {
5674
  jQuery.ajax({
5675
  method: "POST",
5676
  url: ajaxurl,
5677
- data: { 'action': 'woosea_add_mass_cat_mapping', 'project_hash': project_hash, 'catMappings': toAjax }
 
 
 
 
 
5678
  })
5679
 
5680
  .done(function( data ) {
@@ -5695,8 +5706,10 @@ jQuery(document).ready(function($) {
5695
  jQuery(".js-autosuggest").on('click',function(){
5696
  var className = $(this).attr("class").split(' ')[3];
5697
  var rowCount = className.split("_")[1]
5698
-
5699
- jQuery( ".autocomplete_" + rowCount ).typeahead({
 
 
5700
  input: '.js-autosuggest',
5701
  source: google_taxonomy,
5702
  hint: true,
@@ -5708,7 +5721,6 @@ jQuery(document).ready(function($) {
5708
  });
5709
  jQuery( ".autocomplete_" + rowCount ).focus();
5710
 
5711
-
5712
  jQuery(this).on('change', function(){ // on change of state
5713
 
5714
  var minimum = 1;
@@ -5725,7 +5737,14 @@ jQuery(document).ready(function($) {
5725
  jQuery.ajax({
5726
  method: "POST",
5727
  url: ajaxurl,
5728
- data: { 'action': 'woosea_add_cat_mapping', 'rowCount': rowCount, 'map_to_category': map_to_category, 'className': className, 'project_hash': project_hash, 'criteria': criteria }
 
 
 
 
 
 
 
5729
  })
5730
 
5731
  .done(function( data ) {
@@ -5741,11 +5760,17 @@ jQuery(document).ready(function($) {
5741
  }
5742
  } else {
5743
  var map_to_category = "";
5744
-
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
5748
- data: { 'action': 'woosea_add_cat_mapping', 'rowCount': rowCount, 'map_to_category': map_to_category, 'className': className, 'project_hash': project_hash, 'criteria': criteria }
 
 
 
 
 
 
 
5749
  })
5750
 
5751
  .done(function( data ) {
5586
  ];
5587
 
5588
  jQuery(".dashicons-arrow-down").on('click', function(){
5589
+ var nonce = $('#nonce_category_mapping').val();
5590
  var className = $(this).attr("class").split(' ')[2];
5591
  var rowCount = className.split("_")[2];
5592
  var map_to_category = $(".autocomplete_" + rowCount).val();
5618
  $('.autocomplete_' + rowCountLoop).addClass("input-field-large-active");
5619
  });
5620
 
 
5621
  jQuery.ajax({
5622
  method: "POST",
5623
  url: ajaxurl,
5624
+ data: {
5625
+ 'action': 'woosea_add_mass_cat_mapping',
5626
+ 'security': nonce,
5627
+ 'project_hash': project_hash,
5628
+ 'catMappings': toAjax
5629
+ }
5630
  })
5631
 
5632
  .done(function( data ) {
5643
 
5644
 
5645
  jQuery(".dashicons-arrow-down-alt").on('click',function(){
5646
+ var nonce = $('#nonce_category_mapping').val();
5647
  var className = $(this).attr("class").split(' ')[2];
5648
  var rowCount = className.split("_")[2]
5649
  var map_to_category = $(".autocomplete_" + rowCount).val();
5680
  jQuery.ajax({
5681
  method: "POST",
5682
  url: ajaxurl,
5683
+ data: {
5684
+ 'action': 'woosea_add_mass_cat_mapping',
5685
+ 'security': nonce,
5686
+ 'project_hash': project_hash,
5687
+ 'catMappings': toAjax
5688
+ }
5689
  })
5690
 
5691
  .done(function( data ) {
5706
  jQuery(".js-autosuggest").on('click',function(){
5707
  var className = $(this).attr("class").split(' ')[3];
5708
  var rowCount = className.split("_")[1]
5709
+
5710
+ //$('#the-basics-11603 .autocomplete_11603').typeahead({
5711
+ jQuery("." + className).typeahead({
5712
+ //jQuery(".autocomplete_" + rowCount ).typeahead({
5713
  input: '.js-autosuggest',
5714
  source: google_taxonomy,
5715
  hint: true,
5721
  });
5722
  jQuery( ".autocomplete_" + rowCount ).focus();
5723
 
 
5724
  jQuery(this).on('change', function(){ // on change of state
5725
 
5726
  var minimum = 1;
5737
  jQuery.ajax({
5738
  method: "POST",
5739
  url: ajaxurl,
5740
+ data: {
5741
+ 'action': 'woosea_add_cat_mapping',
5742
+ 'rowCount': rowCount,
5743
+ 'map_to_category': map_to_category,
5744
+ 'className': className,
5745
+ 'project_hash': project_hash,
5746
+ 'criteria': criteria
5747
+ }
5748
  })
5749
 
5750
  .done(function( data ) {
5760
  }
5761
  } else {
5762
  var map_to_category = "";
 
5763
  jQuery.ajax({
5764
  method: "POST",
5765
  url: ajaxurl,
5766
+ data: {
5767
+ 'action': 'woosea_add_cat_mapping',
5768
+ 'rowCount': rowCount,
5769
+ 'map_to_category': map_to_category,
5770
+ 'className': className,
5771
+ 'project_hash': project_hash,
5772
+ 'criteria': criteria
5773
+ }
5774
  })
5775
 
5776
  .done(function( data ) {
js/woosea_channel.js CHANGED
@@ -1,8 +1,6 @@
1
  jQuery(document).ready(function($) {
2
-
3
  jQuery("#shipping_zone").on('click', function(){
4
  var variations = ( $( "#shipping_zone" ).is(':checked')) ? 1 : 0;
5
-
6
  if(variations == "1"){
7
  jQuery.ajax({
8
  method: "POST",
@@ -180,5 +178,4 @@ jQuery(document).ready(function($) {
180
  if (project_update == "yes"){
181
  $('#goforit').attr('disabled',false);
182
  }
183
-
184
  });
1
  jQuery(document).ready(function($) {
 
2
  jQuery("#shipping_zone").on('click', function(){
3
  var variations = ( $( "#shipping_zone" ).is(':checked')) ? 1 : 0;
 
4
  if(variations == "1"){
5
  jQuery.ajax({
6
  method: "POST",
178
  if (project_update == "yes"){
179
  $('#goforit').attr('disabled',false);
180
  }
 
181
  });
js/woosea_field_mapping.js CHANGED
@@ -13,29 +13,9 @@ jQuery(document).ready(function($) {
13
  }
14
  });
15
 
16
- // Open jQuery dialog and get the right title and attribute helptext
17
- jQuery( ".opener" ).on( "click", function() {
18
- var id=$(this).attr('id');
19
-
20
- jQuery.ajax({
21
- method: "POST",
22
- url: ajaxurl,
23
- data: { 'action': 'woosea_fieldmapping_dialog_helptext', 'field': id }
24
- })
25
- .done(function( data ) {
26
- data = JSON.parse( data );
27
-
28
- jQuery("#dialogText").text(data.helptext); // set attribute helptext, get it via ajax
29
- $( "#dialog" ).dialog( "open" );
30
- $( "#dialog" ).dialog( "option", "title", id); // set title of dialog window
31
- })
32
- .fail(function( data ) {
33
- console.log('Failed AJAX Call :( /// Return Data: ' + data);
34
- });
35
- });
36
-
37
  // Add a mapping row to the table for field mappings
38
  jQuery(".add-field-mapping").on('click', function(){
 
39
  var channel_hash = $('#channel_hash').val();
40
  var prevRow = $("tr.rowCount:last input[type=hidden]").val();
41
  var addrow_value = $('#addrow').val();
@@ -52,7 +32,12 @@ jQuery(document).ready(function($) {
52
  jQuery.ajax({
53
  method: "POST",
54
  url: ajaxurl,
55
- data: { 'action': 'woosea_fieldmapping_dropdown', 'rowCount': rowCount, 'channel_hash': channel_hash }
 
 
 
 
 
56
  })
57
  .done(function( data ) {
58
  data = JSON.parse( data );
@@ -74,6 +59,7 @@ jQuery(document).ready(function($) {
74
 
75
  // Add a mapping row to the table for own mappings
76
  jQuery(".add-own-mapping").on('click', function(){
 
77
  var channel_hash = $('#channel_hash').val();
78
  var prevRow = $("tr.rowCount:last input[type=hidden]").val();
79
  var addrow_value = $('#addrow').val();
@@ -90,7 +76,12 @@ jQuery(document).ready(function($) {
90
  jQuery.ajax({
91
  method: "POST",
92
  url: ajaxurl,
93
- data: { 'action': 'woosea_fieldmapping_dropdown', 'rowCount': rowCount, 'channel_hash': channel_hash }
 
 
 
 
 
94
  })
95
  .done(function( data ) {
96
  data = JSON.parse( data );
13
  }
14
  });
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  // Add a mapping row to the table for field mappings
17
  jQuery(".add-field-mapping").on('click', function(){
18
+ var nonce = $('#nonce_field_mapping').val();
19
  var channel_hash = $('#channel_hash').val();
20
  var prevRow = $("tr.rowCount:last input[type=hidden]").val();
21
  var addrow_value = $('#addrow').val();
32
  jQuery.ajax({
33
  method: "POST",
34
  url: ajaxurl,
35
+ data: {
36
+ 'action': 'woosea_fieldmapping_dropdown',
37
+ 'rowCount': rowCount,
38
+ 'security': nonce,
39
+ 'channel_hash': channel_hash
40
+ }
41
  })
42
  .done(function( data ) {
43
  data = JSON.parse( data );
59
 
60
  // Add a mapping row to the table for own mappings
61
  jQuery(".add-own-mapping").on('click', function(){
62
+ var nonce = $('#nonce_field_mapping').val();
63
  var channel_hash = $('#channel_hash').val();
64
  var prevRow = $("tr.rowCount:last input[type=hidden]").val();
65
  var addrow_value = $('#addrow').val();
76
  jQuery.ajax({
77
  method: "POST",
78
  url: ajaxurl,
79
+ data: {
80
+ 'action': 'woosea_fieldmapping_dropdown',
81
+ 'security': nonce,
82
+ 'rowCount': rowCount,
83
+ 'channel_hash': channel_hash
84
+ }
85
  })
86
  .done(function( data ) {
87
  data = JSON.parse( data );
js/woosea_key.js CHANGED
@@ -1,5 +1,4 @@
1
  jQuery(document).ready(function($) {
2
-
3
  jQuery("#deactivate_license").on('click', function(){
4
  //jQuery("#deactivate_license").click(function(){
5
  $('.notice').replaceWith("<div class='notice notice-info is-dismissible'><p>Your license has been deactivated.</p></div>");
@@ -27,7 +26,7 @@ jQuery(document).ready(function($) {
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
- url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.3.7',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
@@ -50,7 +49,16 @@ jQuery(document).ready(function($) {
50
  jQuery.ajax({
51
  method: "POST",
52
  url: ajaxurl,
53
- data: { 'action': 'woosea_register_license', 'notice': notice, 'message_type': message_type, 'license_email': license_email, 'license_key': license_key, 'license_valid': license_valid, 'license_created': license_created, 'message': message }
 
 
 
 
 
 
 
 
 
54
  })
55
  .done(function( data ) {
56
  data = JSON.parse( data );
1
  jQuery(document).ready(function($) {
 
2
  jQuery("#deactivate_license").on('click', function(){
3
  //jQuery("#deactivate_license").click(function(){
4
  $('.notice').replaceWith("<div class='notice notice-info is-dismissible'><p>Your license has been deactivated.</p></div>");
26
  var license_key = $('#license-key').val();
27
 
28
  jQuery.ajax({
29
+ url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=10.9.8',
30
  jsonp: 'callback',
31
  dataType: 'jsonp',
32
  type: 'GET',
49
  jQuery.ajax({
50
  method: "POST",
51
  url: ajaxurl,
52
+ data: {
53
+ 'action': 'woosea_register_license',
54
+ 'notice': notice,
55
+ 'message_type': message_type,
56
+ 'license_email': license_email,
57
+ 'license_key': license_key,
58
+ 'license_valid': license_valid,
59
+ 'license_created': license_created,
60
+ 'message': message
61
+ }
62
  })
63
  .done(function( data ) {
64
  data = JSON.parse( data );
js/woosea_manage.js CHANGED
@@ -1,5 +1,6 @@
1
  jQuery(function($) {
2
- //jQuery(document).ready(function($) {
 
3
  var project_hash = null;
4
  var project_status = null;
5
  var get_value = null;
@@ -80,6 +81,7 @@ jQuery(function($) {
80
 
81
  //$('.checkbox-field').change(function(index, obj){
82
  $('.checkbox-field').on('change', function(index, obj){
 
83
 
84
  if(get_value == 'woosea_manage_settings' && tab_value == 'woosea_manage_attributes'){
85
  var attribute_value = $(this).val();
@@ -89,16 +91,26 @@ jQuery(function($) {
89
  jQuery.ajax({
90
  method: "POST",
91
  url: ajaxurl,
92
- data: { 'action': 'woosea_add_attributes', 'attribute_name': attribute_name, 'attribute_value': attribute_value, 'active': attribute_status }
 
 
 
 
 
 
93
  })
94
  } else if (get_value == 'woosea_manage_feed') {
95
- project_hash = $(this).val();
96
  project_status = $(this).prop("checked");
97
 
98
  jQuery.ajax({
99
  method: "POST",
100
  url: ajaxurl,
101
- data: { 'action': 'woosea_project_status', 'project_hash': project_hash, 'active': project_status }
 
 
 
 
102
  })
103
 
104
  $("table tbody").find('input[name="manage_record"]').each(function(){
@@ -256,6 +268,26 @@ jQuery(function($) {
256
  }
257
  })
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  // Check if user would like to enable debug logging
260
  $('#add_woosea_logging').on('change', function(){ // on change of state
261
  if(this.checked){
@@ -276,6 +308,26 @@ jQuery(function($) {
276
  }
277
  })
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  // Check if user would like to add a Facebook Pixel to their website
280
  $('#woosea_content_ids').on('change', function(){ // on change of state
281
  var content_ids = $('#woosea_content_ids').val();
@@ -290,16 +342,22 @@ jQuery(function($) {
290
 
291
  // Check if user would like to add a Facebook Pixel to their website
292
  $('#add_facebook_pixel').on('change', function(){ // on change of state
 
 
293
  if(this.checked){
294
 
295
  // Checkbox is on
296
  jQuery.ajax({
297
  method: "POST",
298
  url: ajaxurl,
299
- data: { 'action': 'woosea_add_facebook_pixel_setting', 'status': "on" }
 
 
 
 
300
  })
301
  .done(function( data ) {
302
- $('#facebook_pixel').after('<tr id="facebook_pixel_id"><td colspan="2"><span>Insert Facebook pixel ID:</span>&nbsp;<input type="text" class="input-field-medium" id="fb_pixel_id" name="fb_pixel_id">&nbsp;<input type="button" id="save_facebook_pixel_id" value="Save"></td></tr>');
303
  })
304
  .fail(function( data ) {
305
  console.log('Failed AJAX Call :( /// Return Data: ' + data);
@@ -309,7 +367,11 @@ jQuery(function($) {
309
  jQuery.ajax({
310
  method: "POST",
311
  url: ajaxurl,
312
- data: { 'action': 'woosea_add_facebook_pixel_setting', 'status': "off" }
 
 
 
 
313
  })
314
  .done(function( data ) {
315
  $('#facebook_pixel_id').remove();
@@ -320,6 +382,49 @@ jQuery(function($) {
320
  }
321
  })
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  // Check if user would like to change the batch size
324
  $('#add_batch').on('change', function(){ // on change of state
325
  if(this.checked){
@@ -333,7 +438,7 @@ jQuery(function($) {
333
  data: { 'action': 'woosea_add_batch', 'status': "on" }
334
  })
335
  .done(function( data ) {
336
- $('#batch').after('<tr id="woosea_batch_size"><td colspan="2"><span>Insert batch size:</span>&nbsp;<input type="text" class="input-field-medium" id="batch_size" name="batch_size">&nbsp;<input type="submit" id="save_batch_size" value="Save"></td></tr>');
337
  })
338
  .fail(function( data ) {
339
  console.log('Failed AJAX Call :( /// Return Data: ' + data);
@@ -355,9 +460,10 @@ jQuery(function($) {
355
  }
356
  })
357
 
358
- // Save Google Dynamic Remarketing pixel ID
359
  jQuery("#save_batch_size").on('click',function(){
360
- var batch_size = $('#batch_size').val();
 
361
  var re = /^[0-9]*$/;
362
 
363
  var woosea_valid_batch_size=re.test(batch_size);
@@ -374,23 +480,33 @@ jQuery(function($) {
374
  jQuery.ajax({
375
  method: "POST",
376
  url: ajaxurl,
377
- data: { 'action': 'woosea_save_batch_size', 'batch_size': batch_size }
 
 
 
 
378
  })
379
  }
380
  })
381
 
382
  // Check if user would like to enable Dynamic Remarketing
383
  $('#add_remarketing').on('change', function(){ // on change of state
384
- if(this.checked){
 
 
385
 
386
  // Checkbox is on
387
  jQuery.ajax({
388
  method: "POST",
389
  url: ajaxurl,
390
- data: { 'action': 'woosea_add_remarketing', 'status': "on" }
 
 
 
 
391
  })
392
  .done(function( data ) {
393
- $('#remarketing').after('<tr id="adwords_conversion_id"><td colspan="2"><span>Insert your Dynamic Remarketing Conversion tracking ID:</span>&nbsp;<input type="text" class="input-field-medium" id="adwords_conv_id" name="adwords_conv_id">&nbsp;<input type="submit" id="save_conversion_id" value="Save"></td></tr>');
394
  })
395
  .fail(function( data ) {
396
  console.log('Failed AJAX Call :( /// Return Data: ' + data);
@@ -400,7 +516,11 @@ jQuery(function($) {
400
  jQuery.ajax({
401
  method: "POST",
402
  url: ajaxurl,
403
- data: { 'action': 'woosea_add_remarketing', 'status': "off" }
 
 
 
 
404
  })
405
  .done(function( data ) {
406
  $('#adwords_conversion_id').remove();
@@ -413,8 +533,9 @@ jQuery(function($) {
413
 
414
  // Save Google Dynamic Remarketing pixel ID
415
  jQuery("#save_conversion_id").on('click',function(){
416
- var adwords_conversion_id = $('#adwords_conv_id').val();
417
- var re = /^[0-9]*$/;
 
418
 
419
  var woosea_valid_conversion_id=re.test(adwords_conversion_id);
420
  // Check for allowed characters
@@ -429,15 +550,20 @@ jQuery(function($) {
429
  // Now we need to save the conversion ID so we can use it in the dynamic remarketing JS
430
  jQuery.ajax({
431
  method: "POST",
432
- url: ajaxurl,
433
- data: { 'action': 'woosea_save_adwords_conversion_id', 'adwords_conversion_id': adwords_conversion_id }
 
 
 
 
434
  })
435
  }
436
  })
437
 
438
  // Save Facebook Pixel ID
439
  jQuery("#save_facebook_pixel_id").on('click',function(){
440
- var facebook_pixel_id = $('#fb_pixel_id').val();
 
441
  var re = /^[0-9]*$/;
442
  var woosea_valid_facebook_pixel_id=re.test(facebook_pixel_id);
443
 
@@ -454,9 +580,41 @@ jQuery(function($) {
454
  jQuery.ajax({
455
  method: "POST",
456
  url: ajaxurl,
457
- data: { 'action': 'woosea_save_facebook_pixel_id', 'facebook_pixel_id': facebook_pixel_id }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  })
459
- //$("#fb_pixel_id").val("ready");
460
  }
461
  })
462
 
@@ -612,7 +770,6 @@ jQuery(function($) {
612
  $(".woo-product-feed-pro-blink_off_"+hash).text(function () {
613
  $(this).addClass('woo-product-feed-pro-blink_me');
614
  var status = $(".woo-product-feed-pro-blink_off_"+hash).text();
615
- console.log("Set interval on manual refresh");
616
  myInterval = setInterval(woosea_check_perc,5000);
617
  if(status == "ready"){
618
  return $(this).text().replace("ready", "processing (0%)");
@@ -636,9 +793,6 @@ jQuery(function($) {
636
 
637
  $("table tbody").find('input[name="manage_record"]').each(function(){
638
  var hash = this.value;
639
-
640
- console.log("Doing a new check again because interval is set");
641
-
642
  jQuery.ajax({
643
  method: "POST",
644
  url: ajaxurl,
1
  jQuery(function($) {
2
+
3
+ //jQuery(document).ready(function($) {
4
  var project_hash = null;
5
  var project_status = null;
6
  var get_value = null;
81
 
82
  //$('.checkbox-field').change(function(index, obj){
83
  $('.checkbox-field').on('change', function(index, obj){
84
+ var csrfToken = $('#csrfToken').val();
85
 
86
  if(get_value == 'woosea_manage_settings' && tab_value == 'woosea_manage_attributes'){
87
  var attribute_value = $(this).val();
91
  jQuery.ajax({
92
  method: "POST",
93
  url: ajaxurl,
94
+ data: {
95
+ 'action': 'woosea_add_attributes',
96
+ 'security': csfrToken,
97
+ 'attribute_name': attribute_name,
98
+ 'attribute_value': attribute_value,
99
+ 'active': attribute_status
100
+ }
101
  })
102
  } else if (get_value == 'woosea_manage_feed') {
103
+ project_hash = $(this).val();
104
  project_status = $(this).prop("checked");
105
 
106
  jQuery.ajax({
107
  method: "POST",
108
  url: ajaxurl,
109
+ data: {
110
+ 'action': 'woosea_project_status',
111
+ 'project_hash': project_hash,
112
+ 'active': project_status
113
+ }
114
  })
115
 
116
  $("table tbody").find('input[name="manage_record"]').each(function(){
268
  }
269
  })
270
 
271
+ // Check if user would like the plugin to remove the free shipping class
272
+ $('#remove_free_shipping').on('change', function(){ // on change of state
273
+ if(this.checked){
274
+
275
+ // Checkbox is on
276
+ jQuery.ajax({
277
+ method: "POST",
278
+ url: ajaxurl,
279
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "on" }
280
+ })
281
+ } else {
282
+ // Checkbox is off
283
+ jQuery.ajax({
284
+ method: "POST",
285
+ url: ajaxurl,
286
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "off" }
287
+ })
288
+ }
289
+ })
290
+
291
  // Check if user would like to enable debug logging
292
  $('#add_woosea_logging').on('change', function(){ // on change of state
293
  if(this.checked){
308
  }
309
  })
310
 
311
+ // Check if user would like to enable addition of CDATA
312
+ $('#add_woosea_cdata').on('change', function(){ // on change of state
313
+ if(this.checked){
314
+
315
+ // Checkbox is on
316
+ jQuery.ajax({
317
+ method: "POST",
318
+ url: ajaxurl,
319
+ data: { 'action': 'woosea_add_woosea_cdata', 'status': "on" }
320
+ })
321
+ } else {
322
+ // Checkbox is off
323
+ jQuery.ajax({
324
+ method: "POST",
325
+ url: ajaxurl,
326
+ data: { 'action': 'woosea_add_woosea_cdata', 'status': "off" }
327
+ })
328
+ }
329
+ })
330
+
331
  // Check if user would like to add a Facebook Pixel to their website
332
  $('#woosea_content_ids').on('change', function(){ // on change of state
333
  var content_ids = $('#woosea_content_ids').val();
342
 
343
  // Check if user would like to add a Facebook Pixel to their website
344
  $('#add_facebook_pixel').on('change', function(){ // on change of state
345
+ var nonce = $('#add_facebook_pixel').val();
346
+
347
  if(this.checked){
348
 
349
  // Checkbox is on
350
  jQuery.ajax({
351
  method: "POST",
352
  url: ajaxurl,
353
+ data: {
354
+ 'action': 'woosea_add_facebook_pixel_setting',
355
+ 'security': nonce,
356
+ 'status': "on"
357
+ }
358
  })
359
  .done(function( data ) {
360
+ $('#facebook_pixel').after('<tr id="facebook_pixel_id"><td colspan="2"><span>Insert Facebook pixel ID:</span>&nbsp;<input type=\"hidden\" name=\"nonce_facebook_pixel_id\" id=\"nonce_facebook_pixel_id\" value=\"'+ nonce +'\"><input type="text" class="input-field-medium" id="fb_pixel_id" name="fb_pixel_id">&nbsp;<input type="button" id="save_facebook_pixel_id" value="Save"></td></tr>');
361
  })
362
  .fail(function( data ) {
363
  console.log('Failed AJAX Call :( /// Return Data: ' + data);
367
  jQuery.ajax({
368
  method: "POST",
369
  url: ajaxurl,
370
+ data: {
371
+ 'action': 'woosea_add_facebook_pixel_setting',
372
+ 'security': nonce,
373
+ 'status': "off"
374
+ }
375
  })
376
  .done(function( data ) {
377
  $('#facebook_pixel_id').remove();
382
  }
383
  })
384
 
385
+ // Check if user would like to enable the Facebook Conversion API
386
+ $('#add_facebook_capi').on('change', function(){ // on change of state
387
+ var nonce = $('#add_facebook_capi').val();
388
+
389
+ if(this.checked){
390
+
391
+ // Checkbox is on
392
+ jQuery.ajax({
393
+ method: "POST",
394
+ url: ajaxurl,
395
+ data: {
396
+ 'action': 'woosea_add_facebook_capi_setting',
397
+ 'security': nonce,
398
+ 'status': "on"
399
+ }
400
+ })
401
+ .done(function( data ) {
402
+ $('#facebook_capi').after('<tr id="facebook_capi_token"><td colspan="2"><span>Insert your Facebook Conversion API token:</span><br/><br/><input type=\"hidden\" name=\"nonce_facebook_capi_id\" id=\"nonce_facebook_capi_id\" value=\"' + nonce +'\"><input type="textarea" class="textarea-field" id="fb_capi_token" name="fb_capi_token"><br/><br/><input type="button" id="save_facebook_capi_token" value="Save"></td></tr>');
403
+ })
404
+ .fail(function( data ) {
405
+ console.log('Failed AJAX Call :( /// Return Data: ' + data);
406
+ });
407
+ } else {
408
+ // Checkbox is off
409
+ jQuery.ajax({
410
+ method: "POST",
411
+ url: ajaxurl,
412
+ data: {
413
+ 'action': 'woosea_add_facebook_capi_setting',
414
+ 'security': nonce,
415
+ 'status': "off"
416
+ }
417
+ })
418
+ .done(function( data ) {
419
+ $('#facebook_capi_token').remove();
420
+ })
421
+ .fail(function( data ) {
422
+ console.log('Failed AJAX Call :( /// Return Data: ' + data);
423
+ });
424
+ }
425
+ })
426
+
427
+
428
  // Check if user would like to change the batch size
429
  $('#add_batch').on('change', function(){ // on change of state
430
  if(this.checked){
438
  data: { 'action': 'woosea_add_batch', 'status': "on" }
439
  })
440
  .done(function( data ) {
441
+ $('#batch').after('<tr id="woosea_batch_size"><td colspan="2"><span>Insert batch size:</span>&nbsp;<input type=\"hidden\" name=\"nonce_batch\" id=\"nonce_batch\" value=\"'+ nonce +'\"><input type="text" class="input-field-medium" id="batch_size" name="batch_size">&nbsp;<input type="submit" id="save_batch_size" value="Save"></td></tr>');
442
  })
443
  .fail(function( data ) {
444
  console.log('Failed AJAX Call :( /// Return Data: ' + data);
460
  }
461
  })
462
 
463
+ // Save Batch Size
464
  jQuery("#save_batch_size").on('click',function(){
465
+ var nonce = $('#nonce_batch').val();
466
+ var batch_size = $('#batch_size').val();
467
  var re = /^[0-9]*$/;
468
 
469
  var woosea_valid_batch_size=re.test(batch_size);
480
  jQuery.ajax({
481
  method: "POST",
482
  url: ajaxurl,
483
+ data: {
484
+ 'action': 'woosea_save_batch_size',
485
+ 'security': nonce,
486
+ 'batch_size': batch_size
487
+ }
488
  })
489
  }
490
  })
491
 
492
  // Check if user would like to enable Dynamic Remarketing
493
  $('#add_remarketing').on('change', function(){ // on change of state
494
+ var nonce = $('#add_remarketing').val();
495
+
496
+ if(this.checked){
497
 
498
  // Checkbox is on
499
  jQuery.ajax({
500
  method: "POST",
501
  url: ajaxurl,
502
+ data: {
503
+ 'action': 'woosea_add_remarketing',
504
+ 'security': nonce,
505
+ 'status': "on"
506
+ }
507
  })
508
  .done(function( data ) {
509
+ $('#remarketing').after('<tr id="adwords_conversion_id"><td colspan="2"><span>Insert your Dynamic Remarketing Conversion tracking ID:</span>&nbsp;<input type=\"hidden\" name=\"nonce_adwords_conversion_id\" id=\"nonce_adwords_conversion_id\" value=\"'+ nonce +'\"><input type="text" class="input-field-medium" id="adwords_conv_id" name="adwords_conv_id">&nbsp;<input type="submit" id="save_conversion_id" value="Save"></td></tr>');
510
  })
511
  .fail(function( data ) {
512
  console.log('Failed AJAX Call :( /// Return Data: ' + data);
516
  jQuery.ajax({
517
  method: "POST",
518
  url: ajaxurl,
519
+ data: {
520
+ 'action': 'woosea_add_remarketing',
521
+ 'security': nonce,
522
+ 'status': "off"
523
+ }
524
  })
525
  .done(function( data ) {
526
  $('#adwords_conversion_id').remove();
533
 
534
  // Save Google Dynamic Remarketing pixel ID
535
  jQuery("#save_conversion_id").on('click',function(){
536
+ var nonce = $('#nonce_adwords_conversion_id').val();
537
+ var adwords_conversion_id = $('#adwords_conv_id').val();
538
+ var re = /^[0-9,-]*$/;
539
 
540
  var woosea_valid_conversion_id=re.test(adwords_conversion_id);
541
  // Check for allowed characters
550
  // Now we need to save the conversion ID so we can use it in the dynamic remarketing JS
551
  jQuery.ajax({
552
  method: "POST",
553
+ url: ajaxurl,
554
+ data: {
555
+ 'action': 'woosea_save_adwords_conversion_id',
556
+ 'security': nonce,
557
+ 'adwords_conversion_id': adwords_conversion_id
558
+ }
559
  })
560
  }
561
  })
562
 
563
  // Save Facebook Pixel ID
564
  jQuery("#save_facebook_pixel_id").on('click',function(){
565
+ var nonce = $('#nonce_facebook_pixel_id').val();
566
+ var facebook_pixel_id = $('#fb_pixel_id').val();
567
  var re = /^[0-9]*$/;
568
  var woosea_valid_facebook_pixel_id=re.test(facebook_pixel_id);
569
 
580
  jQuery.ajax({
581
  method: "POST",
582
  url: ajaxurl,
583
+ data: {
584
+ 'action': 'woosea_save_facebook_pixel_id',
585
+ 'security': nonce,
586
+ 'facebook_pixel_id': facebook_pixel_id
587
+ }
588
+ })
589
+ }
590
+ })
591
+
592
+ // Save Facebook Conversion API token
593
+ jQuery("#save_facebook_capi_token").on('click',function(){
594
+ var nonce = $('#nonce_facebook_capi_id').val();
595
+ var facebook_capi_token = $('#fb_capi_token').val();
596
+ var re = /^[0-9A-Za-z]*$/;
597
+ var woosea_valid_facebook_capi_token=re.test(facebook_capi_token);
598
+
599
+ // Check for allowed characters
600
+ if (!woosea_valid_facebook_capi_token){
601
+ $('.notice').replaceWith("<div class='notice notice-error woosea-notice-conversion is-dismissible'><p>Sorry, this is not a valid Facebook Conversion API Token.</p></div>");
602
+ // Disable submit button too
603
+ $('#save_facebook_capi_token').attr('disabled',true);
604
+ } else {
605
+ $('.woosea-notice-conversion').remove();
606
+ $('#save_facebook_capi_token').attr('disabled',false);
607
+
608
+ // Now we need to save the Facebook Conversion API Token
609
+ jQuery.ajax({
610
+ method: "POST",
611
+ url: ajaxurl,
612
+ data: {
613
+ 'action': 'woosea_save_facebook_capi_token',
614
+ 'security': nonce,
615
+ 'facebook_capi_token': facebook_capi_token
616
+ }
617
  })
 
618
  }
619
  })
620
 
770
  $(".woo-product-feed-pro-blink_off_"+hash).text(function () {
771
  $(this).addClass('woo-product-feed-pro-blink_me');
772
  var status = $(".woo-product-feed-pro-blink_off_"+hash).text();
 
773
  myInterval = setInterval(woosea_check_perc,5000);
774
  if(status == "ready"){
775
  return $(this).text().replace("ready", "processing (0%)");
793
 
794
  $("table tbody").find('input[name="manage_record"]').each(function(){
795
  var hash = this.value;
 
 
 
796
  jQuery.ajax({
797
  method: "POST",
798
  url: ajaxurl,
js/woosea_rules.js CHANGED
@@ -2,6 +2,7 @@ jQuery(document).ready(function($) {
2
 
3
  // Add standard filters
4
  jQuery(".add-field-manipulation").on('click', function(){
 
5
  var TrueRowCount = $('#woosea-ajax-table >tbody >tr').length-1;
6
  var rowCount = Math.round(new Date().getTime() + (Math.random() * 100));
7
  var plusCount = Math.round(new Date().getTime() + (Math.random() * 100));
@@ -9,7 +10,11 @@ jQuery(document).ready(function($) {
9
  jQuery.ajax({
10
  method: "POST",
11
  url: ajaxurl,
12
- data: { 'action': 'woosea_ajax', 'rowCount': rowCount }
 
 
 
 
13
  })
14
 
15
  .done(function( data ) {
@@ -36,14 +41,19 @@ jQuery(document).ready(function($) {
36
 
37
  // Add extra fields to existing field manipulations
38
  jQuery(".field_extra").on('click', function(){
39
- var className = $(this).attr("class").split(' ')[3];
 
40
  var rowCount = className.split("_")[3];
41
  var plusCount = Math.round(new Date().getTime() + (Math.random() * 100));
42
 
43
  jQuery.ajax({
44
  method: "POST",
45
  url: ajaxurl,
46
- data: { 'action': 'woosea_ajax', 'rowCount': rowCount }
 
 
 
 
47
  })
48
 
49
  .done(function( data ) {
@@ -57,6 +67,7 @@ jQuery(document).ready(function($) {
57
 
58
  // Add standard filters
59
  jQuery(".add-filter").on('click',function(){
 
60
  // Count amount of rows, used to create the form array field and values
61
  var TrueRowCount = $('#woosea-ajax-table >tbody >tr').length-1;
62
  var rowCount = Math.round(new Date().getTime() + (Math.random() * 100));
@@ -64,15 +75,19 @@ jQuery(document).ready(function($) {
64
  jQuery.ajax({
65
  method: "POST",
66
  url: ajaxurl,
67
- data: { 'action': 'woosea_ajax', 'rowCount': rowCount }
 
 
 
 
68
  })
69
  .done(function( data ) {
70
  data = JSON.parse( data );
71
 
72
  if(TrueRowCount == 0){
73
- $( '#woosea-ajax-table' ).find('tbody:first').append('<tr><td><input type="hidden" name="rules[' + data.rowCount + '][rowCount]" value="' + data.rowCount + '"><input type="checkbox" name="record" class="checkbox-field"></td><td><i>Filter:</i></td><td><select name="rules[' + data.rowCount + '][attribute]" id="rules_' + data.rowCount + '">' + data.dropdown + '</select></td><td><select name="rules[' + data.rowCount + '][condition]" class="select-field"><option value="contains">contains</option><option value="containsnot">does not contain</option><option value="=">is equal to</option><option value="!=">is not equal to</option><option value=">">is greater than</option><option value=">=">is greater or equal to</option><option value="<">is less than</option><option value="=<">is less or equal to</option><option value="empty">is empty</option></select></td><td><input type="text" name="rules[' + rowCount + '][criteria]" class="input-field-large" id="criteria_' + data.rowCount + '"></td><td><input type="checkbox" name="rules[' + rowCount + '][cs]" class="checkbox-field" alt="Case sensitive"></td><td><select name="rules[' + rowCount + '][than]" class="select-field"><optgroup label="Action">Action:<option value="exclude"> Exclude</option><option value="include_only">Include only</option></optgroup></select></td><td>&nbsp;</td></tr>');
74
  } else {
75
- $('<tr><td><input type="hidden" name="rules[' + data.rowCount + '][rowCount]" value="' + data.rowCount + '"><input type="checkbox" name="record" class="checkbox-field"></td><td><i>Filter:</i></td><td><select name="rules[' + data.rowCount + '][attribute]" id="rules_' + data.rowCount + '">' + data.dropdown + '</select></td><td><select name="rules[' + data.rowCount + '][condition]" class="select-field"><option value="contains">contains</option><option value="containsnot">does not contain</option><option value="=">is equal to</option><option value="!=">is not equal to</option><option value=">">is greater than</option><option value=">=">is greater or equal to</option><option value="<">is less than</option><option value="=<">is less or equal to</option><option value="empty">is empty</option></select></td><td><input type="text" name="rules[' + rowCount + '][criteria]" class="input-field-large" id="criteria_' + data.rowCount + '"></td><td><input type="checkbox" name="rules[' + rowCount + '][cs]" class="checkbox-field" alt="Case sensitive"></td><td><select name="rules[' + rowCount + '][than]" class="select-field"><optgroup label="Action">Action:<option value="exclude"> Exclude</option><option value="include_only">Include only</option></optgroup></select></td><td>&nbsp;</td></tr>').insertBefore( ".rules-buttons");
76
  }
77
 
78
  // Check if user selected a data manipulation condition
@@ -81,7 +96,10 @@ jQuery(document).ready(function($) {
81
  jQuery.ajax({
82
  method: "POST",
83
  url: ajaxurl,
84
- data: { 'action': 'woosea_categories_dropdown', 'rowCount': rowCount }
 
 
 
85
  })
86
 
87
  .done(function( data ) {
@@ -98,7 +116,7 @@ jQuery(document).ready(function($) {
98
 
99
  // Add rules
100
  jQuery(".add-rule").on('click',function(){
101
-
102
  // Count amount of rows, used to create the form array field and values
103
  var TrueRowCount = $('#woosea-ajax-table >tbody >tr').length-1;
104
  var rowCount = Math.round(new Date().getTime() + (Math.random() * 100));
@@ -106,7 +124,11 @@ jQuery(document).ready(function($) {
106
  jQuery.ajax({
107
  method: "POST",
108
  url: ajaxurl,
109
- data: { 'action': 'woosea_ajax', 'rowCount': rowCount }
 
 
 
 
110
  })
111
  .done(function( data ) {
112
  data = JSON.parse( data );
2
 
3
  // Add standard filters
4
  jQuery(".add-field-manipulation").on('click', function(){
5
+ var nonce = $('#nonce_manipulation_mapping').val();
6
  var TrueRowCount = $('#woosea-ajax-table >tbody >tr').length-1;
7
  var rowCount = Math.round(new Date().getTime() + (Math.random() * 100));
8
  var plusCount = Math.round(new Date().getTime() + (Math.random() * 100));
10
  jQuery.ajax({
11
  method: "POST",
12
  url: ajaxurl,
13
+ data: {
14
+ 'action': 'woosea_ajax',
15
+ 'security': nonce,
16
+ 'rowCount': rowCount
17
+ }
18
  })
19
 
20
  .done(function( data ) {
41
 
42
  // Add extra fields to existing field manipulations
43
  jQuery(".field_extra").on('click', function(){
44
+ var nonce = $('#nonce_manipulation_mapping').val();
45
+ var className = $(this).attr("class").split(' ')[3];
46
  var rowCount = className.split("_")[3];
47
  var plusCount = Math.round(new Date().getTime() + (Math.random() * 100));
48
 
49
  jQuery.ajax({
50
  method: "POST",
51
  url: ajaxurl,
52
+ data: {
53
+ 'action': 'woosea_ajax',
54
+ 'security': nonce,
55
+ 'rowCount': rowCount
56
+ }
57
  })
58
 
59
  .done(function( data ) {
67
 
68
  // Add standard filters
69
  jQuery(".add-filter").on('click',function(){
70
+ var nonce = $('#nonce_filters_mapping').val();
71
  // Count amount of rows, used to create the form array field and values
72
  var TrueRowCount = $('#woosea-ajax-table >tbody >tr').length-1;
73
  var rowCount = Math.round(new Date().getTime() + (Math.random() * 100));
75
  jQuery.ajax({
76
  method: "POST",
77
  url: ajaxurl,
78
+ data: {
79
+ 'action': 'woosea_ajax',
80
+ 'security': nonce,
81
+ 'rowCount': rowCount
82
+ }
83
  })
84
  .done(function( data ) {
85
  data = JSON.parse( data );
86
 
87
  if(TrueRowCount == 0){
88
+ $( '#woosea-ajax-table' ).find('tbody:first').append('<tr><td><input type="hidden" name="rules[' + data.rowCount + '][rowCount]" value="' + data.rowCount + '"><input type="checkbox" name="record" class="checkbox-field"></td><td><i>Filter:</i></td><td><select name="rules[' + data.rowCount + '][attribute]" id="rules_' + data.rowCount + '">' + data.dropdown + '</select></td><td><select name="rules[' + data.rowCount + '][condition]" class="select-field"><option value="contains">contains</option><option value="containsnot">does not contain</option><option value="=">is equal to</option><option value="!=">is not equal to</option><option value=">">is greater than</option><option value=">=">is greater or equal to</option><option value="<">is less than</option><option value="=<">is less or equal to</option><option value="empty">is empty</option><option value="notempty">is not empty</option></select></td><td><input type="text" name="rules[' + rowCount + '][criteria]" class="input-field-large" id="criteria_' + data.rowCount + '"></td><td><input type="checkbox" name="rules[' + rowCount + '][cs]" class="checkbox-field" alt="Case sensitive"></td><td><select name="rules[' + rowCount + '][than]" class="select-field"><optgroup label="Action">Action:<option value="exclude"> Exclude</option><option value="include_only">Include only</option></optgroup></select></td><td>&nbsp;</td></tr>');
89
  } else {
90
+ $('<tr><td><input type="hidden" name="rules[' + data.rowCount + '][rowCount]" value="' + data.rowCount + '"><input type="checkbox" name="record" class="checkbox-field"></td><td><i>Filter:</i></td><td><select name="rules[' + data.rowCount + '][attribute]" id="rules_' + data.rowCount + '">' + data.dropdown + '</select></td><td><select name="rules[' + data.rowCount + '][condition]" class="select-field"><option value="contains">contains</option><option value="containsnot">does not contain</option><option value="=">is equal to</option><option value="!=">is not equal to</option><option value=">">is greater than</option><option value=">=">is greater or equal to</option><option value="<">is less than</option><option value="=<">is less or equal to</option><option value="empty">is empty</option><option value="notempty">is not empty</option></select></td><td><input type="text" name="rules[' + rowCount + '][criteria]" class="input-field-large" id="criteria_' + data.rowCount + '"></td><td><input type="checkbox" name="rules[' + rowCount + '][cs]" class="checkbox-field" alt="Case sensitive"></td><td><select name="rules[' + rowCount + '][than]" class="select-field"><optgroup label="Action">Action:<option value="exclude"> Exclude</option><option value="include_only">Include only</option></optgroup></select></td><td>&nbsp;</td></tr>').insertBefore( ".rules-buttons");
91
  }
92
 
93
  // Check if user selected a data manipulation condition
96
  jQuery.ajax({
97
  method: "POST",
98
  url: ajaxurl,
99
+ data: {
100
+ 'action': 'woosea_categories_dropdown',
101
+ 'rowCount': rowCount
102
+ }
103
  })
104
 
105
  .done(function( data ) {
116
 
117
  // Add rules
118
  jQuery(".add-rule").on('click',function(){
119
+ var nonce = $('#nonce_filters_mapping').val();
120
  // Count amount of rows, used to create the form array field and values
121
  var TrueRowCount = $('#woosea-ajax-table >tbody >tr').length-1;
122
  var rowCount = Math.round(new Date().getTime() + (Math.random() * 100));
124
  jQuery.ajax({
125
  method: "POST",
126
  url: ajaxurl,
127
+ data: {
128
+ 'action': 'woosea_ajax',
129
+ 'security': nonce,
130
+ 'rowCount': rowCount
131
+ }
132
  })
133
  .done(function( data ) {
134
  data = JSON.parse( data );
js/woosea_typeahead.js ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* =============================================================
2
+ * bootstrap3-typeahead.js v3.1.0
3
+ * https://github.com/bassjobsen/Bootstrap-3-Typeahead
4
+ * =============================================================
5
+ * Original written by @mdo and @fat
6
+ * =============================================================
7
+ * Copyright 2014 Bass Jobsen @bassjobsen
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the 'License');
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an 'AS IS' BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ * ============================================================ */
21
+
22
+
23
+ (function (root, factory) {
24
+
25
+ 'use strict';
26
+
27
+ // CommonJS module is defined
28
+ if (typeof module !== 'undefined' && module.exports) {
29
+ module.exports = factory(require('jquery'));
30
+ }
31
+ // AMD module is defined
32
+ else if (typeof define === 'function' && define.amd) {
33
+ define(['jquery'], function ($) {
34
+ return factory ($);
35
+ });
36
+ } else {
37
+ factory(root.jQuery);
38
+ }
39
+
40
+ }(this, function ($) {
41
+
42
+ 'use strict';
43
+ // jshint laxcomma: true
44
+
45
+
46
+ /* TYPEAHEAD PUBLIC CLASS DEFINITION
47
+ * ================================= */
48
+
49
+ var Typeahead = function (element, options) {
50
+ this.$element = $(element);
51
+ this.options = $.extend({}, $.fn.typeahead.defaults, options);
52
+ this.matcher = this.options.matcher || this.matcher;
53
+ this.sorter = this.options.sorter || this.sorter;
54
+ this.select = this.options.select || this.select;
55
+ this.autoSelect = typeof this.options.autoSelect == 'boolean' ? this.options.autoSelect : true;
56
+ this.highlighter = this.options.highlighter || this.highlighter;
57
+ this.render = this.options.render || this.render;
58
+ this.updater = this.options.updater || this.updater;
59
+ this.displayText = this.options.displayText || this.displayText;
60
+ this.source = this.options.source;
61
+ this.delay = this.options.delay;
62
+ this.$menu = $(this.options.menu);
63
+ this.$appendTo = this.options.appendTo ? $(this.options.appendTo) : null;
64
+ this.shown = false;
65
+ this.listen();
66
+ this.showHintOnFocus = typeof this.options.showHintOnFocus == 'boolean' ? this.options.showHintOnFocus : false;
67
+ this.afterSelect = this.options.afterSelect;
68
+ this.addItem = false;
69
+ };
70
+
71
+ Typeahead.prototype = {
72
+
73
+ constructor: Typeahead,
74
+
75
+ select: function () {
76
+ var val = this.$menu.find('.active').data('value');
77
+ this.$element.data('active', val);
78
+ if(this.autoSelect || val) {
79
+ var newVal = this.updater(val);
80
+ // Updater can be set to any random functions via "options" parameter in constructor above.
81
+ // Add null check for cases when upadter returns void or undefined.
82
+ if (!newVal) {
83
+ newVal = "";
84
+ }
85
+ this.$element
86
+ .val(this.displayText(newVal) || newVal)
87
+ .change();
88
+ this.afterSelect(newVal);
89
+ }
90
+ return this.hide();
91
+ },
92
+
93
+ updater: function (item) {
94
+ return item;
95
+ },
96
+
97
+ setSource: function (source) {
98
+ this.source = source;
99
+ },
100
+
101
+ show: function () {
102
+ var pos = $.extend({}, this.$element.position(), {
103
+ height: this.$element[0].offsetHeight
104
+ }), scrollHeight;
105
+
106
+ scrollHeight = typeof this.options.scrollHeight == 'function' ?
107
+ this.options.scrollHeight.call() :
108
+ this.options.scrollHeight;
109
+
110
+ var element;
111
+ if (this.shown) {
112
+ element = this.$menu;
113
+ } else if (this.$appendTo) {
114
+ element = this.$menu.appendTo(this.$appendTo);
115
+ } else {
116
+ element = this.$menu.insertAfter(this.$element);
117
+ }
118
+ element.css({
119
+ top: pos.top + pos.height + scrollHeight
120
+ , left: pos.left
121
+ })
122
+ .show();
123
+
124
+ this.shown = true;
125
+ return this;
126
+ },
127
+
128
+ hide: function () {
129
+ this.$menu.hide();
130
+ this.shown = false;
131
+ return this;
132
+ },
133
+
134
+ lookup: function (query) {
135
+ var items;
136
+ if (typeof(query) != 'undefined' && query !== null) {
137
+ this.query = query;
138
+ } else {
139
+ this.query = this.$element.val() || '';
140
+ }
141
+
142
+ if (this.query.length < this.options.minLength) {
143
+ return this.shown ? this.hide() : this;
144
+ }
145
+
146
+ var worker = $.proxy(function() {
147
+
148
+ if($.isFunction(this.source)) this.source(this.query, $.proxy(this.process, this));
149
+ else if (this.source) {
150
+ this.process(this.source);
151
+ }
152
+ }, this);
153
+
154
+ clearTimeout(this.lookupWorker);
155
+ this.lookupWorker = setTimeout(worker, this.delay);
156
+ },
157
+
158
+ process: function (items) {
159
+ var that = this;
160
+
161
+ items = $.grep(items, function (item) {
162
+ return that.matcher(item);
163
+ });
164
+
165
+ items = this.sorter(items);
166
+
167
+ if (!items.length && !this.options.addItem) {
168
+ return this.shown ? this.hide() : this;
169
+ }
170
+
171
+ if (items.length > 0) {
172
+ this.$element.data('active', items[0]);
173
+ } else {
174
+ this.$element.data('active', null);
175
+ }
176
+
177
+ // Add item
178
+ if (this.options.addItem){
179
+ items.push(this.options.addItem);
180
+ }
181
+
182
+ if (this.options.items == 'all') {
183
+ return this.render(items).show();
184
+ } else {
185
+ return this.render(items.slice(0, this.options.items)).show();
186
+ }
187
+ },
188
+
189
+ matcher: function (item) {
190
+ var it = this.displayText(item);
191
+ return ~it.toLowerCase().indexOf(this.query.toLowerCase());
192
+ },
193
+
194
+ sorter: function (items) {
195
+ var beginswith = []
196
+ , caseSensitive = []
197
+ , caseInsensitive = []
198
+ , item;
199
+
200
+ while ((item = items.shift())) {
201
+ var it = this.displayText(item);
202
+ if (!it.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item);
203
+ else if (~it.indexOf(this.query)) caseSensitive.push(item);
204
+ else caseInsensitive.push(item);
205
+ }
206
+
207
+ return beginswith.concat(caseSensitive, caseInsensitive);
208
+ },
209
+
210
+ highlighter: function (item) {
211
+ var html = $('<div></div>');
212
+ var query = this.query;
213
+ var i = item.toLowerCase().indexOf(query.toLowerCase());
214
+ var len, leftPart, middlePart, rightPart, strong;
215
+ len = query.length;
216
+ if(len === 0){
217
+ return html.text(item).html();
218
+ }
219
+ while (i > -1) {
220
+ leftPart = item.substr(0, i);
221
+ middlePart = item.substr(i, len);
222
+ rightPart = item.substr(i + len);
223
+ strong = $('<strong></strong>').text(middlePart);
224
+ html
225
+ .append(document.createTextNode(leftPart))
226
+ .append(strong);
227
+ item = rightPart;
228
+ i = item.toLowerCase().indexOf(query.toLowerCase());
229
+ }
230
+ return html.append(document.createTextNode(item)).html();
231
+ },
232
+
233
+ render: function (items) {
234
+ var that = this;
235
+ var self = this;
236
+ var activeFound = false;
237
+ items = $(items).map(function (i, item) {
238
+ var text = self.displayText(item);
239
+ i = $(that.options.item).data('value', item);
240
+ i.find('a').html(that.highlighter(text));
241
+ if (text == self.$element.val()) {
242
+ i.addClass('active');
243
+ self.$element.data('active', item);
244
+ activeFound = true;
245
+ }
246
+ return i[0];
247
+ });
248
+
249
+ if (this.autoSelect && !activeFound) {
250
+ items.first().addClass('active');
251
+ this.$element.data('active', items.first().data('value'));
252
+ }
253
+ this.$menu.html(items);
254
+ return this;
255
+ },
256
+
257
+ displayText: function(item) {
258
+ return typeof item !== 'undefined' && typeof item.name != 'undefined' && item.name || item;
259
+ },
260
+
261
+ next: function (event) {
262
+ var active = this.$menu.find('.active').removeClass('active')
263
+ , next = active.next();
264
+
265
+ if (!next.length) {
266
+ next = $(this.$menu.find('li')[0]);
267
+ }
268
+
269
+ next.addClass('active');
270
+ },
271
+
272
+ prev: function (event) {
273
+ var active = this.$menu.find('.active').removeClass('active')
274
+ , prev = active.prev();
275
+
276
+ if (!prev.length) {
277
+ prev = this.$menu.find('li').last();
278
+ }
279
+
280
+ prev.addClass('active');
281
+ },
282
+
283
+ listen: function () {
284
+ this.$element
285
+ .on('focus', $.proxy(this.focus, this))
286
+ .on('blur', $.proxy(this.blur, this))
287
+ .on('keypress', $.proxy(this.keypress, this))
288
+ .on('keyup', $.proxy(this.keyup, this));
289
+
290
+ if (this.eventSupported('keydown')) {
291
+ this.$element.on('keydown', $.proxy(this.keydown, this));
292
+ }
293
+
294
+ this.$menu
295
+ .on('click', $.proxy(this.click, this))
296
+ .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
297
+ .on('mouseleave', 'li', $.proxy(this.mouseleave, this));
298
+ },
299
+
300
+ destroy : function () {
301
+ this.$element.data('typeahead',null);
302
+ this.$element.data('active',null);
303
+ this.$element
304
+ .off('focus')
305
+ .off('blur')
306
+ .off('keypress')
307
+ .off('keyup');
308
+
309
+ if (this.eventSupported('keydown')) {
310
+ this.$element.off('keydown');
311
+ }
312
+
313
+ this.$menu.remove();
314
+ },
315
+
316
+ eventSupported: function(eventName) {
317
+ var isSupported = eventName in this.$element;
318
+ if (!isSupported) {
319
+ this.$element.setAttribute(eventName, 'return;');
320
+ isSupported = typeof this.$element[eventName] === 'function';
321
+ }
322
+ return isSupported;
323
+ },
324
+
325
+ move: function (e) {
326
+ if (!this.shown) return;
327
+
328
+ switch(e.keyCode) {
329
+ case 9: // tab
330
+ case 13: // enter
331
+ case 27: // escape
332
+ e.preventDefault();
333
+ break;
334
+
335
+ case 38: // up arrow
336
+ // with the shiftKey (this is actually the left parenthesis)
337
+ if (e.shiftKey) return;
338
+ e.preventDefault();
339
+ this.prev();
340
+ break;
341
+
342
+ case 40: // down arrow
343
+ // with the shiftKey (this is actually the right parenthesis)
344
+ if (e.shiftKey) return;
345
+ e.preventDefault();
346
+ this.next();
347
+ break;
348
+ }
349
+ },
350
+
351
+ keydown: function (e) {
352
+ this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27]);
353
+ if (!this.shown && e.keyCode == 40) {
354
+ this.lookup();
355
+ } else {
356
+ this.move(e);
357
+ }
358
+ },
359
+
360
+ keypress: function (e) {
361
+ if (this.suppressKeyPressRepeat) return;
362
+ this.move(e);
363
+ },
364
+
365
+ keyup: function (e) {
366
+ switch(e.keyCode) {
367
+ case 40: // down arrow
368
+ case 38: // up arrow
369
+ case 16: // shift
370
+ case 17: // ctrl
371
+ case 18: // alt
372
+ break;
373
+
374
+ case 9: // tab
375
+ case 13: // enter
376
+ if (!this.shown) return;
377
+ this.select();
378
+ break;
379
+
380
+ case 27: // escape
381
+ if (!this.shown) return;
382
+ this.hide();
383
+ break;
384
+ default:
385
+ this.lookup();
386
+ }
387
+
388
+ e.preventDefault();
389
+ },
390
+
391
+ focus: function (e) {
392
+ if (!this.focused) {
393
+ this.focused = true;
394
+ if (this.options.showHintOnFocus) {
395
+ this.lookup('');
396
+ }
397
+ }
398
+ },
399
+
400
+ blur: function (e) {
401
+ this.focused = false;
402
+ if (!this.mousedover && this.shown) this.hide();
403
+ },
404
+
405
+ click: function (e) {
406
+ e.preventDefault();
407
+ this.select();
408
+ this.$element.focus();
409
+ },
410
+
411
+ mouseenter: function (e) {
412
+ this.mousedover = true;
413
+ this.$menu.find('.active').removeClass('active');
414
+ $(e.currentTarget).addClass('active');
415
+ },
416
+
417
+ mouseleave: function (e) {
418
+ this.mousedover = false;
419
+ if (!this.focused && this.shown) this.hide();
420
+ }
421
+
422
+ };
423
+
424
+
425
+ /* TYPEAHEAD PLUGIN DEFINITION
426
+ * =========================== */
427
+
428
+ var old = $.fn.typeahead;
429
+
430
+ $.fn.typeahead = function (option) {
431
+ var arg = arguments;
432
+ if (typeof option == 'string' && option == 'getActive') {
433
+ return this.data('active');
434
+ }
435
+ return this.each(function () {
436
+ var $this = $(this)
437
+ , data = $this.data('typeahead')
438
+ , options = typeof option == 'object' && option;
439
+ if (!data) $this.data('typeahead', (data = new Typeahead(this, options)));
440
+ if (typeof option == 'string') {
441
+ if (arg.length > 1) {
442
+ data[option].apply(data, Array.prototype.slice.call(arg ,1));
443
+ } else {
444
+ data[option]();
445
+ }
446
+ }
447
+ });
448
+ };
449
+
450
+ $.fn.typeahead.defaults = {
451
+ source: []
452
+ , items: 8
453
+ , menu: '<ul class="typeahead dropdown-menu" role="listbox"></ul>'
454
+ , item: '<li><a class="dropdown-item" href="#" role="option"></a></li>'
455
+ , minLength: 1
456
+ , scrollHeight: 0
457
+ , autoSelect: true
458
+ , afterSelect: $.noop
459
+ , addItem: false
460
+ , delay: 0
461
+ };
462
+
463
+ $.fn.typeahead.Constructor = Typeahead;
464
+
465
+
466
+ /* TYPEAHEAD NO CONFLICT
467
+ * =================== */
468
+
469
+ $.fn.typeahead.noConflict = function () {
470
+ $.fn.typeahead = old;
471
+ return this;
472
+ };
473
+
474
+
475
+ /* TYPEAHEAD DATA-API
476
+ * ================== */
477
+
478
+ $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
479
+ var $this = $(this);
480
+ if ($this.data('typeahead')) return;
481
+ $this.typeahead($this.data());
482
+ });
483
+
484
+ }));
pages/admin/woosea-generate-feed-step-0.php CHANGED
@@ -34,9 +34,11 @@ if (!in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
34
  $locale = apply_filters( 'woocommerce_countries_base_country', $default['country'] );
35
  }
36
 
37
- if($license_information['notice'] == "true"){
38
- $notifications_box['message_type'] = $license_information['message_type'];
39
- $notifications_box['message'] = $license_information['message'];
 
 
40
  }
41
 
42
  if ($versions['PHP'] < 5.6){
@@ -395,7 +397,7 @@ if (array_key_exists('project_hash', $_GET)){
395
  </td>
396
  </tr>
397
  <tr id="product_variations">
398
- <td><span><?php _e('Include all product variations','woo-product-feed-pro' );?>:</span></td>
399
  <td>
400
  <label class="woo-product-feed-pro-switch">
401
  <?php
@@ -410,7 +412,7 @@ if (array_key_exists('project_hash', $_GET)){
410
  </td>
411
  </tr>
412
  <tr id="default_variation">
413
- <td><span><?php _e( 'Only include default product variation','woo-product-feed-pro' );?>:</span></td>
414
  <td>
415
  <label class="woo-product-feed-pro-switch">
416
  <?php
@@ -425,7 +427,7 @@ if (array_key_exists('project_hash', $_GET)){
425
  </td>
426
  </tr>
427
  <tr id="lowest_price_variation">
428
- <td><span><?php _e( 'Only include lowest priced product variation(s)','woo-product-feed-pro' );?>:</span></td>
429
  <td>
430
  <label class="woo-product-feed-pro-switch">
431
  <?php
34
  $locale = apply_filters( 'woocommerce_countries_base_country', $default['country'] );
35
  }
36
 
37
+ if (!empty($license_information)){
38
+ if($license_information['notice'] == "true"){
39
+ $notifications_box['message_type'] = $license_information['message_type'];
40
+ $notifications_box['message'] = $license_information['message'];
41
+ }
42
  }
43
 
44
  if ($versions['PHP'] < 5.6){
397
  </td>
398
  </tr>
399
  <tr id="product_variations">
400
+ <td><span><?php _e('Include product variations','woo-product-feed-pro' );?>:</span></td>
401
  <td>
402
  <label class="woo-product-feed-pro-switch">
403
  <?php
412
  </td>
413
  </tr>
414
  <tr id="default_variation">
415
+ <td><span><?php _e( 'And only include default product variation','woo-product-feed-pro' );?>:</span></td>
416
  <td>
417
  <label class="woo-product-feed-pro-switch">
418
  <?php
427
  </td>
428
  </tr>
429
  <tr id="lowest_price_variation">
430
+ <td><span><?php _e( 'And only include lowest priced product variation(s)','woo-product-feed-pro' );?>:</span></td>
431
  <td>
432
  <label class="woo-product-feed-pro-switch">
433
  <?php
pages/admin/woosea-generate-feed-step-1.php CHANGED
@@ -16,6 +16,11 @@ $host = $_SERVER['HTTP_HOST'];
16
  $notifications_obj = new WooSEA_Get_Admin_Notifications;
17
  $notifications_box = $notifications_obj->get_admin_notifications ( '1', 'false' );
18
 
 
 
 
 
 
19
  /**
20
  * Update project configuration
21
  */
@@ -101,7 +106,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
101
 
102
  $r .= "<tr class=\"catmapping\">";
103
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">$woo_category ($sub_category->count)</td>";
104
- $r .= "<td><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x\" value=\"$mapped_category\"></td>";
105
  if(($yo == $nr_categories) AND ($nr_subcats == 0)){
106
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
107
  } else {
@@ -115,7 +120,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
115
  } else {
116
  $r .= "<tr class=\"catmapping\">";
117
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">-- $woo_category ($sub_category->count)</td>";
118
- $r .= "<td><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x mother_$sub_category->parent\" value=\"$mapped_category\"></td>";
119
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
120
  $r .= "</tr>";
121
  }
@@ -166,7 +171,8 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
166
  </tbody>
167
 
168
  <form action="" method="post">
169
-
 
170
  <tr>
171
  <td colspan="3">
172
  <input type="hidden" id="channel_hash" name="channel_hash" value="<?php print "$project[channel_hash]";?>">
@@ -227,7 +233,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
227
 
228
  <table class="woo-product-feed-pro-table">
229
  <tr>
230
- <td><strong><?php _e( 'We\’ve got you covered!','woo-product-feed-pro' );?></strong></td>
231
  </tr>
232
  <tr>
233
  <td>
16
  $notifications_obj = new WooSEA_Get_Admin_Notifications;
17
  $notifications_box = $notifications_obj->get_admin_notifications ( '1', 'false' );
18
 
19
+ /**
20
+ * Update or get project configuration
21
+ */
22
+ $nonce = wp_create_nonce( 'woosea_ajax_nonce' );
23
+
24
  /**
25
  * Update project configuration
26
  */
106
 
107
  $r .= "<tr class=\"catmapping\">";
108
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">$woo_category ($sub_category->count)</td>";
109
+ $r .= "<td><div id=\"the-basics-$x\"><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x\" value=\"$mapped_category\"></div></td>";
110
  if(($yo == $nr_categories) AND ($nr_subcats == 0)){
111
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
112
  } else {
120
  } else {
121
  $r .= "<tr class=\"catmapping\">";
122
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">-- $woo_category ($sub_category->count)</td>";
123
+ $r .= "<td><div id=\"the-basics-$x\"><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x mother_$sub_category->parent\" value=\"$mapped_category\"></div></td>";
124
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
125
  $r .= "</tr>";
126
  }
171
  </tbody>
172
 
173
  <form action="" method="post">
174
+ <input name="nonce_category_mapping" id="nonce_category_mapping" class="nonce_category_mapping" value="<?php print "$nonce";?>" type="hidden">
175
+
176
  <tr>
177
  <td colspan="3">
178
  <input type="hidden" id="channel_hash" name="channel_hash" value="<?php print "$project[channel_hash]";?>">
233
 
234
  <table class="woo-product-feed-pro-table">
235
  <tr>
236
+ <td><strong><?php _e( 'We have got you covered!','woo-product-feed-pro' );?></strong></td>
237
  </tr>
238
  <tr>
239
  <td>
pages/admin/woosea-generate-feed-step-4.php CHANGED
@@ -19,6 +19,11 @@ $notifications_box = $notifications_obj->get_admin_notifications ( '4', 'false'
19
  $attributes_obj = new WooSEA_Attributes;
20
  $attributes = $attributes_obj->get_product_attributes();
21
 
 
 
 
 
 
22
  /**
23
  * Update or get project configuration
24
  */
@@ -50,6 +55,7 @@ if (array_key_exists('project_hash', $_GET)){
50
  <p><?php _e($notifications_box['message'], 'sample-text-domain' ); ?></p>
51
  </div>
52
  <form id="rulesandfilters" method="post">
 
53
 
54
  <table class="woo-product-feed-pro-table" id="woosea-ajax-table" border="1">
55
  <thead>
@@ -77,7 +83,7 @@ if (array_key_exists('project_hash', $_GET)){
77
  $criteria = "";
78
  }
79
  ?>
80
- <tr class="rowCount">
81
  <td><input type="hidden" name="rules[<?php print "$rule_key";?>][rowCount]" value="<?php print "$rule_key";?>"><input type="checkbox" name="record" class="checkbox-field"></td>
82
  <td><i><?php _e( 'Filter','woo-product-feed-pro' );?></i></td>
83
  <td>
@@ -150,12 +156,18 @@ if (array_key_exists('project_hash', $_GET)){
150
  } else {
151
  print "<option value=\"empty\">is empty</option>";
152
  }
 
 
 
 
 
 
153
  ?>
154
  </select>
155
  </td>
156
  <td>
157
  <div style="display: block;">
158
- <input type="text" id="rulevalue" name="rules[<?php print "$rule_key";?>][criteria]" class="input-field-large" value="<?php print "$criteria";?>">
159
  </div>
160
  </td>
161
  <td>
@@ -283,6 +295,12 @@ if (array_key_exists('project_hash', $_GET)){
283
  print "<option value=\"empty\">is empty</option>";
284
  }
285
 
 
 
 
 
 
 
286
  // Data manipulators
287
  if (isset($project['rules2'][$rule2_key]['condition']) AND ($project['rules2'][$rule2_key]['condition'] == "multiply")){
288
  print "<option value=\"multiply\" selected>multiply</option>";
@@ -314,7 +332,7 @@ if (array_key_exists('project_hash', $_GET)){
314
  </td>
315
  <td>
316
  <div style="display: block;">
317
- <input type="text" id="rulevalue" name="rules2[<?php print "$rule2_key";?>][criteria]" class="input-field-large" value="<?php print "$criteria";?>">
318
  </div>
319
  </td>
320
  <?php
19
  $attributes_obj = new WooSEA_Attributes;
20
  $attributes = $attributes_obj->get_product_attributes();
21
 
22
+ /**
23
+ * Update or get project configuration
24
+ */
25
+ $nonce = wp_create_nonce( 'woosea_ajax_nonce' );
26
+
27
  /**
28
  * Update or get project configuration
29
  */
55
  <p><?php _e($notifications_box['message'], 'sample-text-domain' ); ?></p>
56
  </div>
57
  <form id="rulesandfilters" method="post">
58
+ <input name="nonce_filters_mapping" id="nonce_filters_mapping" class="nonce_filters_mapping" value="<?php print "$nonce";?>" type="hidden">
59
 
60
  <table class="woo-product-feed-pro-table" id="woosea-ajax-table" border="1">
61
  <thead>
83
  $criteria = "";
84
  }
85
  ?>
86
+ <tr class="rowCount">
87
  <td><input type="hidden" name="rules[<?php print "$rule_key";?>][rowCount]" value="<?php print "$rule_key";?>"><input type="checkbox" name="record" class="checkbox-field"></td>
88
  <td><i><?php _e( 'Filter','woo-product-feed-pro' );?></i></td>
89
  <td>
156
  } else {
157
  print "<option value=\"empty\">is empty</option>";
158
  }
159
+
160
+ if (isset($project['rules'][$rule_key]['condition']) AND ($project['rules'][$rule_key]['condition'] == "notempty")){
161
+ print "<option value=\"notempty\" selected>is not empty</option>";
162
+ } else {
163
+ print "<option value=\"notempty\">is not empty</option>";
164
+ }
165
  ?>
166
  </select>
167
  </td>
168
  <td>
169
  <div style="display: block;">
170
+ <input type="text" id="rulevalue" name="rules[<?php print "$rule_key";?>][criteria]" class="input-field-large" value='<?php print $criteria;?>'>
171
  </div>
172
  </td>
173
  <td>
295
  print "<option value=\"empty\">is empty</option>";
296
  }
297
 
298
+ if (isset($project['rules2'][$rule2_key]['condition']) AND ($project['rules2'][$rule2_key]['condition'] == "notempty")){
299
+ print "<option value=\"notempty\" selected>is not empty</option>";
300
+ } else {
301
+ print "<option value=\"notempty\">is not empty</option>";
302
+ }
303
+
304
  // Data manipulators
305
  if (isset($project['rules2'][$rule2_key]['condition']) AND ($project['rules2'][$rule2_key]['condition'] == "multiply")){
306
  print "<option value=\"multiply\" selected>multiply</option>";
332
  </td>
333
  <td>
334
  <div style="display: block;">
335
+ <input type="text" id="rulevalue" name="rules2[<?php print "$rule2_key";?>][criteria]" class="input-field-large" value='<?php print $criteria;?>'>
336
  </div>
337
  </td>
338
  <?php
pages/admin/woosea-generate-feed-step-5.php CHANGED
@@ -20,11 +20,15 @@ $notifications_box = $notifications_obj->get_admin_notifications ( '5', $error )
20
  $attributes_obj = new WooSEA_Attributes;
21
  $attributes = $attributes_obj->get_product_attributes();
22
 
 
 
 
 
 
23
  /**
24
  * Get some channel configs for default utm_source
25
  * Update project configuration
26
  */
27
-
28
  if (array_key_exists('project_hash', $_GET)){
29
  $project = WooSEA_Update_Project::get_project_data(sanitize_text_field($_GET['project_hash']));
30
  $channel_data = WooSEA_Update_Project::get_channel_data(sanitize_text_field($_GET['channel_hash']));
@@ -52,7 +56,8 @@ if (array_key_exists('project_hash', $_GET)){
52
  </div>
53
 
54
  <form id="googleanalytics" method="post">
55
-
 
56
  <table class="woo-product-feed-pro-table">
57
  <!--
58
  <tr>
20
  $attributes_obj = new WooSEA_Attributes;
21
  $attributes = $attributes_obj->get_product_attributes();
22
 
23
+ /**
24
+ * Update or get project configuration
25
+ */
26
+ $nonce = wp_create_nonce( 'woosea_ajax_nonce' );
27
+
28
  /**
29
  * Get some channel configs for default utm_source
30
  * Update project configuration
31
  */
 
32
  if (array_key_exists('project_hash', $_GET)){
33
  $project = WooSEA_Update_Project::get_project_data(sanitize_text_field($_GET['project_hash']));
34
  $channel_data = WooSEA_Update_Project::get_channel_data(sanitize_text_field($_GET['channel_hash']));
56
  </div>
57
 
58
  <form id="googleanalytics" method="post">
59
+ <input name="nonce_google_mapping" id="nonce_google_mapping" class="nonce_google_mapping" value="<?php print "$nonce";?>" type="hidden">
60
+
61
  <table class="woo-product-feed-pro-table">
62
  <!--
63
  <tr>
pages/admin/woosea-generate-feed-step-7.php CHANGED
@@ -19,6 +19,11 @@ $notifications_box = $notifications_obj->get_admin_notifications ( '7', 'false'
19
  $attributes_obj = new WooSEA_Attributes;
20
  $attribute_dropdown = $attributes_obj->get_product_attributes();
21
 
 
 
 
 
 
22
  /**
23
  * Update or get project configuration
24
  */
@@ -81,26 +86,6 @@ require plugin_dir_path(__FILE__) . '../../classes/channels/class-'.$channel_dat
81
  $obj = "WooSEA_".$channel_data['fields'];
82
  $fields_obj = new $obj;
83
  $attributes = $fields_obj->get_channel_attributes();
84
-
85
- /**
86
- * Add the Item Group ID attribute for product variations
87
- **/
88
- //if(isset($_POST['product_variations'])){
89
- //
90
- // $channels_with_item_id = array('google_shopping','facebook_drm');
91
- //
92
- // if (in_array($project['fields'],$channels_with_item_id,TRUE)){
93
- //
94
- // $attributes["Detailed product description"]["Item group ID"]["format"] = "required";
95
- // $attributes["Detailed product description"]["Item group ID"]["woo_suggest"] = "item_group_id";
96
- //
97
- // if (in_array($project['fields'],$channels_with_item_id,TRUE)){
98
- // $attributes["Detailed product description"]["Item group ID"]["feed_name"] = "g:item_group_id";
99
- // } else {
100
- // $attributes["Detailed product description"]["Item group ID"]["feed_name"] = "item_group_id";
101
- // }
102
- // }
103
- //}
104
  ?>
105
  <div id="dialog" title="Basic dialog">
106
  <p>
@@ -117,6 +102,7 @@ $attributes = $fields_obj->get_channel_attributes();
117
  </div>
118
 
119
  <form action="" id="fieldmapping" method="post">
 
120
  <table class="woo-product-feed-pro-table" id="woosea-fieldmapping-table" border="1">
121
  <thead>
122
  <tr>
19
  $attributes_obj = new WooSEA_Attributes;
20
  $attribute_dropdown = $attributes_obj->get_product_attributes();
21
 
22
+ /**
23
+ * Update or get project configuration
24
+ */
25
+ $nonce = wp_create_nonce( 'woosea_ajax_nonce' );
26
+
27
  /**
28
  * Update or get project configuration
29
  */
86
  $obj = "WooSEA_".$channel_data['fields'];
87
  $fields_obj = new $obj;
88
  $attributes = $fields_obj->get_channel_attributes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ?>
90
  <div id="dialog" title="Basic dialog">
91
  <p>
102
  </div>
103
 
104
  <form action="" id="fieldmapping" method="post">
105
+ <input name="nonce_field_mapping" id="nonce_field_mapping" class="nonce_field_mapping" value="<?php print "$nonce";?>" type="hidden">
106
  <table class="woo-product-feed-pro-table" id="woosea-fieldmapping-table" border="1">
107
  <thead>
108
  <tr>
pages/admin/woosea-generate-feed-step-9.php CHANGED
@@ -21,6 +21,11 @@ $notifications_box = $notifications_obj->get_admin_notifications ( '15', 'false'
21
  $attributes_obj = new WooSEA_Attributes;
22
  $attributes = $attributes_obj->get_product_attributes();
23
 
 
 
 
 
 
24
  /**
25
  * Update or get project configuration
26
  */
@@ -46,6 +51,7 @@ if (array_key_exists('project_hash', $_GET)){
46
  <p><?php _e($notifications_box['message'], 'sample-text-domain' ); ?></p>
47
  </div>
48
  <form id="fieldmanipulation" method="post">
 
49
 
50
  <table class="woo-product-feed-pro-table" id="woosea-ajax-table" border="1">
51
  <thead>
21
  $attributes_obj = new WooSEA_Attributes;
22
  $attributes = $attributes_obj->get_product_attributes();
23
 
24
+ /**
25
+ * Update or get project configuration
26
+ */
27
+ $nonce = wp_create_nonce( 'woosea_ajax_nonce' );
28
+
29
  /**
30
  * Update or get project configuration
31
  */
51
  <p><?php _e($notifications_box['message'], 'sample-text-domain' ); ?></p>
52
  </div>
53
  <form id="fieldmanipulation" method="post">
54
+ <input name="nonce_manipulation_mapping" id="nonce_manipulation_mapping" class="nonce_manipulation_mapping" value="<?php print "$nonce";?>" type="hidden">
55
 
56
  <table class="woo-product-feed-pro-table" id="woosea-ajax-table" border="1">
57
  <thead>
pages/admin/woosea-manage-feed.php CHANGED
@@ -67,6 +67,7 @@ if(!empty($license_information)){
67
  if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
68
  $notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
69
  }
 
70
  ?>
71
  <div class="wrap">
72
  <div class="woo-product-feed-pro-form-style-2">
@@ -96,7 +97,15 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
96
  foreach($cron_projects as $key => $value){
97
  $cron_projects[$key]['active'] = "true";
98
  }
99
- update_option('cron_projects', $cron_projects,'no');
 
 
 
 
 
 
 
 
100
  } else {
101
  // Set default notification to show
102
  $getelite_notice = get_option('woosea_getelite_notification');
@@ -124,6 +133,23 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
124
  <?php
125
  }
126
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  ?>
128
 
129
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
@@ -193,7 +219,6 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
193
  print "<a href=\"$val[external_file]\" target=\"_blank\" class=\"dashicons dashicons-download\" id=\"download\" title=\"download productfeed\" style=\"display: inline-block\"></a>";
194
  }
195
  }?>
196
- <a href="admin.php?page=woo-product-feed-pro%2Fwoocommerce-sea.php&action=edit_project&step=8&project_hash=<?php print "$val[project_hash]";?>&channel_hash=<?php print "$val[channel_hash]";?>" class="trash dashicons dashicons-chart-line" id="chart_<?php print "$val[project_hash]";?>" title="amount of products in feed productfeed" style="display: inline-block;" target="_blank"></a>
197
  <span class="trash dashicons dashicons-trash" id="trash_<?php print "$val[project_hash]";?>" title="delete project and productfeed" style="display: inline-block;"></span>
198
  <?php
199
  } else {
67
  if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
68
  $notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
69
  }
70
+
71
  ?>
72
  <div class="wrap">
73
  <div class="woo-product-feed-pro-form-style-2">
97
  foreach($cron_projects as $key => $value){
98
  $cron_projects[$key]['active'] = "true";
99
  }
100
+ update_option('cron_projects', $cron_projects,'no');
101
+ } elseif (array_key_exists('force-clean', $_GET)){
102
+ // Forcefully remove all feed and plugin configurations
103
+ delete_option( 'cron_projects' );
104
+ delete_option( 'channel_statics' );
105
+ delete_option( 'woosea_getelite_notification' );
106
+ delete_option( 'woosea_license_notification_closed' );
107
+ wp_clear_scheduled_hook( 'woosea_cron_hook' );
108
+ wp_clear_scheduled_hook( 'woosea_check_license' );
109
  } else {
110
  // Set default notification to show
111
  $getelite_notice = get_option('woosea_getelite_notification');
133
  <?php
134
  }
135
  }
136
+
137
+
138
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
139
+ ?>
140
+ <div class="notice notice-error is-dismissible">
141
+ <p>
142
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
143
+ We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active otherwise it cannot update and generate your product feeds. <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>Please enable your WP-cron first</strong></a>.
144
+ </p>
145
+ </div>
146
+ <?php
147
+ }
148
+
149
+ // Double check if the woosea_cron_hook is there, when it is not create a new one
150
+ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
151
+ wp_schedule_event ( time(), 'hourly', 'woosea_cron_hook');
152
+ }
153
  ?>
154
 
155
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
219
  print "<a href=\"$val[external_file]\" target=\"_blank\" class=\"dashicons dashicons-download\" id=\"download\" title=\"download productfeed\" style=\"display: inline-block\"></a>";
220
  }
221
  }?>
 
222
  <span class="trash dashicons dashicons-trash" id="trash_<?php print "$val[project_hash]";?>" title="delete project and productfeed" style="display: inline-block;"></span>
223
  <?php
224
  } else {
pages/admin/woosea-manage-settings.php CHANGED
@@ -73,6 +73,10 @@ add_filter('admin_footer_text', 'my_footer_text');
73
  //we check if the page is visited by click on the tabs or on the menu button.
74
  //then we get the active tab.
75
  $active_tab = "woosea_manage_settings";
 
 
 
 
76
  $header_text = __( 'Plugin settings', 'woo-product-feed-pro' );
77
  if(isset($_GET["tab"])) {
78
  if($_GET["tab"] == "woosea_manage_settings"){
@@ -101,6 +105,20 @@ if(isset($_GET["tab"])) {
101
  ?>
102
  </span>
103
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  <!-- wordpress provides the styling for tabs. -->
106
  <h2 class="nav-tab-wrapper">
@@ -161,7 +179,7 @@ if(isset($_GET["tab"])) {
161
  </tr>
162
  <tr class="<?php print"$elite_disable";?>" id="identifier_option">
163
  <td>
164
- <span><?php _e( 'Add GTIN, MPN, UPC, EAN, Product condition, Optimised title, Installment, Unit measure and Brand attributes to your store:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/add-gtin-mpn-upc-ean-product-condition-optimised-title-and-brand-attributes/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=adding fields" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
165
  </td>
166
  <td>
167
  <label class="woo-product-feed-pro-switch">
@@ -179,7 +197,7 @@ if(isset($_GET["tab"])) {
179
  </tr>
180
  <tr class="<?php print"$elite_disable";?>" id="manipulation_option">
181
  <td>
182
- <span><?php _e( 'Enable Product data manipulation feature:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/feature-product-data-manipulation/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=wpml support" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
183
  </td>
184
  <td>
185
  <label class="woo-product-feed-pro-switch">
@@ -238,7 +256,7 @@ if(isset($_GET["tab"])) {
238
  ?>
239
  <tr>
240
  <td>
241
- <span><?php _e( 'Use mother main image for variations', 'woo-product-feed-pro');?></span>
242
  </td>
243
  <td>
244
  <label class="woo-product-feed-pro-switch">
@@ -256,7 +274,7 @@ if(isset($_GET["tab"])) {
256
  </tr>
257
  <tr>
258
  <td>
259
- <span><?php _e( 'Add shipping costs for all countries to feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
260
  </td>
261
  <td>
262
  <label class="woo-product-feed-pro-switch">
@@ -292,7 +310,25 @@ if(isset($_GET["tab"])) {
292
  </tr>
293
  <tr>
294
  <td>
295
- <span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  </td>
297
  <td>
298
  <label class="woo-product-feed-pro-switch">
@@ -326,6 +362,26 @@ if(isset($_GET["tab"])) {
326
  </label>
327
  </td>
328
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
  <tr id="facebook_pixel">
331
  <td>
@@ -336,9 +392,9 @@ if(isset($_GET["tab"])) {
336
  <?php
337
  $add_facebook_pixel = get_option ('add_facebook_pixel');
338
  if($add_facebook_pixel == "yes"){
339
- print "<input type=\"checkbox\" id=\"add_facebook_pixel\" name=\"add_facebook_pixel\" class=\"checkbox-field\" checked>";
340
  } else {
341
- print "<input type=\"checkbox\" id=\"add_facebook_pixel\" name=\"add_facebook_pixel\" class=\"checkbox-field\">";
342
  }
343
  ?>
344
  <div class="woo-product-feed-pro-slider round"></div>
@@ -348,7 +404,7 @@ if(isset($_GET["tab"])) {
348
  <?php
349
  if($add_facebook_pixel == "yes"){
350
  $facebook_pixel_id = get_option('woosea_facebook_pixel_id');
351
- print "<tr id=\"facebook_pixel_id\"><td colspan=\"2\"><span>Insert your Facebook Pixel ID:</span>&nbsp;<input type=\"text\" class=\"input-field-medium\" id=\"fb_pixel_id\" name=\"fb_pixel_id\" value=\"$facebook_pixel_id\">&nbsp;<input type=\"button\" id=\"save_facebook_pixel_id\" value=\"Save\"></td></tr>";
352
  }
353
  ?>
354
 
@@ -373,20 +429,48 @@ if(isset($_GET["tab"])) {
373
  </select>
374
  </td>
375
  </tr>
376
-
377
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  <tr id="remarketing">
379
  <td>
380
  <span><?php _e( 'Add Google Dynamic Remarketing Pixel:', 'woo-product-feed-pro');?></span>
381
  </td>
382
  <td>
383
  <label class="woo-product-feed-pro-switch">
384
- <?php
385
  $add_remarketing = get_option ('add_remarketing');
386
  if($add_remarketing == "yes"){
387
- print "<input type=\"checkbox\" id=\"add_remarketing\" name=\"add_remarketing\" class=\"checkbox-field\" checked>";
388
  } else {
389
- print "<input type=\"checkbox\" id=\"add_remarketing\" name=\"add_remarketing\" class=\"checkbox-field\">";
390
  }
391
  ?>
392
  <div class="woo-product-feed-pro-slider round"></div>
@@ -397,7 +481,7 @@ if(isset($_GET["tab"])) {
397
  if($add_remarketing == "yes"){
398
  $adwords_conversion_id = get_option('woosea_adwords_conversion_id');
399
 
400
- print "<tr id=\"adwords_conversion_id\"><td colspan=\"2\"><span>Insert your Dynamic Remarketing Conversion tracking ID:</span>&nbsp;<input type=\"text\" class=\"input-field-medium\" id=\"adwords_conv_id\" name=\"adwords_conv_id\" value=\"$adwords_conversion_id\">&nbsp;<input type=\"submit\" id=\"save_conversion_id\" value=\"Save\"></td></tr>";
401
  }
402
  ?>
403
 
@@ -422,8 +506,7 @@ if(isset($_GET["tab"])) {
422
  <?php
423
  if($add_batch == "yes"){
424
  $woosea_batch_size = get_option('woosea_batch_size');
425
-
426
- print "<tr id=\"woosea_batch_size\"><td colspan=\"2\"><span>Insert batch size:</span>&nbsp;<input type=\"text\" class=\"input-field-medium\" id=\"batch_size\" name=\"batch_size\" value=\"$woosea_batch_size\">&nbsp;<input type=\"submit\" id=\"save_batch_size\" value=\"Save\"></td></tr>";
427
  }
428
  ?>
429
  </form>
@@ -440,70 +523,89 @@ if(isset($_GET["tab"])) {
440
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
441
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
442
  $test_file = $external_path . "/tesfile.txt";
443
- $test_file_xml = $external_path . "/xml/tesfile.txt";
444
- $test_file_csv = $external_path . "/csv/tesfile.txt";
445
- $test_file_txt = $external_path . "/txt/tesfile.txt";
446
- $test_file_tsv = $external_path . "/tsv/tesfile.txt";
447
- $test_file_logs = $external_path . "/logs/tesfile.txt";
448
 
449
  if (is_writable($external_path)) {
450
- // Normal root category
451
- $fp = @fopen($test_file, 'w');
452
- @fwrite($fp, 'Cats chase mice');
453
- @fclose($fp);
454
- if(is_file($test_file)){
455
- $directory_perm = "True";
456
- }
457
-
458
- // XML subcategory
459
- $fp = @fopen($test_file_xml, 'w');
460
- @fwrite($fp, 'Cats chase mice');
461
- @fclose($fp);
462
- if(is_file($test_file_xml)){
463
- $directory_perm_xml = "True";
464
- } else {
465
- $directory_perm_xml = "False";
466
- }
467
-
468
- // CSV subcategory
469
- $fp = @fopen($test_file_csv, 'w');
470
- @fwrite($fp, 'Cats chase mice');
471
- @fclose($fp);
472
- if(is_file($test_file_csv)){
473
- $directory_perm_csv = "True";
474
- } else {
475
- $directory_perm_csv = "False";
476
- }
477
-
478
- // TXT subcategory
479
- $fp = @fopen($test_file_txt, 'w');
480
- @fwrite($fp, 'Cats chase mice');
481
- @fclose($fp);
482
- if(is_file($test_file_txt)){
483
- $directory_perm_txt = "True";
484
- } else {
485
- $directory_perm_txt = "False";
486
- }
487
-
488
- // TSV subcategory
489
- $fp = @fopen($test_file_tsv, 'w');
490
- @fwrite($fp, 'Cats chase mice');
491
- @fclose($fp);
492
- if(is_file($test_file_tsv)){
493
- $directory_perm_tsv = "True";
494
- } else {
495
- $directory_perm_tsv = "False";
496
- }
497
-
498
- // Logs subcategory
499
- $fp = @fopen($test_file_logs, 'w');
500
- @fwrite($fp, 'Cats chase mice');
501
- @fclose($fp);
502
- if(is_file($test_file_logs)){
503
- $directory_perm_logs = "True";
504
- } else {
505
- $directory_perm_logs = "False";
506
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  } else {
508
  $directory_perm = "False";
509
  }
@@ -515,10 +617,14 @@ if(isset($_GET["tab"])) {
515
  $cron_enabled = "True";
516
  }
517
 
 
 
 
 
518
  print "<table class=\"woo-product-feed-pro-table\">";
519
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
520
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
521
- print "<tr><td>PHP-version sufficient</td><td>$php_validation ($versions[PHP])</td></tr>";
522
  print "<tr><td>Product feed directory writable</td><td>$directory_perm</td></tr>";
523
  print "<tr><td>Product feed XML directory writable</td><td>$directory_perm_xml</td></tr>";
524
  print "<tr><td>Product feed CSV directory writable</td><td>$directory_perm_csv</td></tr>";
73
  //we check if the page is visited by click on the tabs or on the menu button.
74
  //then we get the active tab.
75
  $active_tab = "woosea_manage_settings";
76
+
77
+ // create nonce
78
+ $nonce = wp_create_nonce( 'woosea_ajax_nonce' );
79
+
80
  $header_text = __( 'Plugin settings', 'woo-product-feed-pro' );
81
  if(isset($_GET["tab"])) {
82
  if($_GET["tab"] == "woosea_manage_settings"){
105
  ?>
106
  </span>
107
  </div>
108
+
109
+ <?php
110
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
111
+ ?>
112
+ <div class="notice notice-error is-dismissible">
113
+ <p>
114
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
115
+ We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active for it to be able to update and generate your product feeds. More information on the inner workings of our plugin and instructions on how to enable your WP-Cron can be found here: <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>My feed won't update or is stuck processing</strong></a>.
116
+ </p>
117
+ </div>
118
+ <?php
119
+ }
120
+ ?>
121
+
122
 
123
  <!-- wordpress provides the styling for tabs. -->
124
  <h2 class="nav-tab-wrapper">
179
  </tr>
180
  <tr class="<?php print"$elite_disable";?>" id="identifier_option">
181
  <td>
182
+ <span><?php _e( 'Add GTIN, MPN, UPC, EAN, Product condition, Optimised title, Installment, Unit measure, Brand and many more attributes to your store:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/add-gtin-mpn-upc-ean-product-condition-optimised-title-and-brand-attributes/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=adding fields" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
183
  </td>
184
  <td>
185
  <label class="woo-product-feed-pro-switch">
197
  </tr>
198
  <tr class="<?php print"$elite_disable";?>" id="manipulation_option">
199
  <td>
200
+ <span><?php _e( 'Enable the Product Data Manipulation feature:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/feature-product-data-manipulation/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=wpml support" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
201
  </td>
202
  <td>
203
  <label class="woo-product-feed-pro-switch">
256
  ?>
257
  <tr>
258
  <td>
259
+ <span><?php _e( 'Use parent variable product image for variations', 'woo-product-feed-pro');?></span>
260
  </td>
261
  <td>
262
  <label class="woo-product-feed-pro-switch">
274
  </tr>
275
  <tr>
276
  <td>
277
+ <span><?php _e( 'Add shipping costs for all countries to your feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
278
  </td>
279
  <td>
280
  <label class="woo-product-feed-pro-switch">
310
  </tr>
311
  <tr>
312
  <td>
313
+ <span><?php _e( 'Remove the free shipping zone from your feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
314
+ </td>
315
+ <td>
316
+ <label class="woo-product-feed-pro-switch">
317
+ <?php
318
+ $remove_free_shipping = get_option ('remove_free_shipping');
319
+ if($remove_free_shipping == "yes"){
320
+ print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\" checked>";
321
+ } else {
322
+ print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\">";
323
+ }
324
+ ?>
325
+ <div class="woo-product-feed-pro-slider round"></div>
326
+ </label>
327
+ </td>
328
+ </tr>
329
+ <tr>
330
+ <td>
331
+ <span><?php _e( 'Remove the local pickup shipping zone from your feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
332
  </td>
333
  <td>
334
  <label class="woo-product-feed-pro-switch">
362
  </label>
363
  </td>
364
  </tr>
365
+ <!--
366
+ <tr>
367
+ <td>
368
+ <span><?php _e( 'Add CDATA to title, description and short description:', 'woo-product-feed-pro');?></span>
369
+ </td>
370
+ <td>
371
+ <label class="woo-product-feed-pro-switch">
372
+ <?php
373
+ $add_woosea_cdata = get_option ('add_woosea_cdata');
374
+ if($add_woosea_cdata == "yes"){
375
+ print "<input type=\"checkbox\" id=\"add_woosea_cdata\" name=\"add_woosea_cdata\" class=\"checkbox-field\" checked>";
376
+ } else {
377
+ print "<input type=\"checkbox\" id=\"add_woosea_cdata\" name=\"add_woosea_cdata\" class=\"checkbox-field\">";
378
+ }
379
+ ?>
380
+ <div class="woo-product-feed-pro-slider round"></div>
381
+ </label>
382
+ </td>
383
+ </tr>
384
+ -->
385
 
386
  <tr id="facebook_pixel">
387
  <td>
392
  <?php
393
  $add_facebook_pixel = get_option ('add_facebook_pixel');
394
  if($add_facebook_pixel == "yes"){
395
+ print "<input type=\"checkbox\" id=\"add_facebook_pixel\" name=\"add_facebook_pixel\" class=\"checkbox-field\" value=\"$nonce\" checked>";
396
  } else {
397
+ print "<input type=\"checkbox\" id=\"add_facebook_pixel\" name=\"add_facebook_pixel\" class=\"checkbox-field\" value=\"$nonce\">";
398
  }
399
  ?>
400
  <div class="woo-product-feed-pro-slider round"></div>
404
  <?php
405
  if($add_facebook_pixel == "yes"){
406
  $facebook_pixel_id = get_option('woosea_facebook_pixel_id');
407
+ print "<tr id=\"facebook_pixel_id\"><td colspan=\"2\"><span>Insert your Facebook Pixel ID:</span>&nbsp;<input type=\"hidden\" name=\"nonce_facebook_pixel_id\" id=\"nonce_facebook_pixel_id\" value=\"$nonce\"><input type=\"text\" class=\"input-field-medium\" id=\"fb_pixel_id\" name=\"fb_pixel_id\" value=\"$facebook_pixel_id\">&nbsp;<input type=\"button\" id=\"save_facebook_pixel_id\" value=\"Save\"></td></tr>";
408
  }
409
  ?>
410
 
429
  </select>
430
  </td>
431
  </tr>
432
+ <?php
433
+ if($elite_disable == "enabled"){
434
+ ?>
435
+ <tr class="<?php print"$elite_disable";?>" id="facebook_capi">
436
+ <td>
437
+ <span><?php _e( 'Enable Facebook Conversion API:', 'woo-product-feed-pro');?> (<a href="https://adtribes.io/facebook-conversion-api/" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
438
+ </td>
439
+ <td>
440
+ <label class="woo-product-feed-pro-switch">
441
+ <?php
442
+ $add_facebook_capi = get_option ('add_facebook_capi');
443
+ if($add_facebook_capi == "yes"){
444
+ print "<input type=\"checkbox\" id=\"add_facebook_capi\" name=\"add_facebook_capi\" class=\"checkbox-field\" value=\"$nonce\" checked>";
445
+ } else {
446
+ print "<input type=\"checkbox\" id=\"add_facebook_capi\" name=\"add_facebook_capi\" class=\"checkbox-field\" value=\"$nonce\">";
447
+ }
448
+ ?>
449
+ <div class="woo-product-feed-pro-slider round"></div>
450
+ </label>
451
+ </td>
452
+ </tr>
453
+ <?php
454
+ if($add_facebook_capi == "yes"){
455
+ $facebook_capi_token = get_option('woosea_facebook_capi_token');
456
+ print "<tr id=\"facebook_capi_token\"><td colspan=\"2\"><span>Insert your Facebook Conversion API token:</span><br/><br/><input type=\"hidden\" name=\"nonce_facebook_capi_id\" id=\"nonce_facebook_capi_id\" value=\"$nonce\"><input type=\"textarea\" class=\"textarea-field\" id=\"fb_capi_token\" name=\"fb_capi_token\" value=\"$facebook_capi_token\"><br/><br/><input type=\"button\" id=\"save_facebook_capi_token\" value=\"Save\"></td></tr>";
457
+ }
458
+ ?>
459
+ <?php
460
+ }
461
+ ?>
462
  <tr id="remarketing">
463
  <td>
464
  <span><?php _e( 'Add Google Dynamic Remarketing Pixel:', 'woo-product-feed-pro');?></span>
465
  </td>
466
  <td>
467
  <label class="woo-product-feed-pro-switch">
468
+ <?php
469
  $add_remarketing = get_option ('add_remarketing');
470
  if($add_remarketing == "yes"){
471
+ print "<input type=\"checkbox\" id=\"add_remarketing\" name=\"add_remarketing\" class=\"checkbox-field\" value=\"$nonce\" checked>";
472
  } else {
473
+ print "<input type=\"checkbox\" id=\"add_remarketing\" name=\"add_remarketing\" class=\"checkbox-field\" value=\"$nonce\">";
474
  }
475
  ?>
476
  <div class="woo-product-feed-pro-slider round"></div>
481
  if($add_remarketing == "yes"){
482
  $adwords_conversion_id = get_option('woosea_adwords_conversion_id');
483
 
484
+ print "<tr id=\"adwords_conversion_id\"><td colspan=\"2\"><span>Insert your Dynamic Remarketing Conversion tracking ID:</span>&nbsp;<input type=\"hidden\" name=\"nonce_adwords_conversion_id\" id=\"nonce_adwords_conversion_id\" value=\"$nonce\"><input type=\"text\" class=\"input-field-medium\" id=\"adwords_conv_id\" name=\"adwords_conv_id\" value=\"$adwords_conversion_id\">&nbsp;<input type=\"button\" id=\"save_conversion_id\" value=\"Save\"></td></tr>";
485
  }
486
  ?>
487
 
506
  <?php
507
  if($add_batch == "yes"){
508
  $woosea_batch_size = get_option('woosea_batch_size');
509
+ print "<tr id=\"woosea_batch_size\"><td colspan=\"2\"><span>Insert batch size:</span>&nbsp;<input type=\"hidden\" name=\"nonce_batch\" id=\"nonce_batch\" value=\"$nonce\"><input type=\"text\" class=\"input-field-medium\" id=\"batch_size\" name=\"batch_size\" value=\"$woosea_batch_size\">&nbsp;<input type=\"button\" id=\"save_batch_size\" value=\"Save\"></td></tr>";
 
510
  }
511
  ?>
512
  </form>
523
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
524
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
525
  $test_file = $external_path . "/tesfile.txt";
526
+ $test_file_xml = $external_path . "xml/tesfile.txt";
527
+ $test_file_csv = $external_path . "csv/tesfile.txt";
528
+ $test_file_txt = $external_path . "txt/tesfile.txt";
529
+ $test_file_tsv = $external_path . "tsv/tesfile.txt";
530
+ $test_file_logs = $external_path . "logs/tesfile.txt";
531
 
532
  if (is_writable($external_path)) {
533
+ // Normal root category
534
+ $fp = @fopen($test_file, 'w');
535
+ @fwrite($fp, 'Cats chase mice');
536
+ @fclose($fp);
537
+ if(is_file($test_file)){
538
+ $directory_perm = "True";
539
+ }
540
+
541
+ // XML subcategory
542
+ $fp = @fopen($test_file_xml, 'w');
543
+ if(!is_bool($fp)){
544
+ @fwrite($fp, 'Cats chase mice');
545
+ @fclose($fp);
546
+ if(is_file($test_file_xml)){
547
+ $directory_perm_xml = "True";
548
+ } else {
549
+ $directory_perm_xml = "False";
550
+ }
551
+ } else {
552
+ $directory_perm_xml = "Unknown";
553
+ }
554
+
555
+ // CSV subcategory
556
+ $fp = @fopen($test_file_csv, 'w');
557
+ if(!is_bool($fp)){
558
+ @fwrite($fp, 'Cats chase mice');
559
+ @fclose($fp);
560
+ if(is_file($test_file_csv)){
561
+ $directory_perm_csv = "True";
562
+ } else {
563
+ $directory_perm_csv = "False";
564
+ }
565
+ } else {
566
+ $directory_perm_csv = "Unknown";
567
+ }
568
+
569
+ // TXT subcategory
570
+ $fp = @fopen($test_file_txt, 'w');
571
+ if(!is_bool($fp)){
572
+ @fwrite($fp, 'Cats chase mice');
573
+ @fclose($fp);
574
+ if(is_file($test_file_txt)){
575
+ $directory_perm_txt = "True";
576
+ } else {
577
+ $directory_perm_txt = "False";
578
+ }
579
+ } else {
580
+ $directory_perm_txt = "Unknown";
581
+ }
582
+ // TSV subcategory
583
+ $fp = @fopen($test_file_tsv, 'w');
584
+ if(!is_bool($fp)){
585
+ @fwrite($fp, 'Cats chase mice');
586
+ @fclose($fp);
587
+ if(is_file($test_file_tsv)){
588
+ $directory_perm_tsv = "True";
589
+ } else {
590
+ $directory_perm_tsv = "False";
591
+ }
592
+ } else {
593
+ $directory_perm_tsv = "Uknown";
594
+ }
595
+
596
+ // Logs subcategory
597
+ $fp = @fopen($test_file_logs, 'w');
598
+ if(!is_bool($fp)){
599
+ @fwrite($fp, 'Cats chase mice');
600
+ @fclose($fp);
601
+ if(is_file($test_file_logs)){
602
+ $directory_perm_logs = "True";
603
+ } else {
604
+ $directory_perm_logs = "False";
605
+ }
606
+ } else {
607
+ $directory_perm_logs = "Unknown";
608
+ }
609
  } else {
610
  $directory_perm = "False";
611
  }
617
  $cron_enabled = "True";
618
  }
619
 
620
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
621
+ $cron_enabled = "<strong>False</strong>";
622
+ }
623
+
624
  print "<table class=\"woo-product-feed-pro-table\">";
625
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
626
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
627
+ print "<tr><td>PHP-version</td><td>$php_validation ($versions[PHP])</td></tr>";
628
  print "<tr><td>Product feed directory writable</td><td>$directory_perm</td></tr>";
629
  print "<tr><td>Product feed XML directory writable</td><td>$directory_perm_xml</td></tr>";
630
  print "<tr><td>Product feed CSV directory writable</td><td>$directory_perm_csv</td></tr>";
pages/admin/woosea-statistics-feed.php CHANGED
@@ -65,7 +65,7 @@ if (array_key_exists('project_hash', $_GET)){
65
  var ctx = document.getElementById("myChart");
66
 
67
  var myChart = new Chart(ctx, {
68
- type: 'line',
69
  data: {
70
  labels: labels,
71
  datasets: [{
65
  var ctx = document.getElementById("myChart");
66
 
67
  var myChart = new Chart(ctx, {
68
+ type: 'bar',
69
  data: {
70
  labels: labels,
71
  datasets: [{
readme.txt CHANGED
@@ -2,17 +2,17 @@
2
  Contributors: jorisverwater,supportadtribes,evavangelooven
3
  License: GPLv3
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
- Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
6
  Requires at least: 4.5
7
- Tested up to: 5.6
8
- Stable tag: 9.3.7
9
 
10
  == Description ==
11
 
12
- Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner, Vergelijk.nl and many more. Next to custom feeds there are over 100 pre-defined templates included for marketplaces, comparison shopping engines and search engines. This plugin provides high-quality product feed for Google Shopping and many many more.
13
 
14
  = Why choose this plugin? =
15
- Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support.
16
 
17
  = Our mission =
18
  Offer free and advanced, intuitive, tooling and plugins for website owners and marketers to easily set-up and manage their online marketing campaigns.
@@ -61,21 +61,27 @@ This plugin enables you to add and configure Google Analytics UTM tracking-codes
61
  = Shipping class support =
62
  This plugin enables you to set the shipping zone (and shipping class) so the right shipping cost end up in your product feed. Our plugin uses all shipping zone settings you have configured in WooCommerce (flat rates, classes and free shipping). Our support also supports US and Australian postal codes and regions.
63
 
 
 
 
64
  = WooCommerce Shipping Table Rate (Bolder Elements) support =
65
  Our plugin supports the WooCommerce Shipping Table Rate plugin created by Bolder Elements.
66
 
67
  = Product variations / Variables =
68
  This plugin supports product variables so all your variations make it to product feeds as individual products too.
69
 
70
- = Facebook Pixel (Elite version) =
71
  This plugin adds the Facebook pixel code on your websites and makes sure it matches the content of your Facebook catalogue product feed
72
  Our plugin add's the following Facebook pixel events:
73
  * on your product pages, both for simple, variable and variations pages
74
  * on your category pages (ViewCategory event)
75
  * on your search result pages (Search event)
76
  * on your cart page (AddToCart event)
77
- * on the add to cart button (AddToCart event)
78
- * on the thank you page (PurChase event)
 
 
 
79
 
80
  = Google Dynamic Remarketing Pixel =
81
  This plugin adds the Google Dynamic Remarketing pixel code on your website.
@@ -112,6 +118,8 @@ Our plugin supports Polylang
112
  * XML, CSV, TSV and TXT formats;
113
  * Supports WPML (version 4.1 and higher)
114
  * Supports WCML, WooCommerce Multilingual
 
 
115
  * Intuitive interface;
116
  * Supports product variations / variables;
117
  * Scheduled product feed refreshes: daily, twice-daily or every hour;
@@ -125,6 +133,7 @@ Our plugin supports Polylang
125
  * Google Analytics support: add Google Analytics UTM parameters to your product feed and individual products.
126
  * Supports the official Facebook for WooCommerce plugin (SKU_ID parameter)
127
  * Supports Yoasts primary category feature
 
128
  * Supports the official "WooCommerce Brands" plugin
129
  * Supports Yith brand attributes
130
  * Supports the official "WooCommerce Product Bundles" plugin
@@ -134,19 +143,20 @@ Our plugin supports Polylang
134
  * Supports WooCommerce Dynamic Pricing & Discounts from RightPress
135
  * Supports the Discount Rules for WooCommerce plugin from FlyCart
136
  * Supports WC Fields Factory
 
137
  * Supports Table Rate Shipping for WooCommerce from Bolder Elements
138
  * Supports usage of the All In One SEO pack title and description attributes
 
139
 
140
  Some of the above mentioned feature can only be used by users who upgraded to the Elite version of our plugin
141
 
142
  === Elite paid features ===
143
- * WPML support
144
  * Aelia currency switcher support
145
  * Polylang support
146
  * Addition of the extra fields on your product edit pages
147
  * Data manipulation feature
148
  * WooCommerce structured data bug fix
149
- * Facebook pixel
150
 
151
  === Channels ===
152
  * Custom feeds
@@ -158,10 +168,13 @@ Some of the above mentioned feature can only be used by users who upgraded to th
158
  * Google Local Products
159
  * Google Local Products Inventory
160
  * Google Shopping Actions
161
- * Facebook Dynamic Ads / remarketing
162
  * Bing Shopping
 
163
  * Pinterest
 
164
  * <a href="https://businesshelp.snapchat.com/en-US/a/product-catalog-specs" target="_blank">Snapchat</a>
 
165
  * <a href="https://yandex.com/support/market-tech-requirements/index.html" target="_blank">Yandex</a>
166
  * ShopMania
167
  * Shopping.com
@@ -175,6 +188,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
175
  * <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
176
  * <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
177
  * <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
 
178
  * Bol.com
179
  * Stylight
180
  * Incurvy
@@ -195,6 +209,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
195
  * <a href="https://www.miinto.nl" target="_blank">Miinto Netherlands</a>
196
  * <a href="https://www.miinto.pl" target="_blank">Miinto Poland</a>
197
  * <a href="https://www.miinto.se" target="_blank">Miinto Sweden</a>
 
198
  * <a href="https://www.vertaa.fi" target="_blank">Vertaa.fi</a>
199
  * Prisjakt
200
  * Hintaseuranta
@@ -225,10 +240,12 @@ Some of the above mentioned feature can only be used by users who upgraded to th
225
  * <a href="https://company.billiger.de/wAssets/docs/landingpages/Data-Feed-Specification.pdf" target="_blank" rel="nofollow">Billiger.de</a>
226
  * Choozen
227
  * Domodi
 
228
  * Geizhals
229
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
230
  * Hood.de
231
  * Ladenzeile.de
 
232
  * Livingo.de
233
  * Medizinfuchs.de
234
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
@@ -249,13 +266,13 @@ Some of the above mentioned feature can only be used by users who upgraded to th
249
  == Installation ==
250
 
251
  === From within Wordpress ===
252
- 1. Visit Plugins > Add New’;
253
- 1. Search for Product Feed PRO for WooCommerce’;
254
- 1. Activate Product Feed PRO for WooCommerce from your plugins page.
255
 
256
  === Manually ===
257
  1. Upload the woo-product-feed-pro folder to your /wp-content/plugins/ directory;
258
- 1. Activate Product Feed PRO for WooCommerce from your plugins page.
259
 
260
  == Frequently Asked Questions ==
261
 
@@ -322,6 +339,508 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
322
 
323
  === Changelog ===
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  = 9.3.7 (2021-01-12) =
326
  * Added the Bestprice.gr template
327
 
@@ -2988,6 +3507,509 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
2988
 
2989
  == Upgrade Notice ==
2990
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2991
  = 9.3.7 =
2992
  Added the Bestprice.gr template
2993
 
2
  Contributors: jorisverwater,supportadtribes,evavangelooven
3
  License: GPLv3
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
+ Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook pixel, Facebook Conversion API, Facebook CAPI,Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
6
  Requires at least: 4.5
7
+ Tested up to: 5.8
8
+ Stable tag: 10.9.8
9
 
10
  == Description ==
11
 
12
+ Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner, Skroutz and many more. Next to custom feeds there are over 100 pre-defined templates included for marketplaces, comparison shopping engines and search engines. This plugin provides high-quality product feed for Google Shopping and many many more.
13
 
14
  = Why choose this plugin? =
15
+ Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support. Next to creating product feeds this plugin also add's the Facebook pixel, Facebook Conversion API (CAPI) and Google Dynamic Remarketing pixel to your website and makes sure they are aligned with your feeds.
16
 
17
  = Our mission =
18
  Offer free and advanced, intuitive, tooling and plugins for website owners and marketers to easily set-up and manage their online marketing campaigns.
61
  = Shipping class support =
62
  This plugin enables you to set the shipping zone (and shipping class) so the right shipping cost end up in your product feed. Our plugin uses all shipping zone settings you have configured in WooCommerce (flat rates, classes and free shipping). Our support also supports US and Australian postal codes and regions.
63
 
64
+ = WooCommerce Shipping Table Rate (official WooCommerce) support =
65
+ Our plugin supports the official shipping table rate plugin of WooCommerce
66
+
67
  = WooCommerce Shipping Table Rate (Bolder Elements) support =
68
  Our plugin supports the WooCommerce Shipping Table Rate plugin created by Bolder Elements.
69
 
70
  = Product variations / Variables =
71
  This plugin supports product variables so all your variations make it to product feeds as individual products too.
72
 
73
+ = Facebook Pixel =
74
  This plugin adds the Facebook pixel code on your websites and makes sure it matches the content of your Facebook catalogue product feed
75
  Our plugin add's the following Facebook pixel events:
76
  * on your product pages, both for simple, variable and variations pages
77
  * on your category pages (ViewCategory event)
78
  * on your search result pages (Search event)
79
  * on your cart page (AddToCart event)
80
+ * on the checkout page (initiateCheckout event)
81
+ * on the order thank you page (PurChase event)
82
+
83
+ = Facebook Conversion API (CAPI) =
84
+ This plugin connects to the Facebook Conversion API so all your website conversions are being tracked properly
85
 
86
  = Google Dynamic Remarketing Pixel =
87
  This plugin adds the Google Dynamic Remarketing pixel code on your website.
118
  * XML, CSV, TSV and TXT formats;
119
  * Supports WPML (version 4.1 and higher)
120
  * Supports WCML, WooCommerce Multilingual
121
+ * Supports Aelia Currency Switcher
122
+ * Supports Polylang
123
  * Intuitive interface;
124
  * Supports product variations / variables;
125
  * Scheduled product feed refreshes: daily, twice-daily or every hour;
133
  * Google Analytics support: add Google Analytics UTM parameters to your product feed and individual products.
134
  * Supports the official Facebook for WooCommerce plugin (SKU_ID parameter)
135
  * Supports Yoasts primary category feature
136
+ * Supports Rankmaths primary category feature
137
  * Supports the official "WooCommerce Brands" plugin
138
  * Supports Yith brand attributes
139
  * Supports the official "WooCommerce Product Bundles" plugin
143
  * Supports WooCommerce Dynamic Pricing & Discounts from RightPress
144
  * Supports the Discount Rules for WooCommerce plugin from FlyCart
145
  * Supports WC Fields Factory
146
+ * Supports Table Rate Shipping for WooCommerce from WooCommerce
147
  * Supports Table Rate Shipping for WooCommerce from Bolder Elements
148
  * Supports usage of the All In One SEO pack title and description attributes
149
+ * Supports the WPC Product Bundles for WooCommerce plugin
150
 
151
  Some of the above mentioned feature can only be used by users who upgraded to the Elite version of our plugin
152
 
153
  === Elite paid features ===
154
+ * WPML / WCML support
155
  * Aelia currency switcher support
156
  * Polylang support
157
  * Addition of the extra fields on your product edit pages
158
  * Data manipulation feature
159
  * WooCommerce structured data bug fix
 
160
 
161
  === Channels ===
162
  * Custom feeds
168
  * Google Local Products
169
  * Google Local Products Inventory
170
  * Google Shopping Actions
171
+ * Facebook Dynamic Ad's / remarketing
172
  * Bing Shopping
173
+ * Bing Shopping Promotions
174
  * Pinterest
175
+ * <a href="https://help.vivino.com/s/article/How-do-I-create-my-product-feed-XML?language=en_US" target="_blank">Vivino</a>
176
  * <a href="https://businesshelp.snapchat.com/en-US/a/product-catalog-specs" target="_blank">Snapchat</a>
177
+ * <a href="https://ads.tiktok.com/help/article?aid=10001006" target="_blank">TikTok</a>
178
  * <a href="https://yandex.com/support/market-tech-requirements/index.html" target="_blank">Yandex</a>
179
  * ShopMania
180
  * Shopping.com
188
  * <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
189
  * <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
190
  * <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
191
+ * <a href="https://www.boetiek.nl" target="_blank">Boetiek.nl</a>
192
  * Bol.com
193
  * Stylight
194
  * Incurvy
209
  * <a href="https://www.miinto.nl" target="_blank">Miinto Netherlands</a>
210
  * <a href="https://www.miinto.pl" target="_blank">Miinto Poland</a>
211
  * <a href="https://www.miinto.se" target="_blank">Miinto Sweden</a>
212
+ * <a href="https://www.miinto.de" target="_blank">Miinto Germany</a>
213
  * <a href="https://www.vertaa.fi" target="_blank">Vertaa.fi</a>
214
  * Prisjakt
215
  * Hintaseuranta
240
  * <a href="https://company.billiger.de/wAssets/docs/landingpages/Data-Feed-Specification.pdf" target="_blank" rel="nofollow">Billiger.de</a>
241
  * Choozen
242
  * Domodi
243
+ * <a href="https://www.elcheapo.de" target="_blank" rel="nofollow">ElCheapo.de</a>
244
  * Geizhals
245
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
246
  * Hood.de
247
  * Ladenzeile.de
248
+ * <a href="https://connect.idealo.de/import/en/csv/#_attributes_documentation" target="_blank">Idealo.de</a>
249
  * Livingo.de
250
  * Medizinfuchs.de
251
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
266
  == Installation ==
267
 
268
  === From within Wordpress ===
269
+ 1. Visit Plugins > Add New;
270
+ 1. Search for Product Feed PRO for WooCommerce;
271
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
272
 
273
  === Manually ===
274
  1. Upload the woo-product-feed-pro folder to your /wp-content/plugins/ directory;
275
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
276
 
277
  == Frequently Asked Questions ==
278
 
339
 
340
  === Changelog ===
341
 
342
+ = 10.9.8 (2021-12-09) =
343
+ * Replaced usage of site_url with home_url for feed headings
344
+
345
+ = 10.9.7 (2021-12-05) =
346
+ * Added template for Miinto Germany
347
+
348
+ = 10.9.6 (2021-12-04) =
349
+ * Fixed some PHP notices that showed when the Google Dynamic Remarketing feature was enabled but parent variable products returned no price
350
+
351
+ = 10.9.5 (2021-12-03) =
352
+ * Solved an issue where product variations could not be updated
353
+
354
+ = 10.9.4 (2021-12-02) =
355
+ * Removed the graphs from the manage feeds page, will soon be replaced by new ones
356
+ * Replaced a filter_var_array function with a proper Wordpress sanitize function
357
+
358
+ = 10.9.3 (2021-12-01) =
359
+ * Added the System regular price ex. VAT and System sale price ex. VAT attributes
360
+
361
+ = 10.9.2 (2021-12-01) =
362
+ * Updated the out of date Chart.js libraries
363
+ * Removed eval for shipping cost formula's
364
+ * Replaced usage of CURL with Wordpress HTTP API
365
+ * Solved some translation permalink issues
366
+ * Added missing sanitizing to POST and GET requests
367
+ * Added escaping to some variables that are being echo'd
368
+
369
+ = 10.9.1 (2021-11-29) =
370
+ * Added extra authorisation and checks to prevent cross-site scripting abuse
371
+ * Added Guadeloupe (GP), Martinique (MQ), French Guiana (GF) and Reunion (RE) to the list of supported countries
372
+ * Removed CDATA feature as it was not properly functioning
373
+
374
+ = 10.9.0 (2021-11-25) =
375
+ * Added template for TikTok
376
+
377
+ = 10.8.9 (2021-11-22) =
378
+ * Added template for German ElCheapo.de
379
+
380
+ = 10.8.8 (2021-11-18) =
381
+ * Fixed an issue with the Discount Rules for WooCommerce plugin from FlyCart that returned no decimals in round discount prices. The .00 are now also added.
382
+
383
+ = 10.8.7 (2021-11-15) =
384
+ * Added extra image attribute 4 to 9 for Beslist.nl feeds
385
+
386
+ = 10.8.6 (2021-11-12) =
387
+ * Tested for compatibility with WooCommerce 5.9
388
+
389
+ = 10.8.5 (2021-11-07) =
390
+ * Fixed the JSON-lD for the brand details
391
+
392
+ = 10.8.4 (2021-11-02) =
393
+ * Fixed an issue with Skroutz feeds where product sizes that are out of stock are now removed from the size field
394
+
395
+ = 10.8.3 (2021-11-01) =
396
+ * Solved a PHP notice upon activation of plugin
397
+
398
+ = 10.8.2 (2021-10-30) =
399
+ * Solved a PHP notice upon activation of plugin
400
+
401
+ = 10.8.1 (2021-10-26) =
402
+ * Added the "is not empty" operator for filters and rules
403
+
404
+ = 10.8.0 (2021-10-25) =
405
+ * When the product variable is not an object the retrieval of the stock status broke processing of the feed. Build in a check to prevent this from happening.
406
+
407
+ = 10.7.9 (2021-10-24) =
408
+ * Tested for compatibility with WooCommerce 5.8
409
+
410
+ = 10.7.8 (2021-10-18) =
411
+ * Reviews that have no rating or have deeplinks in the review text are now being removed fromn review feeds automatically as they are not allowed by Google
412
+
413
+ = 10.7.7 (2021-10-17) =
414
+ * Added the Region Id attribute for Google Shopping feeds
415
+
416
+ = 10.7.5 (2021-10-14) =
417
+ * Added the Miinto.fr template
418
+
419
+ = 10.7.4 (2021-10-13) =
420
+ * Fixed a division by zero error
421
+
422
+ = 10.7.3 (2021-10-12) =
423
+ * Fixed filters on purchase note array's
424
+
425
+ = 10.7.2 (2021-10-12) =
426
+ * Added support for the WPC Product Bundles for WooCommerce plugin
427
+
428
+ = 10.7.1 (2021-10-11) =
429
+ * Added purchase note attribute
430
+
431
+ = 10.7.0 (2021-10-05) =
432
+ * Made changes to the code to calculate the number of product variations that are on stock as it did not work for some users
433
+
434
+ = 10.6.9 (2021-10-01) =
435
+ * Solved some PHP 8 compatibility issues that caused feeds to get stuck processing
436
+
437
+ = 10.6.8 (2021-09-30) =
438
+ * Solved a Call to undefined method WC_Product_Simple::get_available_variations error
439
+
440
+ = 10.6.7 (2021-09-29) =
441
+ * Made a change to the code so it uses less memory when processing a feed
442
+
443
+ = 10.6.6 (2021-09-28) =
444
+ * Solved an issue where the plugin got stuck when variable products get deleted in WooCommerce during processing of the feed
445
+
446
+ = 10.6.5 (2021-09-22) =
447
+ * Build in an extra check to see if the cron events are active to update feeds. When not this cron event is being created.
448
+
449
+ = 10.6.4 (2021-09-14) =
450
+ * Added capacity attribute to the Google Shopping template
451
+
452
+ = 10.6.3 (2021-09-13) =
453
+ * Added display ads attributes to the Google Shopping template
454
+
455
+ = 10.6.2 (2021-09-13) =
456
+ * Fixed an issue where simple products with variations (which in theory is not possible) caused the feed processing to get stuck
457
+
458
+ = 10.6.1 (2021-09-09) =
459
+ * Solved an undefined array issue when creating a new feed
460
+
461
+ = 10.6.0 (2021-09-09) =
462
+ * Solved an issue with wrong sale prices when WCML was enabled and manual prices were entered
463
+
464
+ = 10.5.9 (2021-09-08) =
465
+ * Somehow simple products got an item_group_id for some users causing a critical error. Added a check on this to fix the error.
466
+
467
+ = 10.5.8 (2021-09-07) =
468
+ * Added a feature to be able to remove products from feeds when only few variations are in stock
469
+
470
+ = 10.5.7 (2021-09-07) =
471
+ * Fixed an issue where Rankmath plugin is installed but no primary category has been set. This resulted in a PHP notice in the logs. This has been solved now.
472
+
473
+ = 10.5.6 (2021-09-03) =
474
+ * Fixed an undefined variable issue for the facebook pixel id
475
+
476
+ = 10.5.5 (2021-09-01) =
477
+ * Fixed a Google Remarketing Pixel issue on the cart page
478
+
479
+ = 10.5.4 (2021-09-01) =
480
+ * Fixed a shipping cost issue where shipping classes that had no shipping costs set where empty
481
+ * Fixed a Google Remarketing pixel, added apostrophe on the AW-XXXXXX parameter
482
+
483
+ = 10.5.3 (2021-08-29) =
484
+ * Solved a bug: when the XML variable was not an object is returned a fatal error. Issue is solved now.
485
+
486
+ = 10.5.2 (2021-08-25) =
487
+ * Tested for compatibility with WooCommerce 5.6
488
+
489
+ = 10.5.1 (2021-08-18) =
490
+ * Fixed an issue where the visibility attribute did not return anything
491
+
492
+ = 10.5.0 (2021-08-11) =
493
+ * Added the Vivino template to the plugin
494
+
495
+ = 10.4.9 (2021-08-10) =
496
+ * Added support for Prisjakt (Sweden, Norway, Finland) feeds. The Google Shopping feed requirements are being used for it as of this release.
497
+
498
+ = 10.4.8 (2021-08-10) =
499
+ * Added support for the Yoast SEO WooCommerce unique identifiers GTIN's, ISBN, MPN so they can be used for feeds.
500
+
501
+ = 10.4.7 (2021-07-28) =
502
+ * Checked for compatibility with WP 5.8
503
+
504
+ = 10.4.6 (2021-07-22) =
505
+ * Facebook is not yet using the new availability values yet so reverting it back for Facebook only
506
+
507
+ = 10.4.5 (2021-07-21) =
508
+ * Google changed its availability requirements (underscores in the availability values), we have adjusted the plugin on this.
509
+
510
+ = 10.4.4 (2021-07-15) =
511
+ * Fixed a product review feed bug where review names with a : in it broke the feed.
512
+
513
+ = 10.4.3 (2021-07-12) =
514
+ * Added the non tax price attribute for WCML
515
+
516
+ = 10.4.2 (2021-07-09) =
517
+ * Fixed a shipping issue where table rates where put on 0 when pickup was available too.
518
+
519
+ = 10.4.1 (2021-07-08) =
520
+ * Implemented Google's new Dynamic Remarketing event pixelcode and added the Purchase and Add To Cart events for it
521
+
522
+ = 10.4.0 (2021-07-03) =
523
+ * Fixed a PHP notice on a foreach loop when a non-array was used for it
524
+
525
+ = 10.3.9 (2021-07-02) =
526
+ * A PHP warning was thrown when a review feed was created while there were no reviews in WooCommerce
527
+
528
+ = 10.3.8 (2021-07-02) =
529
+ * Fixed a bug: When a find and replace rule was created it converted strings to lowercases, this has been fixed.
530
+
531
+ = 10.3.7 (2021-07-01) =
532
+ * Added Facebook Auto / Vehicle fields to the Facebook templating
533
+
534
+ = 10.3.6 (2021-06-30) =
535
+ * Added eventID's to the Facebook pixel and Facebook Conversion API in order to prevent duplicate events being measured
536
+
537
+ = 10.3.5 (2021-06-29) =
538
+ * Fixed a bug: using a rounding price attribute did not work properly when in WooCommerce currency options the decimal or thousand separator was left blank, it always rounded down. This has been fixed.
539
+
540
+ = 10.3.4 (2021-06-28) =
541
+ * Added the quantity_to_sell_on_facebook field to the Facebook template
542
+
543
+ = 10.3.3 (2021-06-25) =
544
+ * Added a 'Link without parameters' attribute (which holds no attribute or UTM parameters in the URL)
545
+
546
+ = 10.3.2 (2021-06-18) =
547
+ * Added some product data attributes to the Google Shopping template: capacity, count, disclosure date, feature description, flavor, format, product line, product page url, release date, scent, size system, size type, suggested retail price, theme and video link
548
+
549
+ = 10.3.1 (2021-06-16) =
550
+ * Removed Okazii.ro from the list of supported channels
551
+
552
+ = 10.3.0 (2021-06-16) =
553
+ * Cleaning-up some debug code for the Facebook CAPI implementation
554
+
555
+ = 10.2.9 (2021-06-15) =
556
+ * Added support for the Facebook Conversion API (CAPI) - still in beta!
557
+ * Stripped whitespaces from values in CSV feeds
558
+
559
+ = 10.2.8 (2021-06-14) =
560
+ * Checked for compatibility with WooCommerce 5.4
561
+
562
+ = 10.2.7 (2021-06-13) =
563
+ * Added Adwords grouping, Adwords labels and Adwords redirect fields to the Bing Shopping template
564
+
565
+ = 10.2.6 (2021-06-11) =
566
+ * Added an array check on custom attributes
567
+
568
+ = 10.2.5 (2021-06-09) =
569
+ * When discount plugins are being used prices will be rounded on 2 decimals
570
+
571
+ = 10.2.4 (2021-06-09) =
572
+ * Fixed a CDATA issue
573
+
574
+ = 10.2.3 (2021-06-08) =
575
+ * Added seller name to Google & Bing shopping templates
576
+
577
+ = 10.2.2 (2021-06-04) =
578
+ * Removed an useless nonce
579
+
580
+ = 10.2.1 (2021-06-04) =
581
+ * Added XSS vulnerability checks on both the Google Remarketing pixel and Facebook pixel feature.
582
+
583
+ = 10.2.0 (2021-06-02) =
584
+ * Removed a CSS z-index as it conflicted with Jetpack
585
+
586
+ = 10.1.9 (2021-06-01) =
587
+ * Fixed a PHP notice that showed when users created an empty rule
588
+
589
+ = 10.1.8 (2021-05-31) =
590
+ * When the identifier exists field mapping is removed from the field mapping also remove it from the feed
591
+ * Some minor textual changes in the feed configuration forms
592
+
593
+ = 10.1.7 (2021-05-27) =
594
+ * Fixed a bug: The Facebook pixel addToCart, initiateCheckout and Purchase event does not accept comma's in prices. Fixed.
595
+
596
+ = 10.1.6 (2021-05-27) =
597
+ * Fixed a bug: The Facebook pixel viewContent event does not accept comma's in prices. Fixed.
598
+
599
+ = 10.1.5 (2021-05-24) =
600
+ * Fixed a bug: exclude filters on regular prices did not work
601
+
602
+ = 10.1.4 (2021-05-24) =
603
+ * Adding CDATA feature so CDATA can be added to the title, description and short description fields
604
+
605
+ = 10.1.3 (2021-05-24) =
606
+ * Fixed an issue with taxes being added in the system sale prices
607
+
608
+ = 10.1.2 (2021-05-14) =
609
+ * Added the product type field mapping as default mapping for Google Shopping feeds
610
+
611
+ = 10.1.1 (2021-05-12) =
612
+ * Added support for Mix and Match minimum and maximum prices
613
+ * Removed the item_group_id for Mix and Match products
614
+
615
+ = 10.1.0 (2021-05-12) =
616
+ * Tested for compatibility with WooCommerce 5.3
617
+ * Changed UI when saving new plugin batch size so it shows the correct batch number immediatly
618
+
619
+ = 10.0.9 (2021-05-04) =
620
+ * Added extra fields for Google's local storefront shopping feeds
621
+
622
+ = 10.0.8 (2021-04-28) =
623
+ * Fixed an issue with the image field for custom feeds, it was added as image_link. This has been fixed now.
624
+
625
+ = 10.0.7 (2021-04-27) =
626
+ * Added support for ACF image fields (make sure to use image or bild in your field name)
627
+
628
+ = 10.0.6 (2021-04-27) =
629
+ * Added support for the WooCommerce Shipping & Tax plugin
630
+
631
+ = 10.0.5 (2021-04-21) =
632
+ * Added the "pickup today / merchant hosted local storefront" fields for Google Shopping
633
+
634
+ = 10.0.4 (2021-04-19) =
635
+ * Fixed an issue where shipping costs where missing from feeds
636
+ * Lowest shipping costs did not return the lowest price when prices where not numeric. This has been fixed now.
637
+
638
+ = 10.0.3 (2021-04-19) =
639
+ * When variations are out of stock we remove them from the parent product for Skroutz feeds
640
+
641
+ = 10.0.2 (2021-04-18) =
642
+ * Fixed a bug: rules that where set on attributes that were empty accidently added values to the product data. This has been fixed now.
643
+
644
+ = 10.0.1 (2021-04-16) =
645
+ * Fixed a bug: the multiple standard tax rates are now also taken into account for shipping costs
646
+
647
+ = 10.0.0 (2021-04-15) =
648
+ * Fixed a bug: when multiple standard tax rates for multiple countries where configured the plugin did not pick the correct tax rate when a feed was configured for a country other then the base country. This has been fixed now.
649
+
650
+ = 9.9.9 (2021-04-12) =
651
+ * Added a "force clean-up" feature that in one go removes all feed configurations and scheduled jobs
652
+
653
+ = 9.9.8 (2021-04-12) =
654
+ * Added support for non numeric characters in the AW Dynamic tracking ID
655
+
656
+ = 9.9.7 (2021-04-11) =
657
+ * Fixed helptexts and notifications
658
+
659
+ = 9.9.6 (2021-04-08) =
660
+ * Added support for the Rankmath primary category
661
+
662
+ = 9.9.5 (2021-04-08) =
663
+ * Fixed an issue with the product_url field for Google review feeds. The & charcater was shown as AND. Issue fixed now.
664
+
665
+ = 9.9.4 (2021-03-30) =
666
+ * Added lowest shipping costs attribute
667
+
668
+ = 9.9.3 (2021-03-29) =
669
+ * Removed currency from shipping costs of Heureka feeds
670
+
671
+ = 9.9.2 (2021-03-27) =
672
+ * Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
673
+
674
+ = 9.9.1 (2021-03-25) =
675
+ * Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
676
+
677
+ = 9.9.0 (2021-03-24) =
678
+ * Added product type field mapping to the Facebook template
679
+ * Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
680
+
681
+ = 9.8.9 (2021-03-22) =
682
+ * Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
683
+
684
+ = 9.8.8 (2021-03-22) =
685
+ * Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
686
+
687
+ = 9.8.7 (2021-03-22) =
688
+ * Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
689
+
690
+ = 9.8.6 (2021-03-19) =
691
+ * Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
692
+
693
+ = 9.8.5 (2021-03-18) =
694
+ * Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
695
+
696
+ = 9.8.4 (2021-03-18) =
697
+ * Added the Idealo.de Germany template, including their Direktkauf fields
698
+
699
+ = 9.8.3 (2021-03-15) =
700
+ * Solved a rounding issue for sale prices including VAT
701
+
702
+ = 9.8.2 (2021-03-15) =
703
+ * Fixed a Facebook Purchase event where only the value of the last product was added to the Facebook pixel instead of the value of all products bought
704
+
705
+ = 9.8.1 (2021-03-13) =
706
+ * The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
707
+
708
+ = 9.8.0 (2021-03-11) =
709
+ * Only reviews that are approved make it to the review feeds, disapproved reviews are removed
710
+
711
+ = 9.7.9 (2021-03-10) =
712
+ * Checked for compatibility with WordPress 5.7
713
+ * Checked for compatibility with WooCommerce 5.1
714
+
715
+ = 9.7.8 (2021-03-10) =
716
+ * Added a boolean check on the review feed creation
717
+
718
+ = 9.7.7 (2021-03-09) =
719
+ * Removed the woosea_add_cart.js from the source as it was an empty file
720
+
721
+ = 9.7.6 (2021-03-08) =
722
+ * Fixed an issue with the Facebook Purchase event that did not track the order value correct
723
+
724
+ = 9.7.5 (2021-03-07) =
725
+ * Another recode of the lowest price variation feature
726
+
727
+ = 9.7.4 (2021-03-05) =
728
+ * Added Bing Shopping Promotions template
729
+
730
+ = 9.7.3 (2021-03-04) =
731
+ * Added a new attribute "Stock Status WooCommerce"
732
+ * Fixed another quote issue with the Facebook pixel
733
+
734
+ = 9.7.2 (2021-03-03) =
735
+ * Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
736
+
737
+ = 9.7.1 (2021-03-03) =
738
+ * Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
739
+
740
+ = 9.7.0 (2021-03-03) =
741
+ * Fixed a bug where lowest priced variations where not making it to feeds
742
+
743
+ = 9.6.9 (2021-02-28) =
744
+ * Added product name parent hyphen attribute
745
+
746
+ = 9.6.8 (2021-02-25) =
747
+ * Added Google category taxonomy mapping for Snapchat feeds
748
+
749
+ = 9.6.7 (2021-02-25) =
750
+ * When suffixes and prefixes are used for the Heureka URL fields spaces are removed
751
+
752
+ = 9.6.6 (2021-02-24) =
753
+ * Added support for PHP 8.0
754
+
755
+ = 9.6.5 (2021-02-24) =
756
+ * Do not add Skroutz variable products to the feed when they do not have item_group_id's
757
+
758
+ = 9.6.4 (2021-02-24) =
759
+ * Fixed an issue with rules and filters
760
+ * When a rule was set on an image link, no longer lowercase the image link
761
+
762
+ = 9.6.3 (2021-02-23) =
763
+ * Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
764
+ * Reverted back some changes in filters and rules
765
+
766
+ = 9.6.2 (2021-02-22) =
767
+ * For Skroutz feed removing sizes from feeds when they are out-of-stock
768
+
769
+ = 9.6.1 (2021-02-19) =
770
+ * Added attribute that will allow you to uppercase every first character of a string in product names
771
+
772
+ = 9.6.0 (2021-02-19) =
773
+ * Changed g:itemid to g:id for the Google Local Product Feeds
774
+
775
+ = 9.5.9 (2021-02-19) =
776
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
777
+
778
+ = 9.5.8 (2021-02-18) =
779
+ * Added shipping class name attribute
780
+
781
+ = 9.5.7 (2021-02-17) =
782
+ * Dynamic attribute values are now also added to parent variable products for Skroutz feeds
783
+
784
+ = 9.5.6 (2021-02-17) =
785
+ * Changed attribute name primary category to Yoast primary category as it caused lots of confussion
786
+
787
+ = 9.5.5 (2021-02-11) =
788
+ * Fixed a PHP notice that showed when creating a new rule
789
+ * Tested for compatibility with WooCommerce 5.0
790
+
791
+ = 9.5.4 (2021-02-09) =
792
+ * When free shipping zones are removed do not remove the other shipping zones
793
+
794
+ = 9.5.3 (2021-02-08) =
795
+ * Added a feature to remove free shipping zones from Google and Facebook feeds
796
+
797
+ = 9.5.2 (2021-02-08) =
798
+ * Fixed a minor issue in exclude rules for WooCommerce category names
799
+
800
+ = 9.5.1 (2021-02-02) =
801
+ * Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
802
+
803
+ = 9.5.0 (2021-02-01) =
804
+ * Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
805
+
806
+ = 9.4.9 (2021-01-31) =
807
+ * Added a seperate sale price attribute for bundled products
808
+ * Reviews for parent variable products are removed, the reviews are attached to its variations
809
+
810
+ = 9.4.8 (2021-01-30) =
811
+ * Fixed an issue with the ecomm_prodid on the cart page
812
+
813
+ = 9.4.7 (2021-01-29) =
814
+ * Solved an issue that shipping costs to the first product in a custom feed where empty
815
+
816
+ = 9.4.6 (2021-01-28) =
817
+ * Added a new attribute: product description parent product
818
+
819
+ = 9.4.5 (2021-01-28) =
820
+ * Added a Google Shopping field to their template: g:ship_from_country
821
+ * Stripping & characters from review names as it breaks the review feeds
822
+
823
+ = 9.4.4 (2021-01-27) =
824
+ * Fixed an issue where reviews without review text caused the feed to be disapproved by Google. We now remove reviews from feeds that have no review texts.
825
+
826
+ = 9.4.3 (2021-01-27) =
827
+ * Fixed an issue with an undefined ecomm_price variable on product variable pages
828
+
829
+ = 9.4.2 (2021-01-26) =
830
+ * Added the Dutch Boetiek.nl template
831
+
832
+ = 9.4.1 (2021-01-19) =
833
+ * Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
834
+
835
+ = 9.4.0 (2021-01-14) =
836
+ * Added a WP-cron check and notifications
837
+
838
+ = 9.3.9 (2021-01-14) =
839
+ * Bestprice.gr apparel products are now grouped by color
840
+
841
+ = 9.3.8 (2021-01-13) =
842
+ * Tested for compatibility with WooCommerce 4.9
843
+
844
  = 9.3.7 (2021-01-12) =
845
  * Added the Bestprice.gr template
846
 
3507
 
3508
  == Upgrade Notice ==
3509
 
3510
+ = 10.9.8 =
3511
+ Replaced usage of site_url with home_url for feed headings
3512
+
3513
+ = 10.9.7 =
3514
+ Added template for Miinto Germany
3515
+
3516
+ = 10.9.6 =
3517
+ Fixed some PHP notices that showed when the Google Dynamic Remarketing feature was enabled but parent variable products returned no price
3518
+
3519
+ = 10.9.5 =
3520
+ Solved an issue where product variations could not be updated
3521
+
3522
+ = 10.9.4 =
3523
+ Removed the graphs from the manage feeds page, will soon be replaced by new ones
3524
+ Replaced a filter_var_array function with a proper Wordpress sanitize function
3525
+
3526
+ = 10.9.3 =
3527
+ Added the System regular price ex. VAT and System sale price ex. VAT attributes
3528
+
3529
+ = 10.9.2 =
3530
+ Updated the out of date Chart.js libraries
3531
+ Removed eval for shipping cost formula's
3532
+ Replaced usage of CURL with Wordpress HTTP API
3533
+ Solved some translation permalink issues
3534
+ Added missing sanitizing to POST and GET requests
3535
+ Added escaping to some variables that are being echo'd
3536
+
3537
+ = 10.9.1 =
3538
+ Added extra authorisation and checks to prevent cross-site scripting abuse
3539
+ Added Guadeloupe (GP), Martinique (MQ), French Guiana (GF) and Reunion (RE) to the list of supported countries
3540
+ Removed CDATA feature as it was not properly functioning
3541
+
3542
+ = 10.9.0 =
3543
+ Added template for TikTok
3544
+
3545
+ = 10.8.9 =
3546
+ Added template for German ElCheapo.de
3547
+
3548
+ = 10.8.8 =
3549
+ Fixed an issue with the Discount Rules for WooCommerce plugin from FlyCart that returned no decimals in round discount prices. The .00 are now also added.
3550
+
3551
+ = 10.8.7 =
3552
+ Added extra image attribute 4 to 9 for Beslist.nl feeds
3553
+
3554
+ = 10.8.6 =
3555
+ Tested for compatibility with WooCommerce 5.9
3556
+
3557
+ = 10.8.5 =
3558
+ Fixed the JSON-lD for the brand details
3559
+
3560
+ = 10.8.4 =
3561
+ Fixed an issue with Skroutz feeds where product sizes that are out of stock are now removed from the size field
3562
+
3563
+ = 10.8.3 =
3564
+ Solved a PHP notice upon activation of plugin
3565
+
3566
+ = 10.8.2 =
3567
+ Solved a PHP notice upon activation of plugin
3568
+
3569
+ = 10.8.1 =
3570
+ Added the "is not empty" operator for filters and rules
3571
+
3572
+ = 10.8.0 =
3573
+ When the product variable is not an object the retrieval of the stock status broke processing of the feed. Build in a check to prevent this from happening.
3574
+
3575
+ = 10.7.9 =
3576
+ Tested for compatibility with WooCommerce 5.8
3577
+
3578
+ = 10.7.8 =
3579
+ Reviews that have no rating or have deeplinks in the review text are now being removed fromn review feeds automatically as they are not allowed by Google
3580
+
3581
+ = 10.7.7 =
3582
+ Added the Region Id attribute for Google Shopping feeds
3583
+
3584
+ = 10.7.5 =
3585
+ Added the Miinto.fr template
3586
+
3587
+ = 10.7.4 =
3588
+ Fixed a division by zero error
3589
+
3590
+ = 10.7.3 =
3591
+ Fixed filters on purchase note array's
3592
+
3593
+ = 10.7.2 =
3594
+ Added support for the WPC Product Bundles for WooCommerce plugin
3595
+
3596
+ = 10.7.1 =
3597
+ Added purchase note attribute
3598
+
3599
+ = 10.7.0 =
3600
+ Made changes to the code to calculate the number of product variations that are on stock as it did not work for some users
3601
+
3602
+ = 10.6.9 =
3603
+ Solved some PHP 8 compatibility issues that caused feeds to get stuck processing
3604
+
3605
+ = 10.6.8 =
3606
+ Solved a Call to undefined method WC_Product_Simple::get_available_variations error
3607
+
3608
+ = 10.6.7 =
3609
+ Made a change to the code so it uses less memory when processing a feed
3610
+
3611
+ = 10.6.6 =
3612
+ Solved an issue where the plugin got stuck when variable products get deleted in WooCommerce during processing of the feed
3613
+
3614
+ = 10.6.5 =
3615
+ Build in an extra check to see if the cron events are active to update feeds. When not this cron event is being created.
3616
+
3617
+ = 10.6.4 =
3618
+ Added capacity attribute to the Google Shopping template
3619
+
3620
+ = 10.6.3 =
3621
+ Added display ads attributes to the Google Shopping template
3622
+
3623
+ = 10.6.2 =
3624
+ Fixed an issue where simple products with variations (which in theory is not possible) caused the feed processing to get stuck
3625
+
3626
+ = 10.6.1 =
3627
+ Solved an undefined array issue when creating a new feed
3628
+
3629
+ = 10.6.0 =
3630
+ Solved an issue with wrong sale prices when WCML was enabled and manual prices were entered
3631
+
3632
+ = 10.5.9 =
3633
+ Somehow simple products got an item_group_id for some users causing a critical error. Added a check on this to fix the error.
3634
+
3635
+ = 10.5.8 =
3636
+ Added a feature to be able to remove products from feeds when only few variations are in stock
3637
+
3638
+ = 10.5.7 =
3639
+ Fixed an issue where Rankmath plugin is installed but no primary category has been set. This resulted in a PHP notice in the logs. This has been solved now.
3640
+
3641
+ = 10.5.6 =
3642
+ Fixed an undefined variable issue for the facebook pixel id
3643
+
3644
+ = 10.5.5 =
3645
+ Fixed a Google Remarketing Pixel issue on the cart page
3646
+
3647
+ = 10.5.4 =
3648
+ Fixed a shipping cost issue where shipping classes that had no shipping costs set where empty
3649
+ Fixed a Google Remarketing pixel, added apostrophe on the AW-XXXXXX parameter
3650
+
3651
+ = 10.5.3 =
3652
+ Solved a bug: when the XML variable was not an object is returned a fatal error. Issue is solved now.
3653
+
3654
+ = 10.5.2 =
3655
+ Tested for compatibility with WooCommerce 5.6
3656
+
3657
+ = 10.5.1 =
3658
+ Fixed an issue where the visibility attribute did not return anything
3659
+
3660
+ = 10.5.0 =
3661
+ Added the Vivino template to the plugin
3662
+
3663
+ = 10.4.9 =
3664
+ Added support for Prisjakt (Sweden, Norway, Finland) feeds. The Google Shopping feed requirements are being used for it as of this release.
3665
+
3666
+ = 10.4.8 =
3667
+ Added support for the Yoast SEO WooCommerce unique identifiers GTIN's, ISBN, MPN so they can be used for feeds.
3668
+
3669
+ = 10.4.7 =
3670
+ Checked for compatibility with WP 5.8
3671
+
3672
+ = 10.4.6 =
3673
+ Reverting back the availability changes for Facebook only
3674
+
3675
+ = 10.4.5 =
3676
+ Google changed its availability requirements (underscores in the availability values), we have adjusted the plugin on this.
3677
+
3678
+ = 10.4.4 =
3679
+ Fixed a product review feed bug where review names with a : in it broke the feed.
3680
+
3681
+ = 10.4.3 =
3682
+ Added the non tax price attribute for WCML
3683
+
3684
+ = 10.4.2 =
3685
+ Fixed a shipping issue where table rates where put on 0 when pickup was available too.
3686
+
3687
+ = 10.4.1 =
3688
+ Implemented Google's new Dynamic Remarketing event pixelcode and added the Purchase and Add To Cart events for it
3689
+
3690
+ = 10.4.0 =
3691
+ Fixed a PHP notice on a foreach loop when a non-array was used for it
3692
+
3693
+ = 10.3.9 =
3694
+ A PHP warning was thrown when a review feed was created while there were no reviews in WooCommerce
3695
+
3696
+ = 10.3.8 =
3697
+ Fixed a bug: When a find and replace rule was created it converted strings to lowercases, this has been fixed.
3698
+
3699
+ = 10.3.7 =
3700
+ Added Facebook Auto / Vehicle fields to the Facebook templating
3701
+
3702
+ = 10.3.6 =
3703
+ Added eventID's to the Facebook pixel and Facebook Conversion API in order to prevent duplicate events being measured
3704
+
3705
+ = 10.3.5 =
3706
+ Fixed a bug: using a rounding price attribute did not work properly when in WooCommerce currency options the decimal or thousand separator was left blank, it always rounded down. This has been fixed.
3707
+
3708
+ = 10.3.4 =
3709
+ Added the quantity_to_sell_on_facebook field to the Facebook template
3710
+
3711
+ = 10.3.3 =
3712
+ Added a 'Link without parameters' attribute (which holds no attribute or UTM parameters in the URL)
3713
+
3714
+ = 10.3.2 =
3715
+ Added some product data attributes to the Google Shopping template: capacity, count, disclosure date, feature description, flavor, format, product line, product pag
3716
+ e url, release date, scent, size system, size type, suggested retail price, theme and video link
3717
+
3718
+ = 10.3.1 =
3719
+ Removed Okazii.ro from the list of supported channels
3720
+
3721
+ = 10.3.0 =
3722
+ Cleaning-up some debug code for the Facebook CAPI implementation
3723
+
3724
+ = 10.2.9 =
3725
+ Added support for the Facebook Conversion API (CAPI) - still in beta!
3726
+ Stripped whitespaces from values in CSV feeds
3727
+
3728
+ = 10.2.8 =
3729
+ Checked for compatibility with WooCommerce 5.4
3730
+
3731
+ = 10.2.7 =
3732
+ Added Adwords grouping, Adwords labels and Adwords redirect fields to the Bing Shopping template
3733
+
3734
+ = 10.2.6 =
3735
+ Added an array check on custom attributes
3736
+
3737
+ = 10.2.5 =
3738
+ When discount plugins are being used prices will be rounded on 2 decimals
3739
+
3740
+ = 10.2.4 =
3741
+ Fixed a CDATA issue
3742
+
3743
+ = 10.2.3 =
3744
+ Added seller name to Google & Bing shopping templates
3745
+
3746
+ = 10.2.2 =
3747
+ Removed an useless nonce
3748
+
3749
+ = 10.2.1 =
3750
+ Added XSS vulnerability checks on both the Google Remarketing pixel and Facebook pixel feature.
3751
+
3752
+ = 10.2.0 =
3753
+ Removed a CSS z-index as it conflicted with Jetpack
3754
+
3755
+ = 10.1.9 =
3756
+ Fixed a PHP notice that showed when users created an empty rule
3757
+
3758
+ = 10.1.8 =
3759
+ When the identifier exists field mapping is removed from the field mapping also remove it from the feed
3760
+ Some minor textual changes in the feed configuration forms
3761
+
3762
+ = 10.1.7 =
3763
+ Fixed a bug: The Facebook pixel addToCart, initiateCheckout and Purchase event does not accept comma's in prices. Fixed.
3764
+
3765
+ = 10.1.6 =
3766
+ Fixed a bug: The Facebook pixel viewContent event does not accept comma's in prices. Fixed.
3767
+
3768
+ = 10.1.5 =
3769
+ Fixed a bug: exclude filters on regular prices did not work
3770
+
3771
+ = 10.1.4 =
3772
+ Adding CDATA feature so CDATA can be added to the title, description and short description fields
3773
+
3774
+ = 10.1.3 =
3775
+ Fixed an issue with taxes being added in the system sale prices
3776
+
3777
+ = 10.1.2 =
3778
+ Added the product type field mapping as default mapping for Google Shopping feeds
3779
+
3780
+ = 10.1.1 =
3781
+ Added support for Mix and Match minimum and maximum prices
3782
+ Removed the item_group_id for Mix and Match products
3783
+
3784
+ = 10.1.0 =
3785
+ Tested for compatibility with WooCommerce 5.3
3786
+ Changed UI when saving new plugin batch size so it shows the correct batch number immediatly
3787
+
3788
+ = 10.0.9 =
3789
+ Added extra fields for Google's local storefront shopping feeds
3790
+
3791
+ = 10.0.8 =
3792
+ Fixed an issue with the image field for custom feeds, it was added as image_link. This has been fixed now.
3793
+
3794
+ = 10.0.7 =
3795
+ Added support for ACF image fields (make sure to use image or bild in your field name)
3796
+
3797
+ = 10.0.6 =
3798
+ Added support for the WooCommerce Shipping & Tax plugin
3799
+
3800
+ = 10.0.5 =
3801
+ Added the "pickup today / merchant hosted local storefront" fields for Google Shopping
3802
+
3803
+ = 10.0.4 =
3804
+ Fixed an issue where shipping costs where missing from feeds
3805
+ Lowest shipping costs did not return the lowest price when prices where not numeric. This has been fixed now.
3806
+
3807
+ = 10.0.3 =
3808
+ When variations are out of stock we remove them from the parent product for Skroutz feeds
3809
+
3810
+ = 10.0.2 =
3811
+ Fixed a bug: rules that where set on attributes that were empty accidently added values to the product data. This has been fixed now.
3812
+
3813
+ = 10.0.1 =
3814
+ Fixed a bug: the multiple standard tax rates are now also taken into account for shipping costs
3815
+
3816
+ = 10.0.0 =
3817
+ Fixed a bug: when multiple standard tax rates for multiple countries where configured the plugin did not pick the correct tax rate when a feed was configured for a country other then the base country. This has been fixed now.
3818
+
3819
+ = 9.9.9 =
3820
+ Added a "force clean-up" feature that in one go removes all feed configurations and scheduled jobs
3821
+
3822
+ = 9.9.8 =
3823
+ Added support for non numeric characters in the AW Dynamic tracking ID
3824
+
3825
+ = 9.9.7 =
3826
+ Fixed helptexts and notifications
3827
+
3828
+ = 9.9.6 =
3829
+ Added support for the Rankmath primary category
3830
+
3831
+ = 9.9.5 =
3832
+ Fixed an issue with the product_url field for Google review feeds. The & charcater was shown as AND. Issue fixed now.
3833
+
3834
+ = 9.9.4 =
3835
+ Added lowest shipping costs attribute
3836
+
3837
+ = 9.9.3 =
3838
+ Removed currency from shipping costs of Heureka feeds
3839
+
3840
+ = 9.9.2 =
3841
+ Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
3842
+
3843
+ = 9.9.1 =
3844
+ Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
3845
+
3846
+ = 9.9.0 =
3847
+ Added product type field mapping to the Facebook template
3848
+ Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
3849
+
3850
+ = 9.8.9 =
3851
+ Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
3852
+
3853
+ = 9.8.8 =
3854
+ Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
3855
+
3856
+ = 9.8.7 =
3857
+ Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
3858
+
3859
+ = 9.8.6 =
3860
+ Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
3861
+
3862
+ = 9.8.5 =
3863
+ Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
3864
+
3865
+ = 9.8.4 =
3866
+ Added the Idealo.de Germany template, including their Direktkauf fields
3867
+
3868
+ = 9.8.3 =
3869
+ Solved a rounding issue for sale prices including VAT
3870
+
3871
+ = 9.8.2 =
3872
+ Fixed a Facebook Purchase event where only the value of the last product was added to the Facebook pixel instead of the value of all products bought
3873
+
3874
+ = 9.8.1 =
3875
+ The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
3876
+
3877
+ = 9.8.0 =
3878
+ Only reviews that are approved make it to the review feeds, disapproved reviews are removed
3879
+
3880
+ = 9.7.9 =
3881
+ Checked for compatibility with WordPress 5.7
3882
+ Checked for compatibility with WooCommerce 5.1.0
3883
+
3884
+ = 9.7.8 =
3885
+ Added a boolean check on the review feed creation
3886
+
3887
+ = 9.7.7 =
3888
+ Removed the woosea_add_cart.js from the source as it was an empty file
3889
+
3890
+ = 9.7.6 =
3891
+ Fixed an issue with the Facebook Purchase event that did not track the order value correct
3892
+
3893
+ = 9.7.5 =
3894
+ Another recode of the lowest price variation feature
3895
+
3896
+ = 9.7.4 =
3897
+ Added Bing Shopping Promotions template
3898
+
3899
+ = 9.7.3 =
3900
+ Added a new attribute "Stock Status WooCommerce"
3901
+ Fixed another quote issue with the Facebook pixel
3902
+
3903
+ = 9.7.2 =
3904
+ Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
3905
+
3906
+ = 9.7.1 =
3907
+ Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
3908
+
3909
+ = 9.7.0 =
3910
+ Fixed a bug where lowest priced variations where not making it to feeds
3911
+
3912
+ = 9.6.9 =
3913
+ Added product name parent hyphen attribute
3914
+
3915
+ = 9.6.8 =
3916
+ Added Google category taxonomy mapping for Snapchat feeds
3917
+
3918
+ = 9.6.7 =
3919
+ When suffixes and prefixes are used for the Heureka URL fields spaces are removed
3920
+
3921
+ = 9.6.6 =
3922
+ Added support for PHP 8.0
3923
+
3924
+ = 9.6.5 =
3925
+ Do not add Skroutz variable products to the feed when they do not have item_group_id's
3926
+
3927
+ = 9.6.4 =
3928
+ Fixed an issue with rules and filters
3929
+ When a rule was set on an image link, no longer lowercase the image link
3930
+
3931
+ = 9.6.3 =
3932
+ Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
3933
+ Reverted back some changes in filters and rules
3934
+
3935
+ = 9.6.2 =
3936
+ For Skroutz feed removing sizes from feeds when they are out-of-stock
3937
+
3938
+ = 9.6.1 =
3939
+ Added attribute that will allow you to uppercase every first character of a string in product names
3940
+
3941
+ = 9.6.0 =
3942
+ Changed g:itemid to g:id for the Google Local Product Feeds
3943
+
3944
+ = 9.5.9 =
3945
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
3946
+
3947
+ = 9.5.8 =
3948
+ Added shipping class name attribute
3949
+
3950
+ = 9.5.7 =
3951
+ Dynamic attribute values are now also added to parent variable products for Skroutz feeds
3952
+
3953
+ = 9.5.6 =
3954
+ Changed attribute name primary category to Yoast primary category as it caused lots of confussion
3955
+
3956
+ = 9.5.5 =
3957
+ Fixed a PHP notice that showed when creating a new rule
3958
+ Tested for compatibility with WooCommerce 5.0
3959
+
3960
+ = 9.5.4 =
3961
+ When free shipping zones are removed do not remove the other shipping zones
3962
+
3963
+ = 9.5.3 =
3964
+ Added a feature to remove free shipping zones from Google and Facebook feeds
3965
+
3966
+ = 9.5.2 =
3967
+ Fixed a minor issue in exclude rules for WooCommerce category names
3968
+
3969
+ = 9.5.1 =
3970
+ Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
3971
+
3972
+ = 9.5.0 =
3973
+ Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
3974
+
3975
+ = 9.4.9 =
3976
+ Added a seperate sale price attribute for bundled products
3977
+ Reviews for parent variable products are removed, the reviews are attached to its variations
3978
+
3979
+ = 9.4.8 =
3980
+ Fixed an issue with the ecomm_prodid on the cart page
3981
+
3982
+ = 9.4.7 =
3983
+ Solved an issue that shipping costs to the first product in a custom feed where empty
3984
+
3985
+ = 9.4.6 =
3986
+ Added a new attribute: product description parent product
3987
+
3988
+ = 9.4.5 =
3989
+ Added a Google Shopping field to their template: g:ship_from_country
3990
+ Stripping & characters from review names as it breaks the review feeds
3991
+
3992
+ = 9.4.4 =
3993
+ Fixed an issue where reviews without review text caused the feed to be disapproved by Google. We now remove reviews from feeds that have no review texts.
3994
+
3995
+ = 9.4.3 =
3996
+ Fixed an issue with an undefined ecomm_price variable on product variable pages
3997
+
3998
+ = 9.4.2 =
3999
+ Added the Dutch Boetiek.nl template
4000
+
4001
+ = 9.4.1 =
4002
+ Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
4003
+
4004
+ = 9.4.0 =
4005
+ Added a WP-cron check and notifications
4006
+
4007
+ = 9.3.9 =
4008
+ Bestprice.gr apparel products are now grouped by color
4009
+
4010
+ = 9.3.8 =
4011
+ Tested for compatibility with WooCommerce 4.9
4012
+
4013
  = 9.3.7 =
4014
  Added the Bestprice.gr template
4015
 
woocommerce-sea.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
- * Version: 9.3.7
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
@@ -11,13 +11,13 @@
11
  * License: GPL3
12
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
  * Requires at least: 4.5
14
- * Tested up to: 5.6
15
  *
16
  * Text Domain: woo-product-feed-pro
17
  * Domain Path: /languages
18
  *
19
  * WC requires at least: 4.4
20
- * WC tested up to: 4.8
21
  *
22
  * Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
23
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
- define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '9.3.7' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
@@ -101,21 +101,13 @@ function woosea_scripts($hook) {
101
  wp_enqueue_script('jquery-ui-datepicker');
102
 
103
  // Only register and enqueue JS scripts from within the plugin itself
104
- if (preg_match("/product-feed-pro/i",$hook)){
105
- // JS files for ChartJS
106
- wp_register_script( 'woosea_chart-bundle-js', plugin_dir_url( __FILE__ ) . 'js/Chart.bundle.js', WOOCOMMERCESEA_PLUGIN_VERSION, true );
107
- wp_enqueue_script( 'woosea_chart-bundle-js' );
108
-
109
- // Minimized JS files for ChartJS
110
- wp_register_script( 'woosea_chart-bundle-min-js', plugin_dir_url( __FILE__ ) . 'js/Chart.bundle.min.js', WOOCOMMERCESEA_PLUGIN_VERSION, true );
111
- wp_enqueue_script( 'woosea_chart-bundle-min-js' );
112
-
113
  // Bootstrap typeahead
114
- wp_register_script( 'typeahead-js', plugin_dir_url( __FILE__ ) . 'js/typeahead.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
115
  wp_enqueue_script( 'typeahead-js' );
116
 
117
  // JS for adding input field validation
118
- wp_register_script( 'woosea_validation-js', plugin_dir_url( __FILE__ ) . 'js/woosea_validation.js?BLAAT=999', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
119
  wp_enqueue_script( 'woosea_validation-js' );
120
 
121
  // JS for autocomplete
@@ -123,7 +115,7 @@ function woosea_scripts($hook) {
123
  wp_enqueue_script( 'woosea_autocomplete-js' );
124
 
125
  // JS for adding table rows to the rules page
126
- wp_register_script( 'woosea_rules-js', plugin_dir_url( __FILE__ ) . 'js/woosea_rules.js?BLAAT=1', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
127
  wp_enqueue_script( 'woosea_rules-js' );
128
 
129
  // JS for adding table rows to the field mappings page
@@ -138,101 +130,32 @@ function woosea_scripts($hook) {
138
  wp_register_script( 'woosea_key-js', plugin_dir_url( __FILE__ ) . 'js/woosea_key.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
139
  wp_enqueue_script( 'woosea_key-js' );
140
 
 
 
 
141
  }
142
  // JS for manage projects page
143
- wp_register_script( 'woosea_manage-js', plugin_dir_url( __FILE__ ) . 'js/woosea_manage.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
144
  wp_enqueue_script( 'woosea_manage-js' );
145
  }
146
  add_action( 'admin_enqueue_scripts' , 'woosea_scripts' );
147
 
148
  /**
149
- * Get product variation ID based on dropdown selects product page
150
  */
151
- function woosea_storedattributes_details(){
152
- //checking the nonce. will die if it is no good.
153
- check_ajax_referer('woosea_ajax_nonce', 'nonce');
154
- if(isset($_POST['data_to_pass'])){
155
- $productId = sanitize_text_field($_POST['data_to_pass']);
156
-
157
- // Remove previous drop-down selection
158
- delete_option( 'selected_values' );
159
-
160
- // Good idea to make sure things are set before using them
161
- $selected_values = isset( $_POST['storedAttributes'] ) ? (array) $_POST['storedAttributes'] : array();
162
-
163
- // Any of the WordPress data sanitization functions can be used here
164
- $selected_values = array_map( 'esc_attr', $selected_values );
165
-
166
- // Save drop-down selection
167
- update_option( 'selected_values', $selected_values);
168
- }
169
  }
170
- add_action( 'wp_ajax_nopriv_woosea_storedattributes_details', 'woosea_storedattributes_details' );
171
- add_action( 'wp_ajax_woosea_storedattributes_details', 'woosea_storedattributes_details' );
172
-
173
- /**
174
- * Get details to load in the Facebook AddToCart event (pixel)
175
- */
176
- function woosea_addtocart_details(){
177
- //checking the nonce. will die if it is no good.
178
- check_ajax_referer('woosea_ajax_nonce', 'nonce');
179
- $productId = sanitize_text_field($_POST['data_to_pass']);
180
- $variationId = 0;
181
-
182
- if(!empty ($productId) ){
183
- $product = wc_get_product( $productId );
184
- $selected_values = get_option('selected_values');
185
- unset($selected_values['productId']);
186
- $_GET = $selected_values;
187
- $variation_id = woosea_find_matching_product_variation( $product, $_GET );
188
- if($variation_id > 0){
189
- $productId = $variation_id;
190
- }
191
- $nr_get = count($_GET);
192
- $product_name = $product->get_name();
193
- $product_type = $product->get_type();
194
- $product_price = $product->get_price();
195
- $product_regular_price = $product->get_regular_price();
196
- $product_sale_price = $product->get_sale_price();
197
- $product_sku = $product->get_sku();
198
- $currency = get_woocommerce_currency();
199
-
200
- $cats = "";
201
- $all_cats = get_the_terms( $productId, 'product_cat' );
202
- if(!empty($all_cats)){
203
- foreach ($all_cats as $key => $category) {
204
- $cats .= $category->name.",";
205
- }
206
- }
207
-
208
- // strip last comma
209
- $cats = rtrim($cats, ",");
210
- $cats = str_replace("&amp;","&", $cats);
211
-
212
- $data = array (
213
- 'product_id' => $productId,
214
- 'product_name' => $product_name,
215
- 'product_type' => $product_type,
216
- 'product_price' => $product_price,
217
- 'product_regular_price' => $product_regular_price,
218
- 'product_sale_price' => $product_sale_price,
219
- 'product_sku' => $product_sku,
220
- 'product_currency' => $currency,
221
- 'product_cats' => $cats
222
- );
223
-
224
- echo json_encode($data);
225
- wp_die();
226
- }
227
- }
228
- add_action( 'wp_ajax_nopriv_woosea_addtocart_details', 'woosea_addtocart_details' );
229
- add_action( 'wp_ajax_woosea_addtocart_details', 'woosea_addtocart_details' );
230
 
231
  /**
232
  * Internationalisation of plugin
233
  */
234
  function woosea_load_plugin_textdomain() {
235
- load_plugin_textdomain( 'woosea', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
236
  }
237
  add_action( 'plugins_loaded', 'woosea_load_plugin_textdomain' );
238
 
@@ -279,7 +202,7 @@ add_filter('plugin_action_links', 'woosea_plugin_action_links', 10, 2);
279
  /**
280
  * Get category path for Facebook pixel
281
  */
282
- function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxonomy, $nicename = false, $visited = array() ) {
283
  // Only add Home to the beginning of the chain when we start buildin the chain
284
  if(empty($visited)){
285
  $chain = 'Home';
@@ -302,7 +225,7 @@ function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxono
302
 
303
  if ($parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited, TRUE )){
304
  $visited[] = $parent->parent;
305
- $chain .= woosea_get_term_parents( $parent->parent, $taxonomy, $link, $separator, $nicename, $visited );
306
  }
307
 
308
  if ($link){
@@ -314,27 +237,49 @@ function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxono
314
  return $chain;
315
  }
316
 
317
-
318
  /**
319
  * Add Facebook pixel
320
  */
321
  function woosea_add_facebook_pixel( $product = null ){
322
- if ( ! is_object( $product ) ) {
323
  global $product;
324
  }
325
  $fb_pagetype = WooSEA_Google_Remarketing::woosea_google_remarketing_pagetype();
326
  $add_facebook_pixel = get_option ('add_facebook_pixel');
 
 
 
327
  $currency = get_woocommerce_currency();
328
-
329
  if($add_facebook_pixel == "yes"){
330
  $facebook_pixel_id = get_option("woosea_facebook_pixel_id");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
 
332
- if($facebook_pixel_id > 0){
333
  if ($fb_pagetype == "product"){
334
  if ( '' !== $product->get_price()) {
335
 
336
  $fb_prodid = get_the_id();
337
  $product_name = $product->get_name();
 
 
 
338
  $cats = "";
339
  $all_cats = get_the_terms( $fb_prodid, 'product_cat' );
340
  if(!empty($all_cats)){
@@ -345,9 +290,10 @@ function woosea_add_facebook_pixel( $product = null ){
345
  // strip last comma
346
  $cats = rtrim($cats, ",");
347
  $cats = str_replace("&amp;","&", $cats);
 
 
348
 
349
  if(!empty($fb_prodid)){
350
-
351
  if(!$product) {
352
  return -1;
353
  }
@@ -356,7 +302,7 @@ function woosea_add_facebook_pixel( $product = null ){
356
  // We should first check if there are any _GET parameters available
357
  // When there are not we are on a variable product page but not on a specific variable one
358
  // In that case we need to put in the AggregateOffer structured data
359
- $variation_id = woosea_find_matching_product_variation( $product, $_GET );
360
 
361
  $nr_get = count($_GET);
362
 
@@ -384,7 +330,17 @@ function woosea_add_facebook_pixel( $product = null ){
384
  $fb_price = $fb_lowprice;
385
  }
386
  }
387
- $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
 
 
 
 
 
 
 
 
 
 
388
  } else {
389
  // This is a parent variable product
390
  // Since these are not allowed in the feed, at the variations product ID's
@@ -415,12 +371,32 @@ function woosea_add_facebook_pixel( $product = null ){
415
  $fb_highprice = wc_format_localized_price( $highest );
416
  $fb_price = $fb_lowprice;
417
  }
418
- $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product_group\", content_ids:[$content], value:\"$fb_price\", currency:\"$currency\"});";
 
 
 
 
 
 
 
 
 
 
419
  }
420
  } else {
421
  // This is a simple product page
422
- $fb_price = wc_format_localized_price( $product->get_price() );
423
- $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
 
 
 
 
 
 
 
 
 
 
424
  }
425
  }
426
  }
@@ -433,8 +409,8 @@ function woosea_add_facebook_pixel( $product = null ){
433
  $order = wc_get_order( $order_id );
434
  $order_items = $order->get_items();
435
  $currency = get_woocommerce_currency();
436
- $order_real = 0;
437
  $contents = "";
 
438
 
439
  if ( !is_wp_error( $order_items )) {
440
  foreach( $order_items as $item_id => $order_item) {
@@ -443,26 +419,33 @@ function woosea_add_facebook_pixel( $product = null ){
443
  if($variation_id > 0){
444
  $prod_id = $variation_id;
445
  }
446
-
447
  $prod_quantity = $order_item->get_quantity();
448
- $order_real = wc_format_localized_price( $order_item->get_total() );
449
-
450
- // $order_subtotal = number_format(($order_item->get_subtotal()),2, '.', '');
451
- // $order_subtotal_tax= number_format(($order_item->get_subtotal_tax()),2, '.', '');
452
- // $order_real = number_format(($order_subtotal+$order_subtotal_tax+$order_real),2,',','');
453
  $contents .= "{'id': '$prod_id', 'quantity': $prod_quantity},";
454
  }
455
  }
456
  $contents = rtrim($contents, ",");
457
- $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$order_real', content_type:'product', contents:[$contents]});";
 
 
 
 
 
 
 
 
458
  }
459
  } else {
460
  // This is on the cart page itself
461
  $currency = get_woocommerce_currency();
462
  $cart_items = WC()->cart->get_cart();
 
 
463
  $cart_real = 0;
464
  $contents = "";
465
 
 
 
 
466
  $checkoutpage = wc_get_checkout_url();
467
  $current_url = get_permalink(get_the_ID());
468
 
@@ -470,6 +453,8 @@ function woosea_add_facebook_pixel( $product = null ){
470
  if( !is_wp_error( $cart_items )) {
471
  foreach( $cart_items as $cart_id => $cart_item) {
472
  $prod_id = $cart_item['product_id'];
 
 
473
  if($cart_item['variation_id'] > 0){
474
  $prod_id = $cart_item['variation_id'];
475
  }
@@ -477,20 +462,31 @@ function woosea_add_facebook_pixel( $product = null ){
477
  //$contents .= "$prod_id,";
478
 
479
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
480
-
481
- // $line_total = number_format(($cart_item['line_total']),2, '.','');
482
- // $line_tax = number_format(($cart_item['line_tax']),2, '.','');
483
- // $cart_real = number_format($cart_real,2, '.','');
484
- // $cart_real = number_format(($line_total+$line_tax+$cart_real),2,',','');
485
  }
486
  $contents = rtrim($contents, ",");
487
 
488
  // User is on the billing pages
489
  if($checkoutpage == $current_url){
490
- $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_real\", content_type:\"product\", content_ids:[$contents]});";
 
 
 
 
 
 
 
 
491
  } else {
492
  // User is on the basket page
493
- $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_real\", content_type:\"product\", content_ids:[$contents]});";
 
 
 
 
 
 
 
 
494
  }
495
  }
496
  }
@@ -523,8 +519,14 @@ function woosea_add_facebook_pixel( $product = null ){
523
  }
524
  $fb_prodid = rtrim($fb_prodid, ",");
525
  $category_name = $term->name;
526
- $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $link = false, $project_taxonomy = false, $nicename = false, $visited = array() );
527
- $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:\"$category_path\", content_name:\"$category_name\", content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
 
 
 
 
 
 
528
  } elseif ($fb_pagetype == "searchresults"){
529
  $term = get_queried_object();
530
  $search_string = sanitize_text_field($_GET['s']);
@@ -553,9 +555,15 @@ function woosea_add_facebook_pixel( $product = null ){
553
  }
554
  }
555
  $fb_prodid = rtrim($fb_prodid, ",");
556
- $viewContent = "fbq(\"trackCustom\",\"Search\",{search_string:\"$search_string\", content_type:\"product\", content_ids:\"[\"$fb_prodid\"]\"});";
 
 
 
 
 
557
  } else {
558
  // This is another page than a product page
 
559
  $viewContent = "";
560
  }
561
  ?>
@@ -574,7 +582,8 @@ function woosea_add_facebook_pixel( $product = null ){
574
  t.src=v;s=b.getElementsByTagName(e)[0];
575
  s.parentNode.insertBefore(t,s)}(window, document,'script',
576
  'https://connect.facebook.net/en_US/fbevents.js');
577
- fbq("init", "<?php print"$facebook_pixel_id";?>");
 
578
  fbq("track", "PageView");
579
  <?php
580
  if(strlen($viewContent) > 2){
@@ -583,10 +592,37 @@ function woosea_add_facebook_pixel( $product = null ){
583
  ?>
584
  </script>
585
  <noscript>
586
- <img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=<?php print"$facebook_pixel_id";?>&ev=PageView&noscript=1"/>
587
  </noscript>
588
  <!-- End Facebook Pixel Code -->
589
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  }
591
  }
592
  }
@@ -601,11 +637,26 @@ function woosea_add_remarketing_tags( $product = null ){
601
  }
602
  $ecomm_pagetype = WooSEA_Google_Remarketing::woosea_google_remarketing_pagetype();
603
  $add_remarketing = get_option ('add_remarketing');
604
-
605
  if($add_remarketing == "yes"){
606
  $adwords_conversion_id = get_option("woosea_adwords_conversion_id");
 
 
 
 
607
 
608
  if($adwords_conversion_id > 0){
 
 
 
 
 
 
 
 
 
 
 
609
  if ($ecomm_pagetype == "product"){
610
  if ( '' !== $product->get_price()) {
611
  $ecomm_prodid = get_the_id();
@@ -620,9 +671,9 @@ function woosea_add_remarketing_tags( $product = null ){
620
  // We should first check if there are any _GET parameters available
621
  // When there are not we are on a variable product page but not on a specific variable one
622
  // In that case we need to put in the AggregateOffer structured data
623
- $variation_id = woosea_find_matching_product_variation( $product, $_GET );
624
  $nr_get = count($_GET);
625
-
626
  if($nr_get > 0){
627
  $variable_product = wc_get_product($variation_id);
628
 
@@ -659,66 +710,95 @@ function woosea_add_remarketing_tags( $product = null ){
659
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
660
  } else {
661
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
662
- $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
 
 
663
  }
664
  }
665
  } else {
666
  $ecomm_price = wc_format_decimal( $product->get_price(), wc_get_price_decimals() );
667
  }
668
  }
669
- ?>
670
- <script type="text/javascript">
671
- var google_tag_params = {
672
- ecomm_prodid: <?php print "$ecomm_prodid";?>,
673
- ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
674
- ecomm_totalvalue: '<?php print "$ecomm_price";?>',
675
- };
676
- </script>
677
-
678
- <?php
 
 
 
 
679
  }
680
  } elseif ($ecomm_pagetype == "cart"){
681
- $ecomm_prodid = get_the_id();
682
- ?>
683
- <script type="text/javascript">
684
- var google_tag_params = {
685
- ecomm_prodid: '<?php print "$ecomm_prodid";?>',
686
- ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
687
- };
688
- </script>
689
- <?php
690
- } else {
691
- // This is another page than a product page
692
- ?>
693
- <script type="text/javascript">
694
- var google_tag_params = {
695
- ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
696
- };
697
- </script>
698
- <?php
699
- }
700
- ?>
701
- <!-- Google-code – remarketing tag added by AdTribes.io -->
702
- <!--------------------------------------------------
703
- You need to make sure that the ecomm_prodid parameter, which we fill with your
704
- WooCommerce product Id matches the g:id field for your Google Merchant Center feed.
705
- --------------------------------------------------->
706
- <script type="text/javascript">
707
- /* <![CDATA[ */
708
- var google_conversion_id = <?php print "$adwords_conversion_id";?>;
709
- var google_custom_params = window.google_tag_params;
710
- var google_remarketing_only = true;
711
- /* ]]> */
712
- </script>
713
- <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
714
- </script>
715
- <noscript>
716
- <div style="display:inline;">
717
- <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/<?php print "$adwords_conversion_id";?>/?guid=ON&amp;script=0"/>
718
- </div>
719
- </noscript>
720
- <!-- End Google Remarketing Pixel Code -->
721
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
  }
723
  }
724
  }
@@ -804,6 +884,7 @@ function woosea_request_review(){
804
  }
805
  add_action('admin_notices', 'woosea_request_review');
806
 
 
807
  /**
808
  * Create a seperate MySql table for saving conversion information
809
  */
@@ -876,6 +957,7 @@ function woosea_menu_addition(){
876
  * Gets all attributes, product, image and attributes
877
  */
878
  function woosea_ajax() {
 
879
  $rowCount = sanitize_text_field($_POST['rowCount']);
880
 
881
  $attributes_dropdown = get_option('attributes_dropdown');
@@ -928,11 +1010,35 @@ function woosea_categories_dropdown() {
928
  }
929
  add_action( 'wp_ajax_woosea_categories_dropdown', 'woosea_categories_dropdown' );
930
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
931
  /**
932
  * Save Google Dynamic Remarketing Conversion Tracking ID
933
  */
934
  function woosea_save_adwords_conversion_id() {
 
935
  $adwords_conversion_id = sanitize_text_field($_POST['adwords_conversion_id']);
 
936
  update_option("woosea_adwords_conversion_id", $adwords_conversion_id);
937
  }
938
  add_action( 'wp_ajax_woosea_save_adwords_conversion_id', 'woosea_save_adwords_conversion_id' );
@@ -941,6 +1047,7 @@ add_action( 'wp_ajax_woosea_save_adwords_conversion_id', 'woosea_save_adwords_co
941
  * Save batch size
942
  */
943
  function woosea_save_batch_size() {
 
944
  $batch_size = sanitize_text_field($_POST['batch_size']);
945
  update_option("woosea_batch_size", $batch_size);
946
  }
@@ -950,18 +1057,32 @@ add_action( 'wp_ajax_woosea_save_batch_size', 'woosea_save_batch_size' );
950
  * Save Facebook Pixel ID
951
  */
952
  function woosea_save_facebook_pixel_id() {
 
953
  $facebook_pixel_id = sanitize_text_field($_POST['facebook_pixel_id']);
 
954
  update_option("woosea_facebook_pixel_id", $facebook_pixel_id);
955
  }
956
  add_action( 'wp_ajax_woosea_save_facebook_pixel_id', 'woosea_save_facebook_pixel_id' );
957
 
 
 
 
 
 
 
 
 
 
 
 
958
  /**
959
  * Mass map categories to the correct Google Shopping category taxonomy
960
  */
961
  function woosea_add_mass_cat_mapping(){
 
962
  $project_hash = sanitize_text_field($_POST['project_hash']);
963
- $catMappings = $_POST['catMappings'];
964
-
965
  // I need to sanitize the catMappings Array
966
  $mappings = array();
967
  foreach ($catMappings as $mKey => $mVal){
@@ -1016,9 +1137,9 @@ function woosea_add_cat_mapping() {
1016
  $className = sanitize_text_field($_POST['className']);
1017
  $map_to_category = sanitize_text_field($_POST['map_to_category']);
1018
  $project_hash = sanitize_text_field($_POST['project_hash']);
1019
- //$criteria = sanitize_text_field($_POST['criteria']);
1020
 
1021
- $criteria = $_POST['criteria'];
1022
  $status_mapping = "false";
1023
  $project = WooSEA_Update_Project::get_project_data(sanitize_text_field($project_hash));
1024
 
@@ -1060,22 +1181,24 @@ add_action( 'wp_ajax_woosea_add_cat_mapping', 'woosea_add_cat_mapping' );
1060
  * Retrieve variation product id based on it attributes
1061
  **/
1062
  function woosea_find_matching_product_variation( $product, $attributes ) {
1063
-
1064
- foreach( $attributes as $key => $value ) {
1065
- if( strpos( $key, 'attribute_' ) === 0 ) {
1066
- continue;
1067
- }
1068
- unset( $attributes[ $key ] );
1069
- $attributes[ sprintf( 'attribute_%s', $key ) ] = $value;
1070
- }
1071
 
1072
- if( class_exists('WC_Data_Store') ) {
1073
- $data_store = WC_Data_Store::load( 'product' );
1074
- return $data_store->find_matching_product_variation( $product, $attributes );
1075
- } else {
1076
- return $product->get_matching_variation( $attributes );
1077
- }
1078
- }
 
 
 
 
 
 
 
 
 
 
1079
 
1080
  /**
1081
  * Remove the price from the JSON-LD on variant product pages
@@ -1083,7 +1206,6 @@ function woosea_find_matching_product_variation( $product, $attributes ) {
1083
  * to disapproved in Google's Merchant center because of it
1084
  */
1085
  function woosea_product_delete_meta_price( $product = null ) {
1086
-
1087
  $markup_offer = array();
1088
  $structured_data_fix = get_option ('structured_data_fix');
1089
 
@@ -1143,14 +1265,13 @@ function woosea_product_delete_meta_price( $product = null ) {
1143
  $nr_get = count($_GET);
1144
 
1145
  if($nr_get > 0){
1146
- //$variation_id = woosea_find_matching_product_variation( $product, $_GET );
1147
  $mother_id = wc_get_product()->get_id();
1148
  $children_ids = $product->get_children();
1149
 
1150
  foreach ($children_ids as &$child_val) {
1151
  $product_variations = new WC_Product_Variation( $child_val );
1152
  $variations = array_filter($product_variations->get_variation_attributes());
1153
- $from_url = str_replace("\\","",$_GET,$i);
1154
  $intersect = array_intersect($from_url, $variations);
1155
  if($variations == $intersect){
1156
  $variation_id = $child_val;
@@ -1488,8 +1609,8 @@ function woosea_product_fix_structured_data( $product = null ) {
1488
  foreach ($children_ids as &$child_val) {
1489
  $product_variations = new WC_Product_Variation( $child_val );
1490
  $variations = array_filter($product_variations->get_variation_attributes());
1491
- $from_url = str_replace("\\","",$_GET,$i);
1492
- $intersect = array_intersect($from_url, $variations);
1493
  if($variations == $intersect){
1494
  $variation_id = $child_val;
1495
  }
@@ -1519,7 +1640,7 @@ function woosea_product_fix_structured_data( $product = null ) {
1519
  $brand = get_post_meta( $variation_id, '_woosea_brand', true );
1520
  if ( $brand ) {
1521
  $markup['brand'] = array (
1522
- '@type' => 'Thing',
1523
  'name' => $brand,
1524
  );
1525
  }
@@ -1622,7 +1743,7 @@ function woosea_product_fix_structured_data( $product = null ) {
1622
 
1623
  if ( $brand ) {
1624
  $markup['brand'] = array (
1625
- '@type' => 'Thing',
1626
  'name' => $brand,
1627
  );
1628
  }
@@ -2071,6 +2192,8 @@ add_action( 'wp_ajax_woosea_project_refresh', 'woosea_project_refresh' );
2071
  * Add or remove custom attributes to the feed configuration drop-downs
2072
  */
2073
  function woosea_add_attributes() {
 
 
2074
  $attribute_name = sanitize_text_field($_POST['attribute_name']);
2075
  $attribute_value = sanitize_text_field($_POST['attribute_value']);
2076
  $active = sanitize_text_field($_POST['active']);
@@ -2285,6 +2408,21 @@ function woosea_local_pickup_shipping (){
2285
  }
2286
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2288
  /**
2289
  * This function enables the setting to use
2290
  * logging
@@ -2301,20 +2439,59 @@ function woosea_add_woosea_logging (){
2301
  add_action( 'wp_ajax_woosea_add_woosea_logging', 'woosea_add_woosea_logging' );
2302
 
2303
  /**
2304
- * This function enables the setting to add
2305
- * the Faceook pixel
2306
  */
2307
- function woosea_add_facebook_pixel_setting (){
2308
  $status = sanitize_text_field($_POST['status']);
2309
 
2310
  if ($status == "off"){
2311
- update_option( 'add_facebook_pixel', 'no', 'yes');
2312
  } else {
2313
- update_option( 'add_facebook_pixel', 'yes', 'yes');
2314
  }
2315
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2316
  add_action( 'wp_ajax_woosea_add_facebook_pixel_setting', 'woosea_add_facebook_pixel_setting' );
2317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2318
  /**
2319
  * This function saves the value that needs to be used in the Facebook pixel content_ids parameter
2320
  */
@@ -2334,13 +2511,18 @@ add_action( 'wp_ajax_woosea_facebook_content_ids', 'woosea_facebook_content_ids'
2334
  * Google's Dynamic Remarketing
2335
  */
2336
  function woosea_add_remarketing (){
2337
- $status = sanitize_text_field($_POST['status']);
2338
-
2339
- if ($status == "off"){
2340
- update_option( 'add_remarketing', 'no', 'yes');
2341
- } else {
2342
- update_option( 'add_remarketing', 'yes', 'yes');
2343
- }
 
 
 
 
 
2344
  }
2345
  add_action( 'wp_ajax_woosea_add_remarketing', 'woosea_add_remarketing' );
2346
 
@@ -2351,10 +2533,14 @@ add_action( 'wp_ajax_woosea_add_remarketing', 'woosea_add_remarketing' );
2351
  function woosea_add_batch (){
2352
  $status = sanitize_text_field($_POST['status']);
2353
 
2354
- if ($status == "off"){
2355
- update_option( 'add_batch', 'no', 'yes');
2356
- } else {
2357
- update_option( 'add_batch', 'yes', 'yes');
 
 
 
 
2358
  }
2359
  }
2360
  add_action( 'wp_ajax_woosea_add_batch', 'woosea_add_batch' );
@@ -2393,10 +2579,10 @@ function woosea_custom_general_fields() {
2393
  woocommerce_wp_text_input(
2394
  array(
2395
  'id' => '_woosea_brand',
2396
- 'label' => __( 'Brand', 'woosea' ),
2397
  'desc_tip' => 'true',
2398
  'value' => get_post_meta( $post->ID, '_woosea_brand', true ),
2399
- 'description' => __( 'Enter the product Brand here.', 'woosea' )
2400
  )
2401
  );
2402
  }
@@ -2409,9 +2595,9 @@ function woosea_custom_general_fields() {
2409
  woocommerce_wp_text_input(
2410
  array(
2411
  'id' => '_woosea_gtin',
2412
- 'label' => __( 'GTIN', 'woosea' ),
2413
  'desc_tip' => 'true',
2414
- 'description' => __( 'Enter the product Global Trade Item Number (GTIN) here.', 'woosea' ),
2415
  )
2416
  );
2417
  }
@@ -2421,9 +2607,9 @@ function woosea_custom_general_fields() {
2421
  woocommerce_wp_text_input(
2422
  array(
2423
  'id' => '_woosea_mpn',
2424
- 'label' => __( 'MPN', 'woosea' ),
2425
  'desc_tip' => 'true',
2426
- 'description' => __( 'Enter the manufacturer product number', 'woosea' ),
2427
  )
2428
  );
2429
  }
@@ -2433,9 +2619,9 @@ function woosea_custom_general_fields() {
2433
  woocommerce_wp_text_input(
2434
  array(
2435
  'id' => '_woosea_upc',
2436
- 'label' => __( 'UPC', 'woosea' ),
2437
  'desc_tip' => 'true',
2438
- 'description' => __( 'Enter the Universal Product Code (UPC) here.', 'woosea' ),
2439
  )
2440
  );
2441
  }
@@ -2445,9 +2631,9 @@ function woosea_custom_general_fields() {
2445
  woocommerce_wp_text_input(
2446
  array(
2447
  'id' => '_woosea_ean',
2448
- 'label' => __( 'EAN', 'woosea' ),
2449
  'desc_tip' => 'true',
2450
- 'description' => __( 'Enter the International Article Number (EAN) here.', 'woosea' ),
2451
  )
2452
  );
2453
  }
@@ -2457,9 +2643,9 @@ function woosea_custom_general_fields() {
2457
  woocommerce_wp_text_input(
2458
  array(
2459
  'id' => '_woosea_optimized_title',
2460
- 'label' => __( 'Optimized title', 'woosea' ),
2461
  'desc_tip' => 'true',
2462
- 'description' => __( 'Enter a optimized product title.', 'woosea' ),
2463
  )
2464
  );
2465
  }
@@ -2469,15 +2655,15 @@ function woosea_custom_general_fields() {
2469
  woocommerce_wp_select(
2470
  array(
2471
  'id' => '_woosea_condition',
2472
- 'label' => __( 'Product condition', 'woosea' ),
2473
  'desc_tip' => 'true',
2474
- 'description' => __( 'Select the product condition.', 'woosea' ),
2475
  'options' => array (
2476
- '' => __( '', 'woosea' ),
2477
- 'new' => __( 'new', 'woosea' ),
2478
- 'refurbished' => __( 'refurbished', 'woosea' ),
2479
- 'used' => __( 'used', 'woosea' ),
2480
- 'damaged' => __( 'damaged', 'woosea' ),
2481
  )
2482
  )
2483
  );
@@ -2488,9 +2674,9 @@ function woosea_custom_general_fields() {
2488
  woocommerce_wp_text_input(
2489
  array(
2490
  'id' => '_woosea_color',
2491
- 'label' => __( 'Color', 'woosea' ),
2492
  'desc_tip' => 'true',
2493
- 'description' => __( 'Insert a color.', 'woosea' ),
2494
  )
2495
  );
2496
  }
@@ -2500,9 +2686,9 @@ function woosea_custom_general_fields() {
2500
  woocommerce_wp_text_input(
2501
  array(
2502
  'id' => '_woosea_size',
2503
- 'label' => __( 'Size', 'woosea' ),
2504
  'desc_tip' => 'true',
2505
- 'description' => __( 'Insert a size.', 'woosea' ),
2506
  )
2507
  );
2508
  }
@@ -2512,14 +2698,14 @@ function woosea_custom_general_fields() {
2512
  woocommerce_wp_select(
2513
  array(
2514
  'id' => '_woosea_gender',
2515
- 'label' => __( 'Gender', 'woosea' ),
2516
  'desc_tip' => 'true',
2517
- 'description' => __( 'Select gender.', 'woosea' ),
2518
  'options' => array (
2519
- '' => __( '', 'woosea' ),
2520
- 'female' => __( 'female', 'woosea' ),
2521
- 'male' => __( 'male', 'woosea' ),
2522
- 'unisex' => __( 'unisex', 'woosea' ),
2523
  )
2524
  )
2525
  );
@@ -2530,9 +2716,9 @@ function woosea_custom_general_fields() {
2530
  woocommerce_wp_text_input(
2531
  array(
2532
  'id' => '_woosea_material',
2533
- 'label' => __( 'Material', 'woosea' ),
2534
  'desc_tip' => 'true',
2535
- 'description' => __( 'Enter a material.', 'woosea' ),
2536
  )
2537
  );
2538
  }
@@ -2542,9 +2728,9 @@ function woosea_custom_general_fields() {
2542
  woocommerce_wp_text_input(
2543
  array(
2544
  'id' => '_woosea_pattern',
2545
- 'label' => __( 'Pattern', 'woosea' ),
2546
  'desc_tip' => 'true',
2547
- 'description' => __( 'Enter a pattern.', 'woosea' ),
2548
  )
2549
  );
2550
  }
@@ -2554,16 +2740,16 @@ function woosea_custom_general_fields() {
2554
  woocommerce_wp_select(
2555
  array(
2556
  'id' => '_woosea_age_group',
2557
- 'label' => __( 'Age group', 'woosea' ),
2558
  'desc_tip' => 'true',
2559
- 'description' => __( 'Select the product age group.', 'woosea' ),
2560
  'options' => array (
2561
- '' => __( '', 'woosea' ),
2562
- 'newborn' => __( 'newborn', 'woosea' ),
2563
- 'infant' => __( 'infant', 'woosea' ),
2564
- 'toddler' => __( 'toddler', 'woosea' ),
2565
- 'kids' => __( 'kids', 'woosea' ),
2566
- 'adult' => __( 'adult', 'woosea' ),
2567
  )
2568
  )
2569
  );
@@ -2574,9 +2760,9 @@ function woosea_custom_general_fields() {
2574
  woocommerce_wp_text_input(
2575
  array(
2576
  'id' => '_woosea_unit_pricing_measure',
2577
- 'label' => __( 'Unit pricing measure', 'woosea' ),
2578
  'desc_tip' => 'true',
2579
- 'description' => __( 'Enter an unit pricing measure.', 'woosea' ),
2580
  )
2581
  );
2582
  }
@@ -2586,9 +2772,9 @@ function woosea_custom_general_fields() {
2586
  woocommerce_wp_text_input(
2587
  array(
2588
  'id' => '_woosea_unit_pricing_base_measure',
2589
- 'label' => __( 'Unit pricing base measure', 'woosea' ),
2590
  'desc_tip' => 'true',
2591
- 'description' => __( 'Enter an unit pricing base measure.', 'woosea' ),
2592
  )
2593
  );
2594
  }
@@ -2598,9 +2784,9 @@ function woosea_custom_general_fields() {
2598
  woocommerce_wp_text_input(
2599
  array(
2600
  'id' => '_woosea_installment_months',
2601
- 'label' => __( 'Installment months', 'woosea' ),
2602
  'desc_tip' => 'true',
2603
- 'description' => __( 'Enter the number of monthly installments the buyer has to pay.', 'woosea' ),
2604
  )
2605
  );
2606
  }
@@ -2610,9 +2796,9 @@ function woosea_custom_general_fields() {
2610
  woocommerce_wp_text_input(
2611
  array(
2612
  'id' => '_woosea_installment_amount',
2613
- 'label' => __( 'Installment amount', 'woosea' ),
2614
  'desc_tip' => 'true',
2615
- 'description' => __( 'Enter the amount the bbuyer has to pay per month.', 'woosea' ),
2616
  )
2617
  );
2618
  }
@@ -2622,9 +2808,9 @@ function woosea_custom_general_fields() {
2622
  woocommerce_wp_text_input(
2623
  array(
2624
  'id' => '_woosea_cost_of_good_sold',
2625
- 'label' => __( 'Cost of goods sold', 'woosea' ),
2626
  'desc_tip' => 'true',
2627
- 'description' => __( 'Enter the cost of good you are selling.', 'woosea' ),
2628
  )
2629
  );
2630
  }
@@ -2634,9 +2820,9 @@ function woosea_custom_general_fields() {
2634
  woocommerce_wp_text_input(
2635
  array(
2636
  'id' => '_woosea_multipack',
2637
- 'label' => __( 'Multipack', 'woosea' ),
2638
  'desc_tip' => 'true',
2639
- 'description' => __( 'Enter the multipack amount.', 'woosea' ),
2640
  )
2641
  );
2642
  }
@@ -2646,13 +2832,13 @@ function woosea_custom_general_fields() {
2646
  woocommerce_wp_select(
2647
  array(
2648
  'id' => '_woosea_is_bundle',
2649
- 'label' => __( 'Is bundle', 'woosea' ),
2650
  'desc_tip' => 'true',
2651
- 'description' => __( 'Select the is bundle value.', 'woosea' ),
2652
  'options' => array (
2653
- '' => __( '', 'woosea' ),
2654
- 'yes' => __( 'yes', 'woosea' ),
2655
- 'no' => __( 'no', 'woosea' ),
2656
  )
2657
  )
2658
  );
@@ -2663,21 +2849,21 @@ function woosea_custom_general_fields() {
2663
  woocommerce_wp_select(
2664
  array(
2665
  'id' => '_woosea_energy_efficiency_class',
2666
- 'label' => __( 'Energy efficiency class', 'woosea' ),
2667
  'desc_tip' => 'true',
2668
- 'description' => __( 'Select the product energy efficiency class.', 'woosea' ),
2669
  'options' => array (
2670
- '' => __( '', 'woosea' ),
2671
- 'A+++' => __( 'A+++', 'woosea' ),
2672
- 'A++' => __( 'A++', 'woosea' ),
2673
- 'A+' => __( 'A+', 'woosea' ),
2674
- 'A' => __( 'A', 'woosea' ),
2675
- 'B' => __( 'B', 'woosea' ),
2676
- 'C' => __( 'C', 'woosea' ),
2677
- 'D' => __( 'D', 'woosea' ),
2678
- 'E' => __( 'E', 'woosea' ),
2679
- 'F' => __( 'F', 'woosea' ),
2680
- 'G' => __( 'G', 'woosea' ),
2681
  )
2682
  )
2683
  );
@@ -2688,21 +2874,21 @@ function woosea_custom_general_fields() {
2688
  woocommerce_wp_select(
2689
  array(
2690
  'id' => '_woosea_min_energy_efficiency_class',
2691
- 'label' => __( 'Minimum energy efficiency class', 'woosea' ),
2692
  'desc_tip' => 'true',
2693
- 'description' => __( 'Select the minimum product energy efficiency class.', 'woosea' ),
2694
  'options' => array (
2695
- '' => __( '', 'woosea' ),
2696
- 'A+++' => __( 'A+++', 'woosea' ),
2697
- 'A++' => __( 'A++', 'woosea' ),
2698
- 'A+' => __( 'A+', 'woosea' ),
2699
- 'A' => __( 'A', 'woosea' ),
2700
- 'B' => __( 'B', 'woosea' ),
2701
- 'C' => __( 'C', 'woosea' ),
2702
- 'D' => __( 'D', 'woosea' ),
2703
- 'E' => __( 'E', 'woosea' ),
2704
- 'F' => __( 'F', 'woosea' ),
2705
- 'G' => __( 'G', 'woosea' ),
2706
  )
2707
  )
2708
  );
@@ -2713,21 +2899,21 @@ function woosea_custom_general_fields() {
2713
  woocommerce_wp_select(
2714
  array(
2715
  'id' => '_woosea_max_energy_efficiency_class',
2716
- 'label' => __( 'Maximum energy efficiency class', 'woosea' ),
2717
  'desc_tip' => 'true',
2718
- 'description' => __( 'Select the maximum product energy efficiency class.', 'woosea' ),
2719
  'options' => array (
2720
- '' => __( '', 'woosea' ),
2721
- 'A+++' => __( 'A+++', 'woosea' ),
2722
- 'A++' => __( 'A++', 'woosea' ),
2723
- 'A+' => __( 'A+', 'woosea' ),
2724
- 'A' => __( 'A', 'woosea' ),
2725
- 'B' => __( 'B', 'woosea' ),
2726
- 'C' => __( 'C', 'woosea' ),
2727
- 'D' => __( 'D', 'woosea' ),
2728
- 'E' => __( 'E', 'woosea' ),
2729
- 'F' => __( 'F', 'woosea' ),
2730
- 'G' => __( 'G', 'woosea' ),
2731
  )
2732
  )
2733
  );
@@ -2738,9 +2924,9 @@ function woosea_custom_general_fields() {
2738
  woocommerce_wp_text_input(
2739
  array(
2740
  'id' => '_woosea_is_promotion',
2741
- 'label' => __( 'Is promotion', 'woosea' ),
2742
  'desc_tip' => 'true',
2743
- 'description' => __( 'Enter your promotion ID.', 'woosea' ),
2744
  )
2745
  );
2746
  }
@@ -2750,9 +2936,9 @@ function woosea_custom_general_fields() {
2750
  woocommerce_wp_text_input(
2751
  array(
2752
  'id' => '_woosea_custom_field_0',
2753
- 'label' => __( 'Custom field 0', 'woosea' ),
2754
  'desc_tip' => 'true',
2755
- 'description' => __( 'Enter your custom field 0', 'woosea' ),
2756
  )
2757
  );
2758
  }
@@ -2762,9 +2948,9 @@ function woosea_custom_general_fields() {
2762
  woocommerce_wp_text_input(
2763
  array(
2764
  'id' => '_woosea_custom_field_1',
2765
- 'label' => __( 'Custom field 1', 'woosea' ),
2766
  'desc_tip' => 'true',
2767
- 'description' => __( 'Enter your custom field 1', 'woosea' ),
2768
  )
2769
  );
2770
  }
@@ -2774,9 +2960,9 @@ function woosea_custom_general_fields() {
2774
  woocommerce_wp_text_input(
2775
  array(
2776
  'id' => '_woosea_custom_field_2',
2777
- 'label' => __( 'Custom field 2', 'woosea' ),
2778
  'desc_tip' => 'true',
2779
- 'description' => __( 'Enter your custom field 2', 'woosea' ),
2780
  )
2781
  );
2782
  }
@@ -2786,9 +2972,9 @@ function woosea_custom_general_fields() {
2786
  woocommerce_wp_text_input(
2787
  array(
2788
  'id' => '_woosea_custom_field_3',
2789
- 'label' => __( 'Custom field 3', 'woosea' ),
2790
  'desc_tip' => 'true',
2791
- 'description' => __( 'Enter your custom field 3', 'woosea' ),
2792
  )
2793
  );
2794
  }
@@ -2798,9 +2984,9 @@ function woosea_custom_general_fields() {
2798
  woocommerce_wp_text_input(
2799
  array(
2800
  'id' => '_woosea_custom_field_4',
2801
- 'label' => __( 'Custom field 4', 'woosea' ),
2802
  'desc_tip' => 'true',
2803
- 'description' => __( 'Enter your custom field 4', 'woosea' ),
2804
  )
2805
  );
2806
  }
@@ -2809,9 +2995,9 @@ function woosea_custom_general_fields() {
2809
  woocommerce_wp_checkbox(
2810
  array(
2811
  'id' => '_woosea_exclude_product',
2812
- 'label' => __( 'Exclude from feeds', 'woosea' ),
2813
  'desc_tip' => 'true',
2814
- 'description' => __( 'Check this box if you want this product to be excluded from product feeds.', 'woosea' ),
2815
  )
2816
  );
2817
 
@@ -2967,10 +3153,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
2967
  woocommerce_wp_text_input(
2968
  array(
2969
  'id' => '_woosea_variable_brand['.$loop.']',
2970
- 'label' => __( '<br>Brand', 'woosea' ),
2971
  'placeholder' => 'Brand',
2972
  'desc_tip' => 'true',
2973
- 'description' => __( 'Enter the product Brand here.', 'woosea' ),
2974
  'value' => get_post_meta($variation->ID, '_woosea_brand', true),
2975
  'wrapper_class' => 'form-row-full',
2976
  )
@@ -2982,10 +3168,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
2982
  woocommerce_wp_text_input(
2983
  array(
2984
  'id' => '_woosea_variable_gtin['.$loop.']',
2985
- 'label' => __( '<br>GTIN', 'woosea' ),
2986
  'placeholder' => 'GTIN',
2987
  'desc_tip' => 'true',
2988
- 'description' => __( 'Enter the product GTIN here.', 'woosea' ),
2989
  'value' => get_post_meta($variation->ID, '_woosea_gtin', true),
2990
  'wrapper_class' => 'form-row-last',
2991
  )
@@ -2997,10 +3183,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
2997
  woocommerce_wp_text_input(
2998
  array(
2999
  'id' => '_woosea_variable_mpn['.$loop.']',
3000
- 'label' => __( '<br>MPN', 'woosea' ),
3001
  'placeholder' => 'Manufacturer Product Number',
3002
  'desc_tip' => 'true',
3003
- 'description' => __( 'Enter the MPN here.', 'woosea' ),
3004
  'value' => get_post_meta($variation->ID, '_woosea_mpn', true),
3005
  'wrapper_class' => 'form-row-first',
3006
  )
@@ -3012,10 +3198,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3012
  woocommerce_wp_text_input(
3013
  array(
3014
  'id' => '_woosea_variable_upc['.$loop.']',
3015
- 'label' => __( '<br>UPC', 'woosea' ),
3016
  'placeholder' => 'UPC',
3017
  'desc_tip' => 'true',
3018
- 'description' => __( 'Enter the product UPC here.', 'woosea' ),
3019
  'value' => get_post_meta($variation->ID, '_woosea_upc', true),
3020
  'wrapper_class' => 'form-row-last',
3021
  )
@@ -3027,10 +3213,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3027
  woocommerce_wp_text_input(
3028
  array(
3029
  'id' => '_woosea_variable_ean['.$loop.']',
3030
- 'label' => __( '<br>EAN', 'woosea' ),
3031
  'placeholder' => 'EAN',
3032
  'desc_tip' => 'true',
3033
- 'description' => __( 'Enter the product EAN here.', 'woosea' ),
3034
  'value' => get_post_meta($variation->ID, '_woosea_ean', true),
3035
  'wrapper_class' => 'form-row-first',
3036
  )
@@ -3042,10 +3228,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3042
  woocommerce_wp_text_input(
3043
  array(
3044
  'id' => '_woosea_variable_color['.$loop.']',
3045
- 'label' => __( '<br>Color', 'woosea' ),
3046
  'placeholder' => 'Color',
3047
  'desc_tip' => 'true',
3048
- 'description' => __( 'Enter the product Color here.', 'woosea' ),
3049
  'value' => get_post_meta($variation->ID, '_woosea_color', true),
3050
  'wrapper_class' => 'form-row-first',
3051
  )
@@ -3057,10 +3243,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3057
  woocommerce_wp_text_input(
3058
  array(
3059
  'id' => '_woosea_variable_size['.$loop.']',
3060
- 'label' => __( '<br>Size', 'woosea' ),
3061
  'placeholder' => 'Size',
3062
  'desc_tip' => 'true',
3063
- 'description' => __( 'Enter the product Size here.', 'woosea' ),
3064
  'value' => get_post_meta($variation->ID, '_woosea_size', true),
3065
  'wrapper_class' => 'form-row-first',
3066
  )
@@ -3072,17 +3258,17 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3072
  woocommerce_wp_select(
3073
  array(
3074
  'id' => '_woosea_gender['.$loop.']',
3075
- 'label' => __( 'Gender', 'woosea' ),
3076
  'placeholder' => 'Gender',
3077
  'desc_tip' => 'true',
3078
- 'description' => __( 'Select the gender.', 'woosea' ),
3079
  'value' => get_post_meta($variation->ID, '_woosea_gender', true),
3080
  'wrapper_class' => 'form-row form-row-full',
3081
  'options' => array (
3082
- '' => __( '', 'woosea' ),
3083
- 'female' => __( 'female', 'woosea' ),
3084
- 'male' => __( 'male', 'woosea' ),
3085
- 'unisex' => __( 'unisex', 'woosea' ),
3086
  )
3087
  )
3088
  );
@@ -3093,10 +3279,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3093
  woocommerce_wp_text_input(
3094
  array(
3095
  'id' => '_woosea_variable_material['.$loop.']',
3096
- 'label' => __( '<br>Material', 'woosea' ),
3097
  'placeholder' => 'Material',
3098
  'desc_tip' => 'true',
3099
- 'description' => __( 'Enter the product Material here.', 'woosea' ),
3100
  'value' => get_post_meta($variation->ID, '_woosea_material', true),
3101
  'wrapper_class' => 'form-row-first',
3102
  )
@@ -3108,10 +3294,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3108
  woocommerce_wp_text_input(
3109
  array(
3110
  'id' => '_woosea_variable_pattern['.$loop.']',
3111
- 'label' => __( '<br>Pattern', 'woosea' ),
3112
  'placeholder' => 'Pattern',
3113
  'desc_tip' => 'true',
3114
- 'description' => __( 'Enter the product Pattern here.', 'woosea' ),
3115
  'value' => get_post_meta($variation->ID, '_woosea_pattern', true),
3116
  'wrapper_class' => 'form-row-first',
3117
  )
@@ -3123,10 +3309,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3123
  woocommerce_wp_text_input(
3124
  array(
3125
  'id' => '_woosea_variable_unit_pricing_measure['.$loop.']',
3126
- 'label' => __( '<br>Unit pricing measure', 'woosea' ),
3127
  'placeholder' => 'Unit pricing measure',
3128
  'desc_tip' => 'true',
3129
- 'description' => __( 'Enter the product Unit pricing measure here.', 'woosea' ),
3130
  'value' => get_post_meta($variation->ID, '_woosea_unit_pricing_measure', true),
3131
  'wrapper_class' => 'form-row-first',
3132
  )
@@ -3138,10 +3324,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3138
  woocommerce_wp_text_input(
3139
  array(
3140
  'id' => '_woosea_variable_unit_pricing_base_measure['.$loop.']',
3141
- 'label' => __( '<br>Unit pricing base measure', 'woosea' ),
3142
  'placeholder' => 'Unit pricing base measure',
3143
  'desc_tip' => 'true',
3144
- 'description' => __( 'Enter the product Unit pricing base measure here.', 'woosea' ),
3145
  'value' => get_post_meta($variation->ID, '_woosea_unit_pricing_base_measure', true),
3146
  'wrapper_class' => 'form-row-first',
3147
  )
@@ -3153,10 +3339,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3153
  woocommerce_wp_text_input(
3154
  array(
3155
  'id' => '_woosea_optimized_title['.$loop.']',
3156
- 'label' => __( '<br>Optimized title', 'woosea' ),
3157
  'placeholder' => 'Optimized title',
3158
  'desc_tip' => 'true',
3159
- 'description' => __( 'Enter a optimized product title here.', 'woosea' ),
3160
  'value' => get_post_meta($variation->ID, '_woosea_optimized_title', true),
3161
  'wrapper_class' => 'form-row-last',
3162
  )
@@ -3168,10 +3354,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3168
  woocommerce_wp_text_input(
3169
  array(
3170
  'id' => '_woosea_installment_months['.$loop.']',
3171
- 'label' => __( '<br>Installment months', 'woosea' ),
3172
  'placeholder' => 'Installment months',
3173
  'desc_tip' => 'true',
3174
- 'description' => __( 'Enter the number of montly installments for the buyer here.', 'woosea' ),
3175
  'value' => get_post_meta($variation->ID, '_woosea_installment_months', true),
3176
  'wrapper_class' => 'form-row-last',
3177
  )
@@ -3183,10 +3369,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3183
  woocommerce_wp_text_input(
3184
  array(
3185
  'id' => '_woosea_installment_amount['.$loop.']',
3186
- 'label' => __( '<br>Installment amount', 'woosea' ),
3187
  'placeholder' => 'Installment amount',
3188
  'desc_tip' => 'true',
3189
- 'description' => __( 'Enter the installment amount here.', 'woosea' ),
3190
  'value' => get_post_meta($variation->ID, '_woosea_installment_amount', true),
3191
  'wrapper_class' => 'form-row-last',
3192
  )
@@ -3198,18 +3384,18 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3198
  woocommerce_wp_select(
3199
  array(
3200
  'id' => '_woosea_condition['.$loop.']',
3201
- 'label' => __( 'Product condition', 'woosea' ),
3202
  'placeholder' => 'Product condition',
3203
  'desc_tip' => 'true',
3204
- 'description' => __( 'Select the product condition.', 'woosea' ),
3205
  'value' => get_post_meta($variation->ID, '_woosea_condition', true),
3206
  'wrapper_class' => 'form-row form-row-full',
3207
  'options' => array (
3208
- '' => __( '', 'woosea' ),
3209
- 'new' => __( 'new', 'woosea' ),
3210
- 'refurbished' => __( 'refurbished', 'woosea' ),
3211
- 'used' => __( 'used', 'woosea' ),
3212
- 'damaged' => __( 'damaged', 'woosea' ),
3213
  )
3214
  )
3215
  );
@@ -3220,19 +3406,19 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3220
  woocommerce_wp_select(
3221
  array(
3222
  'id' => '_woosea_age_group['.$loop.']',
3223
- 'label' => __( 'Product age group', 'woosea' ),
3224
  'placeholder' => 'Product age group',
3225
  'desc_tip' => 'true',
3226
- 'description' => __( 'Select the product age group.', 'woosea' ),
3227
  'value' => get_post_meta($variation->ID, '_woosea_age_group', true),
3228
  'wrapper_class' => 'form-row form-row-full',
3229
  'options' => array (
3230
- '' => __( '', 'woosea' ),
3231
- 'newborn' => __( 'newborn', 'woosea' ),
3232
- 'infant' => __( 'infant', 'woosea' ),
3233
- 'toddler' => __( 'toddler', 'woosea' ),
3234
- 'kids' => __( 'kids', 'woosea' ),
3235
- 'adult' => __( 'adult', 'woosea' ),
3236
  )
3237
  )
3238
  );
@@ -3243,10 +3429,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3243
  woocommerce_wp_text_input(
3244
  array(
3245
  'id' => '_woosea_cost_of_good_sold['.$loop.']',
3246
- 'label' => __( '<br>Cost of good sold', 'woosea' ),
3247
  'placeholder' => 'Cost of good sold',
3248
  'desc_tip' => 'true',
3249
- 'description' => __( 'Enter the cost of good sold.', 'woosea' ),
3250
  'value' => get_post_meta($variation->ID, '_woosea_cost_of_good_sold', true),
3251
  'wrapper_class' => 'form-row-last',
3252
  )
@@ -3258,10 +3444,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3258
  woocommerce_wp_text_input(
3259
  array(
3260
  'id' => '_woosea_multipack['.$loop.']',
3261
- 'label' => __( '<br>Multipack', 'woosea' ),
3262
  'placeholder' => 'Multipack amount',
3263
  'desc_tip' => 'true',
3264
- 'description' => __( 'Enter the multipack amount here.', 'woosea' ),
3265
  'value' => get_post_meta($variation->ID, '_woosea_multipack', true),
3266
  'wrapper_class' => 'form-row-last',
3267
  )
@@ -3273,10 +3459,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3273
  woocommerce_wp_select(
3274
  array(
3275
  'id' => '_woosea_is_bundle['.$loop.']',
3276
- 'label' => __( 'Is bundle', 'woosea' ),
3277
  'placeholder' => 'Is bundle',
3278
  'desc_tip' => 'true',
3279
- 'description' => __( 'Select the is bundle value.', 'woosea' ),
3280
  'value' => get_post_meta($variation->ID, '_woosea_is_bundle', true),
3281
  'wrapper_class' => 'form-row form-row-full',
3282
  'options' => array (
@@ -3293,24 +3479,24 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3293
  woocommerce_wp_select(
3294
  array(
3295
  'id' => '_woosea_energy_efficiency_class['.$loop.']',
3296
- 'label' => __( 'Energy efficiency class', 'woosea' ),
3297
  'placeholder' => 'Energy efficiency class',
3298
  'desc_tip' => 'true',
3299
- 'description' => __( 'Select the energy efficiency class.', 'woosea' ),
3300
  'value' => get_post_meta($variation->ID, '_woosea_energy_efficiency_class', true),
3301
  'wrapper_class' => 'form-row form-row-full',
3302
  'options' => array (
3303
- '' => __( '', 'woosea' ),
3304
- 'A+++' => __( 'A+++', 'woosea' ),
3305
- 'A++' => __( 'A++', 'woosea' ),
3306
- 'A+' => __( 'A+', 'woosea' ),
3307
- 'A' => __( 'A', 'woosea' ),
3308
- 'B' => __( 'B', 'woosea' ),
3309
- 'C' => __( 'C', 'woosea' ),
3310
- 'D' => __( 'D', 'woosea' ),
3311
- 'E' => __( 'E', 'woosea' ),
3312
- 'F' => __( 'F', 'woosea' ),
3313
- 'G' => __( 'G', 'woosea' ),
3314
  )
3315
  )
3316
  );
@@ -3321,24 +3507,24 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3321
  woocommerce_wp_select(
3322
  array(
3323
  'id' => '_woosea_min_energy_efficiency_class['.$loop.']',
3324
- 'label' => __( 'Minimum energy efficiency class', 'woosea' ),
3325
  'placeholder' => 'Minimum energy efficiency class',
3326
  'desc_tip' => 'true',
3327
- 'description' => __( 'Select the minimum energy efficiency class.', 'woosea' ),
3328
  'value' => get_post_meta($variation->ID, '_woosea_min_energy_efficiency_class', true),
3329
  'wrapper_class' => 'form-row form-row-full',
3330
  'options' => array (
3331
- '' => __( '', 'woosea' ),
3332
- 'A+++' => __( 'A+++', 'woosea' ),
3333
- 'A++' => __( 'A++', 'woosea' ),
3334
- 'A+' => __( 'A+', 'woosea' ),
3335
- 'A' => __( 'A', 'woosea' ),
3336
- 'B' => __( 'B', 'woosea' ),
3337
- 'C' => __( 'C', 'woosea' ),
3338
- 'D' => __( 'D', 'woosea' ),
3339
- 'E' => __( 'E', 'woosea' ),
3340
- 'F' => __( 'F', 'woosea' ),
3341
- 'G' => __( 'G', 'woosea' ),
3342
  )
3343
  )
3344
  );
@@ -3349,24 +3535,24 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3349
  woocommerce_wp_select(
3350
  array(
3351
  'id' => '_woosea_max_energy_efficiency_class['.$loop.']',
3352
- 'label' => __( 'Maximum energy efficiency class', 'woosea' ),
3353
  'placeholder' => 'Maximum energy efficiency class',
3354
  'desc_tip' => 'true',
3355
- 'description' => __( 'Select the maximum energy efficiency class.', 'woosea' ),
3356
  'value' => get_post_meta($variation->ID, '_woosea_max_energy_efficiency_class', true),
3357
  'wrapper_class' => 'form-row form-row-full',
3358
  'options' => array (
3359
- '' => __( '', 'woosea' ),
3360
- 'A+++' => __( 'A+++', 'woosea' ),
3361
- 'A++' => __( 'A++', 'woosea' ),
3362
- 'A+' => __( 'A+', 'woosea' ),
3363
- 'A' => __( 'A', 'woosea' ),
3364
- 'B' => __( 'B', 'woosea' ),
3365
- 'C' => __( 'C', 'woosea' ),
3366
- 'D' => __( 'D', 'woosea' ),
3367
- 'E' => __( 'E', 'woosea' ),
3368
- 'F' => __( 'F', 'woosea' ),
3369
- 'G' => __( 'G', 'woosea' ),
3370
  )
3371
  )
3372
  );
@@ -3377,10 +3563,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3377
  woocommerce_wp_text_input(
3378
  array(
3379
  'id' => '_woosea_is_promotion['.$loop.']',
3380
- 'label' => __( '<br>Is promotion', 'woosea' ),
3381
  'placeholder' => 'Is promotion',
3382
  'desc_tip' => 'true',
3383
- 'description' => __( 'Enter your promotion ID', 'woosea' ),
3384
  'value' => get_post_meta($variation->ID, '_woosea_is_promotion', true),
3385
  'wrapper_class' => 'form-row-last',
3386
  )
@@ -3392,10 +3578,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3392
  woocommerce_wp_text_input(
3393
  array(
3394
  'id' => '_woosea_custom_field_0['.$loop.']',
3395
- 'label' => __( '<br>Custom field 0', 'woosea' ),
3396
  'placeholder' => 'Custom field 0',
3397
  'desc_tip' => 'true',
3398
- 'description' => __( 'Enter your custom field 0', 'woosea' ),
3399
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_0', true),
3400
  'wrapper_class' => 'form-row-last',
3401
  )
@@ -3407,10 +3593,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3407
  woocommerce_wp_text_input(
3408
  array(
3409
  'id' => '_woosea_custom_field_1['.$loop.']',
3410
- 'label' => __( '<br>Custom field 1', 'woosea' ),
3411
  'placeholder' => 'Custom field 1',
3412
  'desc_tip' => 'true',
3413
- 'description' => __( 'Enter your custom field 1', 'woosea' ),
3414
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_1', true),
3415
  'wrapper_class' => 'form-row-last',
3416
  )
@@ -3422,10 +3608,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3422
  woocommerce_wp_text_input(
3423
  array(
3424
  'id' => '_woosea_custom_field_2['.$loop.']',
3425
- 'label' => __( '<br>Custom field 2', 'woosea' ),
3426
  'placeholder' => 'Custom field 2',
3427
  'desc_tip' => 'true',
3428
- 'description' => __( 'Enter your custom field 2', 'woosea' ),
3429
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_2', true),
3430
  'wrapper_class' => 'form-row-last',
3431
  )
@@ -3437,10 +3623,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3437
  woocommerce_wp_text_input(
3438
  array(
3439
  'id' => '_woosea_custom_field_3['.$loop.']',
3440
- 'label' => __( '<br>Custom field 3', 'woosea' ),
3441
  'placeholder' => 'Custom field 3',
3442
  'desc_tip' => 'true',
3443
- 'description' => __( 'Enter your custom field 3', 'woosea' ),
3444
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_3', true),
3445
  'wrapper_class' => 'form-row-last',
3446
  )
@@ -3466,10 +3652,10 @@ function woosea_custom_variable_fields( $loop, $variation_id, $variation ) {
3466
  woocommerce_wp_checkbox(
3467
  array(
3468
  'id' => '_woosea_exclude_product['.$loop.']',
3469
- 'label' => __( '&nbsp;Exclude from feeds', 'woocommerce' ),
3470
  'placeholder' => 'Exclude from feeds',
3471
  'desc_tip' => 'true',
3472
- 'description' => __( 'Check this box if you want this product to be excluded from product feeds.', 'woocommerce' ),
3473
  'value' => get_post_meta($variation->ID, '_woosea_exclude_product', true),
3474
  )
3475
  );
@@ -3483,10 +3669,14 @@ add_action( 'woocommerce_product_after_variable_attributes', 'woosea_custom_vari
3483
  function woosea_save_custom_variable_fields( $post_id ) {
3484
 
3485
  if (isset( $_POST['variable_sku'] ) ) {
 
 
3486
 
3487
- $variable_sku = $_POST['variable_sku'];
3488
- $variable_post_id = $_POST['variable_post_id'];
3489
- $max_loop = max( array_keys( $_POST['variable_post_id'] ) );
 
 
3490
 
3491
  for ( $i = 0; $i <= $max_loop; $i++ ) {
3492
 
@@ -3496,7 +3686,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3496
 
3497
  // Brand Field
3498
  if(isset($_POST['_woosea_variable_brand'])){
3499
- $_brand = $_POST['_woosea_variable_brand'];
3500
  $variation_id = (int) $variable_post_id[$i];
3501
  if ( isset( $_brand[$i] ) ) {
3502
  update_post_meta( $variation_id, '_woosea_brand', stripslashes( sanitize_text_field( $_brand[$i] )));
@@ -3505,7 +3695,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3505
 
3506
  // MPN Field
3507
  if(isset($_POST['_woosea_variable_mpn'])){
3508
- $_mpn = $_POST['_woosea_variable_mpn'];
3509
  $variation_id = (int) $variable_post_id[$i];
3510
  if ( isset( $_mpn[$i] ) ) {
3511
  update_post_meta( $variation_id, '_woosea_mpn', stripslashes( sanitize_text_field( $_mpn[$i] )));
@@ -3514,7 +3704,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3514
 
3515
  // UPC Field
3516
  if(isset($_POST['_woosea_variable_upc'])){
3517
- $_upc = $_POST['_woosea_variable_upc'];
3518
  $variation_id = (int) $variable_post_id[$i];
3519
  if ( isset( $_upc[$i] ) ) {
3520
  update_post_meta( $variation_id, '_woosea_upc', stripslashes( sanitize_text_field( $_upc[$i] )));
@@ -3523,7 +3713,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3523
 
3524
  // EAN Field
3525
  if(isset($_POST['_woosea_variable_ean'])){
3526
- $_ean = $_POST['_woosea_variable_ean'];
3527
  $variation_id = (int) $variable_post_id[$i];
3528
  if ( isset( $_ean[$i] ) ) {
3529
  update_post_meta( $variation_id, '_woosea_ean', stripslashes( sanitize_text_field( $_ean[$i] )));
@@ -3532,7 +3722,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3532
 
3533
  // GTIN Field
3534
  if(isset($_POST['_woosea_variable_gtin'])){
3535
- $_gtin = $_POST['_woosea_variable_gtin'];
3536
  $variation_id = (int) $variable_post_id[$i];
3537
  if ( isset( $_gtin[$i] ) ) {
3538
  update_post_meta( $variation_id, '_woosea_gtin', stripslashes( sanitize_text_field( $_gtin[$i] )));
@@ -3541,7 +3731,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3541
 
3542
  // Color Field
3543
  if(isset($_POST['_woosea_variable_color'])){
3544
- $_color = $_POST['_woosea_variable_color'];
3545
  $variation_id = (int) $variable_post_id[$i];
3546
  if ( isset( $_color[$i] ) ) {
3547
  update_post_meta( $variation_id, '_woosea_color', stripslashes( sanitize_text_field( $_color[$i] )));
@@ -3550,7 +3740,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3550
 
3551
  // Size Field
3552
  if(isset($_POST['_woosea_variable_size'])){
3553
- $_size = $_POST['_woosea_variable_size'];
3554
  $variation_id = (int) $variable_post_id[$i];
3555
  if ( isset( $_size[$i] ) ) {
3556
  update_post_meta( $variation_id, '_woosea_size', stripslashes( sanitize_text_field( $_size[$i] )));
@@ -3559,7 +3749,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3559
 
3560
  // Gender Field
3561
  if(isset($_POST['_woosea_variable_gender'])){
3562
- $_gender = $_POST['_woosea_variable_gender'];
3563
  $variation_id = (int) $variable_post_id[$i];
3564
  if ( isset( $_gender[$i] ) ) {
3565
  update_post_meta( $variation_id, '_woosea_gender', stripslashes( sanitize_text_field( $_gender[$i] )));
@@ -3568,7 +3758,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3568
 
3569
  // Material Field
3570
  if(isset($_POST['_woosea_variable_material'])){
3571
- $_material = $_POST['_woosea_variable_material'];
3572
  $variation_id = (int) $variable_post_id[$i];
3573
  if ( isset( $_material[$i] ) ) {
3574
  update_post_meta( $variation_id, '_woosea_material', stripslashes( sanitize_text_field( $_material[$i] )));
@@ -3577,7 +3767,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3577
 
3578
  // Pattern Field
3579
  if(isset($_POST['_woosea_variable_pattern'])){
3580
- $_pattern = $_POST['_woosea_variable_pattern'];
3581
  $variation_id = (int) $variable_post_id[$i];
3582
  if ( isset( $_pattern[$i] ) ) {
3583
  update_post_meta( $variation_id, '_woosea_pattern', stripslashes( sanitize_text_field( $_pattern[$i] )));
@@ -3586,7 +3776,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3586
 
3587
  // Unit pricing measure Field
3588
  if(isset($_POST['_woosea_variable_unit_pricing_measure'])){
3589
- $_pricing_measure = $_POST['_woosea_variable_unit_pricing_measure'];
3590
  $variation_id = (int) $variable_post_id[$i];
3591
  if ( isset( $_pricing_measure[$i] ) ) {
3592
  update_post_meta( $variation_id, '_woosea_unit_pricing_measure', stripslashes( sanitize_text_field( $_pricing_measure[$i] )));
@@ -3595,7 +3785,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3595
 
3596
  // Unit pricing base measure Field
3597
  if(isset($_POST['_woosea_variable_unit_pricing_base_measure'])){
3598
- $_pricing_base = $_POST['_woosea_variable_unit_pricing_base_measure'];
3599
  $variation_id = (int) $variable_post_id[$i];
3600
  if ( isset( $_pricing_base[$i] ) ) {
3601
  update_post_meta( $variation_id, '_woosea_unit_pricing_base_measure', stripslashes( sanitize_text_field( $_pricing_base[$i] )));
@@ -3604,7 +3794,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3604
 
3605
  // Optimized title Field
3606
  if(isset($_POST['_woosea_optimized_title'])){
3607
- $_opttitle = $_POST['_woosea_optimized_title'];
3608
  $variation_id = (int) $variable_post_id[$i];
3609
  if ( isset( $_opttitle[$i] ) ) {
3610
  update_post_meta( $variation_id, '_woosea_optimized_title', stripslashes( sanitize_text_field( $_opttitle[$i] )));
@@ -3613,7 +3803,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3613
 
3614
  // Installment months Field
3615
  if(isset($_POST['_woosea_installment_months'])){
3616
- $_installment_months = $_POST['_woosea_installment_months'];
3617
  $variation_id = (int) $variable_post_id[$i];
3618
  if ( isset( $_installment_months[$i] ) ) {
3619
  update_post_meta( $variation_id, '_woosea_installment_months', stripslashes( sanitize_text_field( $_installment_months[$i] )));
@@ -3622,7 +3812,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3622
 
3623
  // Installment amount Field
3624
  if(isset($_POST['_woosea_installment_amount'])){
3625
- $_installment_amount = $_POST['_woosea_installment_amount'];
3626
  $variation_id = (int) $variable_post_id[$i];
3627
  if ( isset( $_installment_amount[$i] ) ) {
3628
  update_post_meta( $variation_id, '_woosea_installment_amount', stripslashes( sanitize_text_field( $_installment_amount[$i] )));
@@ -3631,7 +3821,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3631
 
3632
  // Product condition Field
3633
  if(isset($_POST['_woosea_condition'])){
3634
- $_condition = $_POST['_woosea_condition'];
3635
  $variation_id = (int) $variable_post_id[$i];
3636
  if ( isset( $_condition[$i] ) ) {
3637
  update_post_meta( $variation_id, '_woosea_condition', stripslashes( sanitize_text_field( $_condition[$i] )));
@@ -3640,7 +3830,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3640
 
3641
  // Product age group
3642
  if(isset($_POST['_woosea_age_group'])){
3643
- $_age_group = $_POST['_woosea_age_group'];
3644
  $variation_id = (int) $variable_post_id[$i];
3645
  if ( isset( $_age_group[$i] ) ) {
3646
  update_post_meta( $variation_id, '_woosea_age_group', stripslashes( sanitize_text_field( $_age_group[$i] )));
@@ -3650,7 +3840,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3650
 
3651
  // Cost of good sold
3652
  if(isset($_POST['_woosea_cost_of_good_sold'])){
3653
- $_cost_of_good_sold = $_POST['_woosea_cost_of_good_sold'];
3654
  $variation_id = (int) $variable_post_id[$i];
3655
  if ( isset( $_cost_of_good_sold[$i] ) ) {
3656
  update_post_meta( $variation_id, '_woosea_cost_of_good_sold', stripslashes( sanitize_text_field( $_cost_of_good_sold[$i] )));
@@ -3659,7 +3849,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3659
 
3660
  // Multipack
3661
  if(isset($_POST['_woosea_multipack'])){
3662
- $_multipack = $_POST['_woosea_multipack'];
3663
  $variation_id = (int) $variable_post_id[$i];
3664
  if ( isset( $_multipack[$i] ) ) {
3665
  update_post_meta( $variation_id, '_woosea_multipack', stripslashes( sanitize_text_field( $_multipack[$i] )));
@@ -3668,7 +3858,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3668
 
3669
  // Is promotion
3670
  if(isset($_POST['_woosea_is_promotion'])){
3671
- $_is_promotion = $_POST['_woosea_is_promotion'];
3672
  $variation_id = (int) $variable_post_id[$i];
3673
  if ( isset( $_is_promotion[$i] ) ) {
3674
  update_post_meta( $variation_id, '_woosea_is_promotion', stripslashes( sanitize_text_field( $_is_promotion[$i] )));
@@ -3677,7 +3867,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3677
 
3678
  // Is bundle
3679
  if(isset($_POST['_woosea_is_bundle'])){
3680
- $_is_bundle = $_POST['_woosea_is_bundle'];
3681
  $variation_id = (int) $variable_post_id[$i];
3682
  if ( isset( $_is_bundle[$i] ) ) {
3683
  update_post_meta( $variation_id, '_woosea_is_bundle', stripslashes( sanitize_text_field( $_is_bundle[$i] )));
@@ -3686,7 +3876,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3686
 
3687
  // Energy efficiency class
3688
  if(isset($_POST['_woosea_energy_efficiency_class'])){
3689
- $_energy_efficiency_class = $_POST['_woosea_energy_efficiency_class'];
3690
  $variation_id = (int) $variable_post_id[$i];
3691
  if ( isset( $_energy_efficiency_class[$i] ) ) {
3692
  update_post_meta( $variation_id, '_woosea_energy_efficiency_class', stripslashes( sanitize_text_field( $_energy_efficiency_class[$i] )));
@@ -3695,7 +3885,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3695
 
3696
  // Minimum energy efficiency class
3697
  if(isset($_POST['_woosea_min_energy_efficiency_class'])){
3698
- $_min_energy_efficiency_class = $_POST['_woosea_min_energy_efficiency_class'];
3699
  $variation_id = (int) $variable_post_id[$i];
3700
  if ( isset( $_min_energy_efficiency_class[$i] ) ) {
3701
  update_post_meta( $variation_id, '_woosea_min_energy_efficiency_class', stripslashes( sanitize_text_field( $_min_energy_efficiency_class[$i] )));
@@ -3704,7 +3894,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3704
 
3705
  // Maximum energy efficiency class
3706
  if(isset($_POST['_woosea_max_energy_efficiency_class'])){
3707
- $_max_energy_efficiency_class = $_POST['_woosea_max_energy_efficiency_class'];
3708
  $variation_id = (int) $variable_post_id[$i];
3709
  if ( isset( $_max_energy_efficiency_class[$i] ) ) {
3710
  update_post_meta( $variation_id, '_woosea_max_energy_efficiency_class', stripslashes( sanitize_text_field( $_max_energy_efficiency_class[$i] )));
@@ -3713,7 +3903,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3713
 
3714
  // Custom field 0
3715
  if(isset($_POST['_woosea_custom_field_0'])){
3716
- $_custom_field_0 = $_POST['_woosea_custom_field_0'];
3717
  $variation_id = (int) $variable_post_id[$i];
3718
  if ( isset( $_custom_field_0[$i] ) ) {
3719
  update_post_meta( $variation_id, '_woosea_custom_field_0', stripslashes( sanitize_text_field( $_custom_field_0[$i] )));
@@ -3722,7 +3912,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3722
 
3723
  // Custom field 1
3724
  if(isset($_POST['_woosea_custom_field_1'])){
3725
- $_custom_field_1 = $_POST['_woosea_custom_field_1'];
3726
  $variation_id = (int) $variable_post_id[$i];
3727
  if ( isset( $_custom_field_1[$i] ) ) {
3728
  update_post_meta( $variation_id, '_woosea_custom_field_1', stripslashes( sanitize_text_field( $_custom_field_1[$i] )));
@@ -3731,7 +3921,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3731
 
3732
  // Custom field 2
3733
  if(isset($_POST['_woosea_custom_field_2'])){
3734
- $_custom_field_2 = $_POST['_woosea_custom_field_2'];
3735
  $variation_id = (int) $variable_post_id[$i];
3736
  if ( isset( $_custom_field_2[$i] ) ) {
3737
  update_post_meta( $variation_id, '_woosea_custom_field_2', stripslashes( sanitize_text_field( $_custom_field_2[$i] )));
@@ -3740,7 +3930,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3740
 
3741
  // Custom field 3
3742
  if(isset($_POST['_woosea_custom_field_3'])){
3743
- $_custom_field_3 = $_POST['_woosea_custom_field_3'];
3744
  $variation_id = (int) $variable_post_id[$i];
3745
  if ( isset( $_custom_field_3[$i] ) ) {
3746
  update_post_meta( $variation_id, '_woosea_custom_field_3', stripslashes( sanitize_text_field( $_custom_field_3[$i] )));
@@ -3749,7 +3939,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3749
 
3750
  // Custom field 4
3751
  if(isset($_POST['_woosea_custom_field_4'])){
3752
- $_custom_field_4 = $_POST['_woosea_custom_field_4'];
3753
  $variation_id = (int) $variable_post_id[$i];
3754
  if ( isset( $_custom_field_4[$i] ) ) {
3755
  update_post_meta( $variation_id, '_woosea_custom_field_4', stripslashes( sanitize_text_field( $_custom_field_4[$i] )));
@@ -3760,7 +3950,7 @@ function woosea_save_custom_variable_fields( $post_id ) {
3760
  if(empty($_POST['_woosea_exclude_product'])){
3761
  $_excludeproduct[$i] = "no";
3762
  } else {
3763
- $_excludeproduct = $_POST['_woosea_exclude_product'];
3764
  }
3765
  $variation_id = (int) $variable_post_id[$i];
3766
  if ( isset( $_excludeproduct[$i] ) ) {
@@ -3903,6 +4093,7 @@ add_action( 'wp_ajax_woosea_fieldmapping_dialog_helptext', 'woosea_fieldmapping_
3903
  * Get the dropdowns for the fieldmapping page
3904
  */
3905
  function woosea_fieldmapping_dropdown(){
 
3906
  $channel_hash = sanitize_text_field($_POST['channel_hash']);
3907
  $rowCount = sanitize_text_field($_POST['rowCount']);
3908
  $channel_data = WooSEA_Update_Project::get_channel_data($channel_hash);
@@ -3959,70 +4150,6 @@ function woosea_autocomplete_dropdown() {
3959
  }
3960
  add_action( 'wp_ajax_woosea_autocomplete_dropdown', 'woosea_autocomplete_dropdown' );
3961
 
3962
- /**
3963
- * Autosuggest categories or productnames for category mapping page
3964
- */
3965
- function woosea_autocomplete_mapping() {
3966
- $query = sanitize_text_field($_POST['query']);
3967
- $searchin = sanitize_text_field($_POST['searchin']);
3968
- $condition = sanitize_text_field($_POST['condition']);
3969
-
3970
- $data = array();
3971
- $data_raw = array();
3972
-
3973
- // search on exact productname
3974
- if (($searchin == "title") AND ($condition == "=") OR ($condition == "contains")){
3975
- $prods = new WP_Query(
3976
- array(
3977
- 's' => $query,
3978
- 'posts_per_page' => -1,
3979
- 'post_type' => array('product'),
3980
- 'post_status' => 'publish',
3981
- 'fields' => 'ids',
3982
- 'no_found_rows' => true
3983
- )
3984
- );
3985
-
3986
- while ($prods->have_posts()) : $prods->the_post();
3987
- global $product;
3988
- $product_title = $product->get_title();
3989
-
3990
- if(!$product) {
3991
- return -1;
3992
- }
3993
-
3994
- if ($product->is_type( 'variable' )) {
3995
- $attrv = $product->get_variation_attributes();
3996
- foreach ($attrv as $ka => $va){
3997
- foreach ($va as $k => $v){
3998
- $data_raw[] = $product_title ." ". ucfirst($v);
3999
- }
4000
- }
4001
- }
4002
- endwhile;
4003
- wp_reset_query();
4004
- // search on exact categoryname
4005
- } elseif (($searchin == "categories") AND ($condition == "=")) {
4006
- $hide_empty = false ;
4007
- $cat_args = array(
4008
- 'search' => $query,
4009
- 'hide_empty' => $hide_empty,
4010
- );
4011
- $all_categories = get_terms( 'product_cat', $cat_args );
4012
- foreach($all_categories as $sub_category) {
4013
- $data_raw[] = $sub_category->name;
4014
- }
4015
- } else {
4016
- $data_raw[] = "";
4017
- }
4018
-
4019
- $data = array_unique($data_raw);
4020
- $data = json_encode($data);
4021
- echo $data;
4022
- wp_die();
4023
- }
4024
- add_action( 'wp_ajax_woosea_autocomplete_mapping', 'woosea_autocomplete_mapping' );
4025
-
4026
  /**
4027
  * Function for serving different HTML templates while configuring the feed
4028
  * Some cases are left blank for future steps and pages in the configurations process
@@ -4076,9 +4203,7 @@ function woosea_generate_pages(){
4076
  if (!$_POST){
4077
  $generate_step = 0;
4078
  } else {
4079
- $from_post = $_POST;
4080
- $from_post = stripslashes_recursive($from_post);
4081
-
4082
  $channel_hash = sanitize_text_field($_POST['channel_hash']);
4083
  $step = sanitize_text_field($_POST['step']);
4084
  $generate_step = $step;
@@ -4325,119 +4450,6 @@ function woosea_last_updated($project_hash){
4325
  return $last_updated;
4326
  }
4327
 
4328
- /**
4329
- * Track user and channel conversions
4330
- */
4331
- function woosea_track_conversion () {
4332
- $save_conversion = "no";
4333
-
4334
- // First check if adTribesID cookie is active
4335
- if(isset($_COOKIE['adTribesID'])) {
4336
- $adTribesID = $_COOKIE['adTribesID'];
4337
- $utm_source = ""; // we did not save the utm values in cookies
4338
- $utm_campaign = "";
4339
- $utm_medium = "";
4340
- $utm_term = "";
4341
- $save_conversion = "yes";
4342
- // Or conversion is trackes in session
4343
- } elseif(!empty($_POST['adTribesID'])) {
4344
- $adTribesID = sanitize_text_field($_POST['adTribesID']);
4345
- $utm_source = sanitize_text_field($_POST['utm_source']);
4346
- $utm_campaign = sanitize_text_field($_POST['utm_campaign']);
4347
- $utm_medium = sanitize_text_field($_POST['utm_medium']);
4348
- $utm_term = sanitize_text_field($_POST['utm_term']);
4349
- $save_conversion = "yes";
4350
- }
4351
-
4352
- if($save_conversion == "yes"){
4353
- list($project_hash, $plugin, $productId) = explode('|', $adTribesID);
4354
-
4355
- if((!empty($productId)) AND ($productId > 0)){
4356
- $conversion_timestamp = date("j-n-Y G:i:s");
4357
-
4358
- // Insert the conversion data into the MySql conversion table
4359
- global $wpdb;
4360
- $charset_collate = $wpdb->get_charset_collate();
4361
- $table_name = $wpdb->prefix . 'adtribes_my_conversions';
4362
-
4363
- // Get the last order ID
4364
- $orderId = get_option( 'last_order_id' );
4365
- $inserted_id = 0;
4366
- $success = "no";
4367
-
4368
- // Check if order was not inserted before inserting it.
4369
- $orderId_check = $wpdb->get_results("SELECT * FROM $table_name WHERE orderId = '".$orderId."'");
4370
-
4371
- if($wpdb->num_rows == 0){
4372
- $wpdb->insert($table_name,
4373
- array(
4374
- 'conversion_time' => current_time('mysql' , 1),
4375
- 'project_hash' => $project_hash,
4376
- 'utm_source' => $utm_source,
4377
- 'utm_campaign' => $utm_campaign,
4378
- 'utm_medium' => $utm_medium,
4379
- 'utm_term' => $utm_term,
4380
- 'productId' => $productId,
4381
- 'orderId' => $orderId
4382
- ),
4383
- array(
4384
- '%s',
4385
- '%s',
4386
- '%s',
4387
- '%s',
4388
- '%s',
4389
- '%s',
4390
- '%d',
4391
- '%d'
4392
- )
4393
- );
4394
-
4395
- $inserted_id = $wpdb->insert_id;
4396
- }
4397
-
4398
- if($inserted_id > 0){
4399
- $success = "yes";
4400
- }
4401
-
4402
- $data = array (
4403
- "conversion_saved" => $success,
4404
- );
4405
-
4406
- $data = json_encode($data);
4407
- echo $data;
4408
- wp_die();
4409
- }
4410
- }
4411
- }
4412
- add_action( 'wp_ajax_woosea_track_conversion','woosea_track_conversion');
4413
- add_action( 'wp_ajax_nopriv_woosea_track_conversion','woosea_track_conversion');
4414
-
4415
- /**
4416
- * Set tracking cookies
4417
- */
4418
- function woosea_set_cookie () {
4419
-
4420
- if(!empty($_POST['adTribesID'])) {
4421
- $adTribesID = sanitize_text_field($_POST['adTribesID']);
4422
-
4423
- // Conversion cookie will expire in 30 days from now. Make this configurable later.
4424
- $number_of_days = 30;
4425
- $date_of_expiry = time() + 60 * 60 *24 * $number_of_days;
4426
- setcookie('adTribesID', $adTribesID, $date_of_expiry);
4427
-
4428
- $success = "yes";
4429
- $data = array (
4430
- "cookie_set" => $success,
4431
- );
4432
-
4433
- $data = json_encode($data);
4434
- echo $data;
4435
- wp_die();
4436
- }
4437
- }
4438
- add_action( 'wp_ajax_woosea_set_cookie','woosea_set_cookie');
4439
- add_action( 'wp_ajax_nopriv_woosea_set_cookie','woosea_set_cookie');
4440
-
4441
  /**
4442
  * Process next batch for product feed
4443
  */
@@ -4608,97 +4620,4 @@ function woosea_clear(){
4608
  * Add plugin links to Wordpress menu
4609
  */
4610
  add_action( 'admin_menu' , 'woosea_menu_addition' );
4611
-
4612
- /**
4613
- * Register all dashboard metaboxes
4614
- */
4615
-
4616
- function woosea_blog_widgets() {
4617
- global $wp_meta_boxes;
4618
-
4619
- add_meta_box('woosea_rss_dashboard_widget', __('Latest Product Feed Pro Tutorials', 'rc_mdm'), 'woosea_my_rss_box','dashboard','side','high');
4620
- }
4621
- add_action('wp_dashboard_setup', 'woosea_blog_widgets');
4622
-
4623
- /**
4624
- * Creates the RSS metabox
4625
- */
4626
- function woosea_my_rss_box() {
4627
-
4628
- // Get RSS Feed(s)
4629
- include_once(ABSPATH . WPINC . '/feed.php');
4630
- $domain = $_SERVER['HTTP_HOST'];
4631
-
4632
- // My feeds list (add your own RSS feeds urls)
4633
- $my_feeds = array(
4634
- 'https://www.adtribes.io/feed/'
4635
- );
4636
-
4637
- // Loop through Feeds
4638
- foreach ( $my_feeds as $feed) :
4639
- // Get a SimplePie feed object from the specified feed source.
4640
- $rss = fetch_feed( $feed );
4641
-
4642
- $maxitems = 0;
4643
- $rss_items = array();
4644
- $rss_title = "";
4645
-
4646
- if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly
4647
- // Figure out how many total items there are, and choose a limit
4648
- $maxitems = $rss->get_item_quantity( 5 );
4649
-
4650
- // Build an array of all the items, starting with element 0 (first element).
4651
- $rss_items = $rss->get_items( 0, $maxitems );
4652
-
4653
- // Get RSS title
4654
- $rss_title = '<a href="'.$rss->get_permalink().'" target="_blank">'.strtoupper( $rss->get_title() ).'</a>';
4655
- //endif;
4656
-
4657
- // Display the container
4658
- echo '<div class="rss-widget">';
4659
- echo '<strong>'.$rss_title.'</strong>';
4660
- echo '<hr style="border: 0; background-color: #DFDFDF; height: 1px;">';
4661
-
4662
- // Starts items listing within <ul> tag
4663
- echo '<ul>';
4664
-
4665
- // Check items
4666
- if ( $maxitems == 0 ) {
4667
- echo '<li>'.__( 'No item', 'rc_mdm').'.</li>';
4668
- } else {
4669
- // Loop through each feed item and display each item as a hyperlink.
4670
- foreach ( $rss_items as $item ) :
4671
- // Uncomment line below to display non human date
4672
- //$item_date = $item->get_date( get_option('date_format').' @ '.get_option('time_format') );
4673
-
4674
- // Get human date (comment if you want to use non human date)
4675
- $item_date = human_time_diff( $item->get_date('U'), current_time('timestamp')).' '.__( 'ago', 'rc_mdm' );
4676
-
4677
- // Start displaying item content within a <li> tag
4678
- echo '<li>';
4679
- // create item link
4680
- echo '<a href="'.esc_url( $item->get_permalink() ).'?utm_source='.$domain.'&utm_medium=plugin&utm_campaign=dashboard-rss" title="'.$item_date.'" target="_blank">';
4681
- // Get item title
4682
- echo esc_html( $item->get_title() );
4683
- echo '</a>';
4684
- // Display date
4685
- echo ' <span class="rss-date">'.$item_date.'</span><br />';
4686
- // Get item content
4687
- $content = $item->get_content();
4688
- // Shorten content
4689
- $content = wp_html_excerpt($content, 120) . ' [...]';
4690
- // Display content
4691
- echo $content;
4692
- // End <li> tag
4693
- echo '</li>';
4694
- endforeach;
4695
- }
4696
- // End <ul> tag
4697
- echo '</ul>';
4698
- echo '<hr style="border: 0; background-color: #DFDFDF; height: 1px;">';
4699
- echo '<a href="https://adtribes.io/tutorials/?utm_source='.$domain.'&utm_medium=plugin&utm_campaign=dashboard-rss" target="_blank">More tutorials on our website</a>';
4700
- echo '</div>';
4701
- endif;
4702
- endforeach; // End foreach feed
4703
- }
4704
  ?>
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
+ * Version: 10.9.8
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
11
  * License: GPL3
12
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
  * Requires at least: 4.5
14
+ * Tested up to: 5.8
15
  *
16
  * Text Domain: woo-product-feed-pro
17
  * Domain Path: /languages
18
  *
19
  * WC requires at least: 4.4
20
+ * WC tested up to: 5.9
21
  *
22
  * Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
23
  * it under the terms of the GNU General Public License as published by
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
+ define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '10.9.8' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
101
  wp_enqueue_script('jquery-ui-datepicker');
102
 
103
  // Only register and enqueue JS scripts from within the plugin itself
104
+ if (preg_match("/product-feed-pro/i",$hook)){
 
 
 
 
 
 
 
 
105
  // Bootstrap typeahead
106
+ wp_register_script( 'typeahead-js', plugin_dir_url( __FILE__ ) . 'js/woosea_typeahead.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
107
  wp_enqueue_script( 'typeahead-js' );
108
 
109
  // JS for adding input field validation
110
+ wp_register_script( 'woosea_validation-js', plugin_dir_url( __FILE__ ) . 'js/woosea_validation.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
111
  wp_enqueue_script( 'woosea_validation-js' );
112
 
113
  // JS for autocomplete
115
  wp_enqueue_script( 'woosea_autocomplete-js' );
116
 
117
  // JS for adding table rows to the rules page
118
+ wp_register_script( 'woosea_rules-js', plugin_dir_url( __FILE__ ) . 'js/woosea_rules.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
119
  wp_enqueue_script( 'woosea_rules-js' );
120
 
121
  // JS for adding table rows to the field mappings page
130
  wp_register_script( 'woosea_key-js', plugin_dir_url( __FILE__ ) . 'js/woosea_key.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
131
  wp_enqueue_script( 'woosea_key-js' );
132
 
133
+ // JS for managing addToCart event
134
+ // wp_register_script( 'woosea_addcart-js', plugin_dir_url( __FILE__ ) . 'js/woosea_add_cart.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
135
+ // wp_enqueue_script( 'woosea_addcart-js' );
136
  }
137
  // JS for manage projects page
138
+ wp_register_script( 'woosea_manage-js', plugin_dir_url( __FILE__ ) . 'js/woosea_manage.js?yo=12', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
139
  wp_enqueue_script( 'woosea_manage-js' );
140
  }
141
  add_action( 'admin_enqueue_scripts' , 'woosea_scripts' );
142
 
143
  /**
144
+ * Enqueue front end scripts
145
  */
146
+ function woosea_fe_scripts($hook) {
147
+ // JS for managing addToCart event
148
+ wp_enqueue_script( 'ajax-script', get_template_directory_uri() . 'js/my-ajax-script.js', array('jquery') );
149
+ wp_register_script( 'woosea_addcart-js', plugin_dir_url( __FILE__ ) . 'js/woosea_add_cart.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
150
+ wp_enqueue_script( 'woosea_addcart-js' );
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  }
152
+ //add_action('wp_enqueue_scripts', 'woosea_fe_scripts');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  /**
155
  * Internationalisation of plugin
156
  */
157
  function woosea_load_plugin_textdomain() {
158
+ load_plugin_textdomain( 'woo-product-feed-pro', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
159
  }
160
  add_action( 'plugins_loaded', 'woosea_load_plugin_textdomain' );
161
 
202
  /**
203
  * Get category path for Facebook pixel
204
  */
205
+ function woosea_get_term_parents( $id, $taxonomy, $project_taxonomy, $link = false, $nicename = false, $visited = array() ) {
206
  // Only add Home to the beginning of the chain when we start buildin the chain
207
  if(empty($visited)){
208
  $chain = 'Home';
225
 
226
  if ($parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited, TRUE )){
227
  $visited[] = $parent->parent;
228
+ $chain .= woosea_get_term_parents( $parent->parent, $taxonomy, $separator, $link = false, $nicename, $visited );
229
  }
230
 
231
  if ($link){
237
  return $chain;
238
  }
239
 
 
240
  /**
241
  * Add Facebook pixel
242
  */
243
  function woosea_add_facebook_pixel( $product = null ){
244
+ if ( ! is_object( $product ) ) {
245
  global $product;
246
  }
247
  $fb_pagetype = WooSEA_Google_Remarketing::woosea_google_remarketing_pagetype();
248
  $add_facebook_pixel = get_option ('add_facebook_pixel');
249
+ $add_facebook_capi = get_option ('add_facebook_capi');
250
+ $viewContent = "";
251
+ $event_id = uniqid (rand (),true);
252
  $currency = get_woocommerce_currency();
253
+
254
  if($add_facebook_pixel == "yes"){
255
  $facebook_pixel_id = get_option("woosea_facebook_pixel_id");
256
+ $facebook_capi_token = get_option("woosea_facebook_capi_token");
257
+
258
+ // Add vulnerability check
259
+ if(!is_numeric($facebook_pixel_id)){
260
+ unset($facebook_pixel_id);
261
+ }
262
+
263
+ if(isset($facebook_pixel_id) AND ($facebook_pixel_id > 0)){
264
+ // Set Facebook conversion API data
265
+ define('FACEBOOK_APP_ACCESS_TOKEN', $facebook_capi_token);
266
+ define('FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID', $facebook_pixel_id);
267
+ $fb_capi_data["match_keys"] = array();
268
+ $fb_capi_data["event_time"] = time();
269
+ $fb_capi_data["event_id"] = $event_id;
270
+ $fb_capi_data["user_data"]["client_ip_address"] = WC_Geolocation::get_ip_address();
271
+ $fb_capi_data["user_data"]["client_user_agent"] = $_SERVER['HTTP_USER_AGENT'];
272
+ $fb_capi_data["action_source"] = "website";
273
+ $fb_capi_data["event_source_url"] = home_url($_SERVER['REQUEST_URI']);
274
 
 
275
  if ($fb_pagetype == "product"){
276
  if ( '' !== $product->get_price()) {
277
 
278
  $fb_prodid = get_the_id();
279
  $product_name = $product->get_name();
280
+ $product_name = str_replace("\"","",$product_name);
281
+ $product_name = str_replace("'","",$product_name);
282
+
283
  $cats = "";
284
  $all_cats = get_the_terms( $fb_prodid, 'product_cat' );
285
  if(!empty($all_cats)){
290
  // strip last comma
291
  $cats = rtrim($cats, ",");
292
  $cats = str_replace("&amp;","&", $cats);
293
+ $cats = str_replace("\"","",$cats);
294
+ $cats = str_replace("'","",$cats);
295
 
296
  if(!empty($fb_prodid)){
 
297
  if(!$product) {
298
  return -1;
299
  }
302
  // We should first check if there are any _GET parameters available
303
  // When there are not we are on a variable product page but not on a specific variable one
304
  // In that case we need to put in the AggregateOffer structured data
305
+ $variation_id = woosea_find_matching_product_variation( $product, sanitize_text_field($_GET) );
306
 
307
  $nr_get = count($_GET);
308
 
330
  $fb_price = $fb_lowprice;
331
  }
332
  }
333
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
334
+ $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"},{eventID:\"$event_id\"});";
335
+
336
+ // Facebook CAPI data
337
+ $fb_capi_data["event_name"] = "ViewContent";
338
+ $fb_capi_data["custom_data"]["content_ids"] = $fb_prodid;
339
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
340
+ $fb_capi_data["custom_data"]["content_category"] = $cats;
341
+ $fb_capi_data["custom_data"]["currency"] = $currency;
342
+ $fb_capi_data["custom_data"]["value"] = $fb_price;
343
+ $fb_capi_data["custom_data"]["content_type"] = "product";
344
  } else {
345
  // This is a parent variable product
346
  // Since these are not allowed in the feed, at the variations product ID's
371
  $fb_highprice = wc_format_localized_price( $highest );
372
  $fb_price = $fb_lowprice;
373
  }
374
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
375
+ $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product_group\", content_ids:[$content], value:\"$fb_price\", currency:\"$currency\"},{eventID:\"$event_id\"});";
376
+
377
+ // Facebook CAPI data
378
+ $fb_capi_data["event_name"] = "ViewContent";
379
+ $fb_capi_data["custom_data"]["content_ids"] = $fb_prodid;
380
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
381
+ $fb_capi_data["custom_data"]["content_category"] = $cats;
382
+ $fb_capi_data["custom_data"]["currency"] = $currency;
383
+ $fb_capi_data["custom_data"]["value"] = $fb_price;
384
+ $fb_capi_data["custom_data"]["content_type"] = "product_group";
385
  }
386
  } else {
387
  // This is a simple product page
388
+ $fb_price = wc_format_localized_price( $product->get_price() );
389
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
390
+ $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"},{eventID:\"$event_id\"});";
391
+
392
+ // Facebook CAPI data
393
+ $fb_capi_data["event_name"] = "ViewContent";
394
+ $fb_capi_data["custom_data"]["content_ids"] = $fb_prodid;
395
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
396
+ $fb_capi_data["custom_data"]["content_category"] = $cats;
397
+ $fb_capi_data["custom_data"]["currency"] = $currency;
398
+ $fb_capi_data["custom_data"]["value"] = $fb_price;
399
+ $fb_capi_data["custom_data"]["content_type"] = "product";
400
  }
401
  }
402
  }
409
  $order = wc_get_order( $order_id );
410
  $order_items = $order->get_items();
411
  $currency = get_woocommerce_currency();
 
412
  $contents = "";
413
+ $order_real = wc_format_localized_price($order->get_total());
414
 
415
  if ( !is_wp_error( $order_items )) {
416
  foreach( $order_items as $item_id => $order_item) {
419
  if($variation_id > 0){
420
  $prod_id = $variation_id;
421
  }
 
422
  $prod_quantity = $order_item->get_quantity();
 
 
 
 
 
423
  $contents .= "{'id': '$prod_id', 'quantity': $prod_quantity},";
424
  }
425
  }
426
  $contents = rtrim($contents, ",");
427
+ $order_real = floatval(str_replace(',', '.', str_replace(',', '.', $order_real)));
428
+ $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$order_real', content_type:'product', contents:[$contents]},{eventID:\"$event_id\"});";
429
+
430
+ // Facebook CAPI data
431
+ $fb_capi_data["event_name"] = "Purchase";
432
+ $fb_capi_data["custom_data"]["content_ids"] = $prod_id;
433
+ $fb_capi_data["custom_data"]["currency"] = $currency;
434
+ $fb_capi_data["custom_data"]["value"] = $order_real;
435
+ $fb_capi_data["custom_data"]["content_type"] = "product";
436
  }
437
  } else {
438
  // This is on the cart page itself
439
  $currency = get_woocommerce_currency();
440
  $cart_items = WC()->cart->get_cart();
441
+ $cart_quantity = count($cart_items);
442
+
443
  $cart_real = 0;
444
  $contents = "";
445
 
446
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
447
+ $cart_total_amount = floatval(str_replace(',', '.', str_replace(',', '.', $cart_total_amount)));
448
+
449
  $checkoutpage = wc_get_checkout_url();
450
  $current_url = get_permalink(get_the_ID());
451
 
453
  if( !is_wp_error( $cart_items )) {
454
  foreach( $cart_items as $cart_id => $cart_item) {
455
  $prod_id = $cart_item['product_id'];
456
+ $product = $cart_item['data'];
457
+ $product_name = $product->get_name();
458
  if($cart_item['variation_id'] > 0){
459
  $prod_id = $cart_item['variation_id'];
460
  }
462
  //$contents .= "$prod_id,";
463
 
464
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
 
 
 
 
 
465
  }
466
  $contents = rtrim($contents, ",");
467
 
468
  // User is on the billing pages
469
  if($checkoutpage == $current_url){
470
+ $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]},{eventID:\"$event_id\"});";
471
+
472
+ // Facebook CAPI data
473
+ $fb_capi_data["event_name"] = "InitiateCheckout";
474
+ $fb_capi_data["custom_data"]["content_ids"] = $contents;
475
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
476
+ $fb_capi_data["custom_data"]["currency"] = $currency;
477
+ $fb_capi_data["custom_data"]["value"] = $cart_total_amount;
478
+ $fb_capi_data["custom_data"]["content_type"] = "product";
479
  } else {
480
  // User is on the basket page
481
+ $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]},{eventID:\"$event_id\"});";
482
+
483
+ // Facebook CAPI data
484
+ $fb_capi_data["event_name"] = "AddToCart";
485
+ $fb_capi_data["custom_data"]["content_ids"] = $contents;
486
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
487
+ $fb_capi_data["custom_data"]["currency"] = $currency;
488
+ $fb_capi_data["custom_data"]["value"] = $cart_total_amount;
489
+ $fb_capi_data["custom_data"]["content_type"] = "product";
490
  }
491
  }
492
  }
519
  }
520
  $fb_prodid = rtrim($fb_prodid, ",");
521
  $category_name = $term->name;
522
+ $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $project_taxonomy = false, $link = false, $nicename = false, $visited = array() );
523
+ $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:'$category_path', content_name:'$category_name', content_type:\"product\", content_ids:\"[$fb_prodid]\"},{eventID:\"$event_id\"});";
524
+
525
+ // Facebook CAPI data
526
+ $fb_capi_data["event_name"] = "ViewCategory";
527
+ $fb_capi_data["custom_data"]["content_ids"] = $ids;
528
+ $fb_capi_data["custom_data"]["content_type"] = "product";
529
+
530
  } elseif ($fb_pagetype == "searchresults"){
531
  $term = get_queried_object();
532
  $search_string = sanitize_text_field($_GET['s']);
555
  }
556
  }
557
  $fb_prodid = rtrim($fb_prodid, ",");
558
+ $viewContent = "fbq(\"trackCustom\",\"Search\",{search_string:\"$search_string\", content_type:\"product\", content_ids:\"[$fb_prodid]\"},{eventID:\"$event_id\"});";
559
+
560
+ // Facebook CAPI data
561
+ $fb_capi_data["event_name"] = "Search";
562
+ $fb_capi_data["custom_data"]["content_ids"] = $ids;
563
+ $fb_capi_data["custom_data"]["content_type"] = "product";
564
  } else {
565
  // This is another page than a product page
566
+ $fb_capi_data["event_name"] = "ViewContent";
567
  $viewContent = "";
568
  }
569
  ?>
582
  t.src=v;s=b.getElementsByTagName(e)[0];
583
  s.parentNode.insertBefore(t,s)}(window, document,'script',
584
  'https://connect.facebook.net/en_US/fbevents.js');
585
+
586
+ fbq("init", "<?php echo htmlentities($facebook_pixel_id, ENT_QUOTES, 'UTF-8');?>");
587
  fbq("track", "PageView");
588
  <?php
589
  if(strlen($viewContent) > 2){
592
  ?>
593
  </script>
594
  <noscript>
595
+ <img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=<?php echo htmlentities($facebook_pixel_id, ENT_QUOTES, 'UTF-8');;?>&ev=PageView&noscript=1&eid=<?php print"$event_id";?>"/>
596
  </noscript>
597
  <!-- End Facebook Pixel Code -->
598
  <?php
599
+
600
+ // POST data to Facebook Conversion API
601
+ if(($add_facebook_capi == "yes") AND (!empty($facebook_capi_token))){
602
+ // Turn Data to JSON
603
+ $data_json = json_encode(array($fb_capi_data));
604
+
605
+ // Fill available fields
606
+ $fields = array();
607
+ $fields['access_token'] = FACEBOOK_APP_ACCESS_TOKEN;
608
+ $fields['upload_tag'] = $fb_capi_data["event_name"] . '-' . time(); // You should set a tag here (feel free to adjust)
609
+ $fields['data'] = $data_json;
610
+ $url = 'https://graph.facebook.com/v11.0/' . FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID . '/events';
611
+
612
+ $args = array(
613
+ 'timeout' => 30,
614
+ 'redirection' => 10,
615
+ 'httpversion' => '1.0',
616
+ 'blocking' => true,
617
+ 'headers' => array(
618
+ "cache-control: no-cache",
619
+ "Accept: application/json"
620
+ ),
621
+ 'body' => $fields,
622
+ 'cookies' => array()
623
+ );
624
+ $response = wp_remote_post( $url, $args );
625
+ }
626
  }
627
  }
628
  }
637
  }
638
  $ecomm_pagetype = WooSEA_Google_Remarketing::woosea_google_remarketing_pagetype();
639
  $add_remarketing = get_option ('add_remarketing');
640
+
641
  if($add_remarketing == "yes"){
642
  $adwords_conversion_id = get_option("woosea_adwords_conversion_id");
643
+ // Add vulnerability check, unset when no proper comversion ID was inserted
644
+ if(!is_numeric($adwords_conversion_id)){
645
+ unset($adwords_conversion_id);
646
+ }
647
 
648
  if($adwords_conversion_id > 0){
649
+ ?>
650
+ <!-- Global site tag (gtag.js) - Google Ads: <?php echo htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?> - Added by the Product Feed Pro plugin from AdTribes.io -->
651
+ <script async src="https://www.googletagmanager.com/gtag/js?id=AW-<?php echo htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>"></script>
652
+ <script>
653
+ window.dataLayer = window.dataLayer || [];
654
+ function gtag(){dataLayer.push(arguments);}
655
+ gtag('js', new Date());
656
+
657
+ gtag('config', '<?php echo 'AW-'.htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>');
658
+ </script>
659
+ <?php
660
  if ($ecomm_pagetype == "product"){
661
  if ( '' !== $product->get_price()) {
662
  $ecomm_prodid = get_the_id();
671
  // We should first check if there are any _GET parameters available
672
  // When there are not we are on a variable product page but not on a specific variable one
673
  // In that case we need to put in the AggregateOffer structured data
674
+ $variation_id = woosea_find_matching_product_variation( $product, sanitize_text_field($_GET) );
675
  $nr_get = count($_GET);
676
+
677
  if($nr_get > 0){
678
  $variable_product = wc_get_product($variation_id);
679
 
710
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
711
  } else {
712
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
713
+ $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
714
+ $ecomm_price = $ecomm_lowprice;
715
+
716
  }
717
  }
718
  } else {
719
  $ecomm_price = wc_format_decimal( $product->get_price(), wc_get_price_decimals() );
720
  }
721
  }
722
+ if( isset($ecomm_price) ){
723
+ ?>
724
+ <script>
725
+ gtag('event', 'view_item', {
726
+ 'send_to' : '<?php echo 'AW-'.htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>',
727
+ 'value' : <?php print "$ecomm_price";?>,
728
+ 'items' : [{
729
+ 'id': <?php print "$ecomm_prodid";?>,
730
+ 'google_business_vertical': 'retail'
731
+ }]
732
+ });
733
+ </script>
734
+ <?php
735
+ }
736
  }
737
  } elseif ($ecomm_pagetype == "cart"){
738
+ // This is on the order thank you page
739
+ if( isset( $_GET['key'] ) && is_wc_endpoint_url( 'order-received' ) ) {
740
+ $order_string = sanitize_text_field($_GET['key']);
741
+ if(!empty($order_string)){
742
+ $order_id = wc_get_order_id_by_order_key( $order_string );
743
+ $order = wc_get_order( $order_id );
744
+ $order_items = $order->get_items();
745
+ $currency = get_woocommerce_currency();
746
+ $contents = "";
747
+ $order_real = wc_format_localized_price($order->get_total());
748
+
749
+ if ( !is_wp_error( $order_items )) {
750
+ foreach( $order_items as $item_id => $order_item) {
751
+ $prod_id = $order_item->get_product_id();
752
+ $variation_id = $order_item->get_variation_id();
753
+ if($variation_id > 0){
754
+ $prod_id = $variation_id;
755
+ }
756
+ $prod_quantity = $order_item->get_quantity();
757
+ }
758
+ }
759
+ $order_real = floatval(str_replace(',', '.', str_replace(',', '.', $order_real)));
760
+ ?>
761
+ <script>
762
+ gtag('event', 'purchase', {
763
+ 'send_to' : '<?php echo 'AW-'.htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>',
764
+ 'value' : <?php print "$order_real";?>,
765
+ 'items' : [{
766
+ 'id': <?php print "$prod_id";?>,
767
+ 'google_business_vertical': 'retail'
768
+ }]
769
+ });
770
+ </script>
771
+ <?php
772
+ }
773
+ } else {
774
+ // This is on the cart page, no purchase yet
775
+ // Get the first product from cart and use that product ID
776
+ foreach( WC()->cart->get_cart() as $cart_item ){
777
+ $ecomm_prodid = $cart_item['product_id'];
778
+ break;
779
+ }
780
+
781
+ if( isset($ecomm_prodid) ){
782
+ $currency = get_woocommerce_currency();
783
+ $cart_items = WC()->cart->get_cart();
784
+ $cart_quantity = count($cart_items);
785
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total()+WC()->cart->tax_total);
786
+ $cart_total_amount = floatval(str_replace(',', '.', str_replace(',', '.', $cart_total_amount)));
787
+ ?>
788
+ <script>
789
+ gtag('event', 'add_to_cart', {
790
+ 'send_to' : '<?php echo 'AW-'.htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>',
791
+ 'value' : <?php print "$cart_total_amount";?>,
792
+ 'items' : [{
793
+ 'id': <?php print "$ecomm_prodid";?>,
794
+ 'google_business_vertical': 'retail'
795
+ }]
796
+ });
797
+ </script>
798
+ <?php
799
+ }
800
+ }
801
+ }
802
  }
803
  }
804
  }
884
  }
885
  add_action('admin_notices', 'woosea_request_review');
886
 
887
+
888
  /**
889
  * Create a seperate MySql table for saving conversion information
890
  */
957
  * Gets all attributes, product, image and attributes
958
  */
959
  function woosea_ajax() {
960
+ check_ajax_referer('woosea_ajax_nonce', 'security');
961
  $rowCount = sanitize_text_field($_POST['rowCount']);
962
 
963
  $attributes_dropdown = get_option('attributes_dropdown');
1010
  }
1011
  add_action( 'wp_ajax_woosea_categories_dropdown', 'woosea_categories_dropdown' );
1012
 
1013
+ /**
1014
+ * Sanitize XSS
1015
+ */
1016
+ function woosea_sanitize_xss($value) {
1017
+ return htmlspecialchars(strip_tags($value));
1018
+ }
1019
+
1020
+ /**
1021
+ * Recursive sanitation for an array
1022
+ */
1023
+ function woosea_recursive_sanitize_text_field($array) {
1024
+ foreach ( $array as $key => &$value ) {
1025
+ if ( is_array( $value ) ) {
1026
+ $value = woosea_recursive_sanitize_text_field( $value );
1027
+ }
1028
+ else {
1029
+ $value = sanitize_text_field( $value );
1030
+ }
1031
+ }
1032
+ return $array;
1033
+ }
1034
+
1035
  /**
1036
  * Save Google Dynamic Remarketing Conversion Tracking ID
1037
  */
1038
  function woosea_save_adwords_conversion_id() {
1039
+ check_ajax_referer('woosea_ajax_nonce', 'security');
1040
  $adwords_conversion_id = sanitize_text_field($_POST['adwords_conversion_id']);
1041
+ $adwords_conversion_id = woosea_sanitize_xss($adwords_conversion_id);
1042
  update_option("woosea_adwords_conversion_id", $adwords_conversion_id);
1043
  }
1044
  add_action( 'wp_ajax_woosea_save_adwords_conversion_id', 'woosea_save_adwords_conversion_id' );
1047
  * Save batch size
1048
  */
1049
  function woosea_save_batch_size() {
1050
+ check_ajax_referer('woosea_ajax_nonce', 'security');
1051
  $batch_size = sanitize_text_field($_POST['batch_size']);
1052
  update_option("woosea_batch_size", $batch_size);
1053
  }
1057
  * Save Facebook Pixel ID
1058
  */
1059
  function woosea_save_facebook_pixel_id() {
1060
+ check_ajax_referer('woosea_ajax_nonce', 'security');
1061
  $facebook_pixel_id = sanitize_text_field($_POST['facebook_pixel_id']);
1062
+ $facebook_pixel_id = woosea_sanitize_xss($facebook_pixel_id);
1063
  update_option("woosea_facebook_pixel_id", $facebook_pixel_id);
1064
  }
1065
  add_action( 'wp_ajax_woosea_save_facebook_pixel_id', 'woosea_save_facebook_pixel_id' );
1066
 
1067
+ /**
1068
+ * Save Facebook Conversion API Token
1069
+ */
1070
+ function woosea_save_facebook_capi_token() {
1071
+ check_ajax_referer('woosea_ajax_nonce', 'security');
1072
+ $facebook_capi_token = sanitize_text_field($_POST['facebook_capi_token']);
1073
+ $facebook_capi_token = woosea_sanitize_xss($facebook_capi_token);
1074
+ update_option("woosea_facebook_capi_token", $facebook_capi_token);
1075
+ }
1076
+ add_action( 'wp_ajax_woosea_save_facebook_capi_token', 'woosea_save_facebook_capi_token' );
1077
+
1078
  /**
1079
  * Mass map categories to the correct Google Shopping category taxonomy
1080
  */
1081
  function woosea_add_mass_cat_mapping(){
1082
+ check_ajax_referer('woosea_ajax_nonce', 'security');
1083
  $project_hash = sanitize_text_field($_POST['project_hash']);
1084
+ $catMappings = woosea_recursive_sanitize_text_field($_POST['catMappings']);
1085
+
1086
  // I need to sanitize the catMappings Array
1087
  $mappings = array();
1088
  foreach ($catMappings as $mKey => $mVal){
1137
  $className = sanitize_text_field($_POST['className']);
1138
  $map_to_category = sanitize_text_field($_POST['map_to_category']);
1139
  $project_hash = sanitize_text_field($_POST['project_hash']);
1140
+ $criteria = sanitize_text_field($_POST['criteria']);
1141
 
1142
+ //$criteria = $_POST['criteria'];
1143
  $status_mapping = "false";
1144
  $project = WooSEA_Update_Project::get_project_data(sanitize_text_field($project_hash));
1145
 
1181
  * Retrieve variation product id based on it attributes
1182
  **/
1183
  function woosea_find_matching_product_variation( $product, $attributes ) {
 
 
 
 
 
 
 
 
1184
 
1185
+ if(is_array( $attributes )) {
1186
+ foreach( $attributes as $key => $value ) {
1187
+ if( strpos( $key, 'attribute_' ) === 0 ) {
1188
+ continue;
1189
+ }
1190
+ unset( $attributes[ $key ] );
1191
+ $attributes[ sprintf( 'attribute_%s', $key ) ] = $value;
1192
+ }
1193
+
1194
+ if( class_exists('WC_Data_Store') ) {
1195
+ $data_store = WC_Data_Store::load( 'product' );
1196
+ return $data_store->find_matching_product_variation( $product, $attributes );
1197
+ } else {
1198
+ return $product->get_matching_variation( $attributes );
1199
+ }
1200
+ }
1201
+ }
1202
 
1203
  /**
1204
  * Remove the price from the JSON-LD on variant product pages
1206
  * to disapproved in Google's Merchant center because of it
1207
  */
1208
  function woosea_product_delete_meta_price( $product = null ) {
 
1209
  $markup_offer = array();
1210
  $structured_data_fix = get_option ('structured_data_fix');
1211
 
1265
  $nr_get = count($_GET);
1266
 
1267
  if($nr_get > 0){
 
1268
  $mother_id = wc_get_product()->get_id();
1269
  $children_ids = $product->get_children();
1270
 
1271
  foreach ($children_ids as &$child_val) {
1272
  $product_variations = new WC_Product_Variation( $child_val );
1273
  $variations = array_filter($product_variations->get_variation_attributes());
1274
+ $from_url = str_replace("\\","",sanitize_text_field($_GET),$i);
1275
  $intersect = array_intersect($from_url, $variations);
1276
  if($variations == $intersect){
1277
  $variation_id = $child_val;
1609
  foreach ($children_ids as &$child_val) {
1610
  $product_variations = new WC_Product_Variation( $child_val );
1611
  $variations = array_filter($product_variations->get_variation_attributes());
1612
+ $from_url = str_replace("\\","",sanitize_text_field($_GET),$i);
1613
+ $intersect = @array_intersect($from_url, $variations);
1614
  if($variations == $intersect){
1615
  $variation_id = $child_val;
1616
  }
1640
  $brand = get_post_meta( $variation_id, '_woosea_brand', true );
1641
  if ( $brand ) {
1642
  $markup['brand'] = array (
1643
+ '@type' => 'Brand',
1644
  'name' => $brand,
1645
  );
1646
  }
1743
 
1744
  if ( $brand ) {
1745
  $markup['brand'] = array (
1746
+ '@type' => 'Brand',
1747
  'name' => $brand,
1748
  );
1749
  }
2192
  * Add or remove custom attributes to the feed configuration drop-downs
2193
  */
2194
  function woosea_add_attributes() {
2195
+ check_ajax_referer( 'woosea_ajax_nonce', 'security' );
2196
+
2197
  $attribute_name = sanitize_text_field($_POST['attribute_name']);
2198
  $attribute_value = sanitize_text_field($_POST['attribute_value']);
2199
  $active = sanitize_text_field($_POST['active']);
2408
  }
2409
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2410
 
2411
+ /**
2412
+ * This function enables the setting to remove
2413
+ * free shipping zones
2414
+ */
2415
+ function woosea_remove_free_shipping (){
2416
+ $status = sanitize_text_field($_POST['status']);
2417
+
2418
+ if ($status == "off"){
2419
+ update_option( 'remove_free_shipping', 'no', 'yes');
2420
+ } else {
2421
+ update_option( 'remove_free_shipping', 'yes', 'yes');
2422
+ }
2423
+ }
2424
+ add_action( 'wp_ajax_woosea_remove_free_shipping', 'woosea_remove_free_shipping' );
2425
+
2426
  /**
2427
  * This function enables the setting to use
2428
  * logging
2439
  add_action( 'wp_ajax_woosea_add_woosea_logging', 'woosea_add_woosea_logging' );
2440
 
2441
  /**
2442
+ * This function enables the setting to add CDATA to title and descriptions
 
2443
  */
2444
+ function woosea_add_woosea_cdata (){
2445
  $status = sanitize_text_field($_POST['status']);
2446
 
2447
  if ($status == "off"){
2448
+ update_option( 'add_woosea_cdata', 'no', 'yes');
2449
  } else {
2450
+ update_option( 'add_woosea_cdata', 'yes', 'yes');
2451
  }
2452
  }
2453
+ add_action( 'wp_ajax_woosea_add_woosea_cdata', 'woosea_add_woosea_cdata' );
2454
+
2455
+ /**
2456
+ * This function enables the setting to add
2457
+ * the Faceook pixel
2458
+ */
2459
+ function woosea_add_facebook_pixel_setting (){
2460
+ check_ajax_referer('woosea_ajax_nonce', 'security');
2461
+ $status = sanitize_text_field($_POST['status']);
2462
+
2463
+ // Only admin users are allowed to make changes that impact the front-end
2464
+ $user = wp_get_current_user();
2465
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2466
+ if ($status == "off"){
2467
+ update_option( 'add_facebook_pixel', 'no', 'yes');
2468
+ } else {
2469
+ update_option( 'add_facebook_pixel', 'yes', 'yes');
2470
+ }
2471
+ }
2472
+ }
2473
  add_action( 'wp_ajax_woosea_add_facebook_pixel_setting', 'woosea_add_facebook_pixel_setting' );
2474
 
2475
+ /**
2476
+ * This function enables the setting to enable
2477
+ * the Faceook Conversion API (CAPI)
2478
+ */
2479
+ function woosea_add_facebook_capi_setting (){
2480
+ check_ajax_referer('woosea_ajax_nonce', 'security');
2481
+ $status = sanitize_text_field($_POST['status']);
2482
+
2483
+ // Only admin users are allowed to make changes that impact the front-end
2484
+ $user = wp_get_current_user();
2485
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2486
+ if ($status == "off"){
2487
+ update_option( 'add_facebook_capi', 'no', 'yes');
2488
+ } else {
2489
+ update_option( 'add_facebook_capi', 'yes', 'yes');
2490
+ }
2491
+ }
2492
+ }
2493
+ add_action( 'wp_ajax_woosea_add_facebook_capi_setting', 'woosea_add_facebook_capi_setting' );
2494
+
2495
  /**
2496
  * This function saves the value that needs to be used in the Facebook pixel content_ids parameter
2497
  */
2511
  * Google's Dynamic Remarketing
2512
  */
2513
  function woosea_add_remarketing (){
2514
+ check_ajax_referer('woosea_ajax_nonce', 'security');
2515
+ $status = sanitize_text_field($_POST['status']);
2516
+
2517
+ // Only admin users are allowed to make changes that impact the front-end
2518
+ $user = wp_get_current_user();
2519
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2520
+ if ($status == "off"){
2521
+ update_option( 'add_remarketing', 'no', 'yes');
2522
+ } else {
2523
+ update_option( 'add_remarketing', 'yes', 'yes');
2524
+ }
2525
+ }
2526
  }
2527
  add_action( 'wp_ajax_woosea_add_remarketing', 'woosea_add_remarketing' );
2528
 
2533
  function woosea_add_batch (){
2534
  $status = sanitize_text_field($_POST['status']);
2535
 
2536
+ // Only admin users are allowed to make changes that impact the performance
2537
+ $user = wp_get_current_user();
2538
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2539
+ if ($status == "off"){
2540
+ update_option( 'add_batch', 'no', 'yes');
2541
+ } else {
2542
+ update_option( 'add_batch', 'yes', 'yes');
2543
+ }
2544
  }
2545
  }
2546
  add_action( 'wp_ajax_woosea_add_batch', 'woosea_add_batch' );
2579
  woocommerce_wp_text_input(
2580
  array(
2581
  'id' => '_woosea_brand',
2582
+ 'label' => __( 'Brand', 'woo-product-feed-pro' ),
2583
  'desc_tip' => 'true',
2584
  'value' => get_post_meta( $post->ID, '_woosea_brand', true ),
2585
+ 'description' => __( 'Enter the product Brand here.', 'woo-product-feed-pro' )
2586
  )
2587
  );
2588
  }
2595
  woocommerce_wp_text_input(
2596
  array(
2597
  'id' => '_woosea_gtin',
2598
+ 'label' => __( 'GTIN', 'woo-product-feed-pro' ),
2599
  'desc_tip' => 'true',
2600
+ 'description' => __( 'Enter the product Global Trade Item Number (GTIN) here.', 'woo-product-feed-pro' ),
2601
  )
2602
  );
2603
  }
2607
  woocommerce_wp_text_input(
2608
  array(
2609
  'id' => '_woosea_mpn',
2610
+ 'label' => __( 'MPN', 'woo-product-feed-pro' ),
2611
  'desc_tip' => 'true',
2612
+ 'description' => __( 'Enter the manufacturer product number', 'woo-product-feed-pro' ),
2613
  )
2614
  );
2615
  }
2619
  woocommerce_wp_text_input(
2620
  array(
2621
  'id' => '_woosea_upc',
2622
+ 'label' => __( 'UPC', 'woo-product-feed-pro' ),
2623
  'desc_tip' => 'true',
2624
+ 'description' => __( 'Enter the Universal Product Code (UPC) here.', 'woo-product-feed-pro' ),
2625
  )
2626
  );
2627
  }
2631
  woocommerce_wp_text_input(
2632
  array(
2633
  'id' => '_woosea_ean',
2634
+ 'label' => __( 'EAN', 'woo-product-feed-pro' ),
2635
  'desc_tip' => 'true',
2636
+ 'description' => __( 'Enter the International Article Number (EAN) here.', 'woo-product-feed-pro' ),
2637
  )
2638
  );
2639
  }
2643
  woocommerce_wp_text_input(
2644
  array(
2645
  'id' => '_woosea_optimized_title',
2646
+ 'label' => __( 'Optimized title', 'woo-product-feed-pro' ),
2647
  'desc_tip' => 'true',
2648
+ 'description' => __( 'Enter a optimized product title.', 'woo-product-feed-pro' ),
2649
  )
2650
  );
2651
  }
2655
  woocommerce_wp_select(
2656
  array(
2657
  'id' => '_woosea_condition',
2658
+ 'label' => __( 'Product condition', 'woo-product-feed-pro' ),
2659
  'desc_tip' => 'true',
2660
+ 'description' => __( 'Select the product condition.', 'woo-product-feed-pro' ),
2661
  'options' => array (
2662
+ '' => __( '', 'woo-product-feed-pro' ),
2663
+ 'new' => __( 'new', 'woo-product-feed-pro' ),
2664
+ 'refurbished' => __( 'refurbished', 'woo-product-feed-pro' ),
2665
+ 'used' => __( 'used', 'woo-product-feed-pro' ),
2666
+ 'damaged' => __( 'damaged', 'woo-product-feed-pro' ),
2667
  )
2668
  )
2669
  );
2674
  woocommerce_wp_text_input(
2675
  array(
2676
  'id' => '_woosea_color',
2677
+ 'label' => __( 'Color', 'woo-product-feed-pro' ),
2678
  'desc_tip' => 'true',
2679
+ 'description' => __( 'Insert a color.', 'woo-product-feed-pro' ),
2680
  )
2681
  );
2682
  }
2686
  woocommerce_wp_text_input(
2687
  array(
2688
  'id' => '_woosea_size',
2689
+ 'label' => __( 'Size', 'woo-product-feed-pro' ),
2690
  'desc_tip' => 'true',
2691
+ 'description' => __( 'Insert a size.', 'woo-product-feed-pro' ),
2692
  )
2693
  );
2694
  }
2698
  woocommerce_wp_select(
2699
  array(
2700
  'id' => '_woosea_gender',
2701
+ 'label' => __( 'Gender', 'woo-product-feed-pro' ),
2702
  'desc_tip' => 'true',
2703
+ 'description' => __( 'Select gender.', 'woo-product-feed-pro' ),
2704
  'options' => array (
2705
+ '' => __( '', 'woo-product-feed-pro' ),
2706
+ 'female' => __( 'female', 'woo-product-feed-pro' ),
2707
+ 'male' => __( 'male', 'woo-product-feed-pro' ),
2708
+ 'unisex' => __( 'unisex', 'woo-product-feed-pro' ),
2709
  )
2710
  )
2711
  );
2716
  woocommerce_wp_text_input(
2717
  array(
2718
  'id' => '_woosea_material',
2719
+ 'label' => __( 'Material', 'woo-product-feed-pro' ),
2720
  'desc_tip' => 'true',
2721
+ 'description' => __( 'Enter a material.', 'woo-product-feed-pro' ),
2722
  )
2723
  );
2724
  }
2728
  woocommerce_wp_text_input(
2729
  array(
2730
  'id' => '_woosea_pattern',
2731
+ 'label' => __( 'Pattern', 'woo-product-feed-pro' ),
2732
  'desc_tip' => 'true',
2733
+ 'description' => __( 'Enter a pattern.', 'woo-product-feed-pro' ),
2734
  )
2735
  );
2736
  }
2740
  woocommerce_wp_select(
2741
  array(
2742
  'id' => '_woosea_age_group',
2743
+ 'label' => __( 'Age group', 'woo-product-feed-pro' ),
2744
  'desc_tip' => 'true',
2745
+ 'description' => __( 'Select the product age group.', 'woo-product-feed-pro' ),
2746
  'options' => array (
2747
+ '' => __( '', 'woo-product-feed-pro' ),
2748
+ 'newborn' => __( 'newborn', 'woo-product-feed-pro' ),
2749
+ 'infant' => __( 'infant', 'woo-product-feed-pro' ),
2750
+ 'toddler' => __( 'toddler', 'woo-product-feed-pro' ),
2751
+ 'kids' => __( 'kids', 'woo-product-feed-pro' ),
2752
+ 'adult' => __( 'adult', 'woo-product-feed-pro' ),
2753
  )
2754
  )
2755
  );
2760
  woocommerce_wp_text_input(
2761
  array(
2762
  'id' => '_woosea_unit_pricing_measure',
2763
+ 'label' => __( 'Unit pricing measure', 'woo-product-feed-pro' ),
2764
  'desc_tip' => 'true',
2765
+ 'description' => __( 'Enter an unit pricing measure.', 'woo-product-feed-pro' ),
2766
  )
2767
  );
2768
  }
2772
  woocommerce_wp_text_input(
2773
  array(
2774
  'id' => '_woosea_unit_pricing_base_measure',
2775
+ 'label' => __( 'Unit pricing base measure', 'woo-product-feed-pro' ),
2776
  'desc_tip' => 'true',
2777
+ 'description' => __( 'Enter an unit pricing base measure.', 'woo-product-feed-pro' ),
2778
  )
2779
  );
2780
  }
2784
  woocommerce_wp_text_input(
2785
  array(
2786
  'id' => '_woosea_installment_months',
2787
+ 'label' => __( 'Installment months', 'woo-product-feed-pro' ),
2788
  'desc_tip' => 'true',
2789
+ 'description' => __( 'Enter the number of monthly installments the buyer has to pay.', 'woo-product-feed-pro' ),
2790
  )
2791
  );
2792
  }
2796
  woocommerce_wp_text_input(
2797
  array(
2798
  'id' => '_woosea_installment_amount',
2799
+ 'label' => __( 'Installment amount', 'woo-product-feed-pro' ),
2800
  'desc_tip' => 'true',
2801
+ 'description' => __( 'Enter the amount the bbuyer has to pay per month.', 'woo-product-feed-pro' ),
2802
  )
2803
  );
2804
  }
2808
  woocommerce_wp_text_input(
2809
  array(
2810
  'id' => '_woosea_cost_of_good_sold',
2811
+ 'label' => __( 'Cost of goods sold', 'woo-product-feed-pro' ),
2812
  'desc_tip' => 'true',
2813
+ 'description' => __( 'Enter the cost of good you are selling.', 'woo-product-feed-pro' ),
2814
  )
2815
  );
2816
  }
2820
  woocommerce_wp_text_input(
2821
  array(
2822
  'id' => '_woosea_multipack',
2823
+ 'label' => __( 'Multipack', 'woo-product-feed-pro' ),
2824
  'desc_tip' => 'true',
2825
+ 'description' => __( 'Enter the multipack amount.', 'woo-product-feed-pro' ),
2826
  )
2827
  );
2828
  }
2832
  woocommerce_wp_select(
2833
  array(
2834
  'id' => '_woosea_is_bundle',
2835
+ 'label' => __( 'Is bundle', 'woo-product-feed-pro' ),
2836
  'desc_tip' => 'true',
2837
+ 'description' => __( 'Select the is bundle value.', 'woo-product-feed-pro' ),
2838
  'options' => array (
2839
+ '' => __( '', 'woo-product-feed-pro' ),
2840
+ 'yes' => __( 'yes', 'woo-product-feed-pro' ),
2841
+ 'no' => __( 'no', 'woo-product-feed-pro' ),
2842
  )
2843
  )
2844
  );
2849
  woocommerce_wp_select(
2850
  array(
2851
  'id' => '_woosea_energy_efficiency_class',
2852
+ 'label' => __( 'Energy efficiency class', 'woo-product-feed-pro' ),
2853
  'desc_tip' => 'true',
2854
+ 'description' => __( 'Select the product energy efficiency class.', 'woo-product-feed-pro' ),
2855
  'options' => array (
2856
+ '' => __( '', 'woo-product-feed-pro' ),
2857
+ 'A+++' => __( 'A+++', 'woo-product-feed-pro' ),
2858
+ 'A++' => __( 'A++', 'woo-product-feed-pro' ),
2859
+ 'A+' => __( 'A+', 'woo-product-feed-pro' ),
2860
+ 'A' => __( 'A', 'woo-product-feed-pro' ),
2861
+ 'B' => __( 'B', 'woo-product-feed-pro' ),
2862
+ 'C' => __( 'C', 'woo-product-feed-pro' ),
2863
+ 'D' => __( 'D', 'woo-product-feed-pro' ),
2864
+ 'E' => __( 'E', 'woo-product-feed-pro' ),
2865
+ 'F' => __( 'F', 'woo-product-feed-pro' ),
2866
+ 'G' => __( 'G', 'woo-product-feed-pro' ),
2867
  )
2868
  )
2869
  );
2874
  woocommerce_wp_select(
2875
  array(
2876
  'id' => '_woosea_min_energy_efficiency_class',
2877
+ 'label' => __( 'Minimum energy efficiency class', 'woo-product-feed-pro' ),
2878
  'desc_tip' => 'true',
2879
+ 'description' => __( 'Select the minimum product energy efficiency class.', 'woo-product-feed-pro' ),
2880
  'options' => array (
2881
+ '' => __( '', 'woo-product-feed-pro' ),
2882
+ 'A+++' => __( 'A+++', 'woo-product-feed-pro' ),
2883
+ 'A++' => __( 'A++', 'woo-product-feed-pro' ),
2884
+ 'A+' => __( 'A+', 'woo-product-feed-pro' ),
2885
+ 'A' => __( 'A', 'woo-product-feed-pro' ),
2886
+ 'B' => __( 'B', 'woo-product-feed-pro' ),
2887
+ 'C' => __( 'C', 'woo-product-feed-pro' ),
2888
+ 'D' => __( 'D', 'woo-product-feed-pro' ),
2889
+ 'E' => __( 'E', 'woo-product-feed-pro' ),
2890
+ 'F' => __( 'F', 'woo-product-feed-pro' ),
2891
+ 'G' => __( 'G', 'woo-product-feed-pro' ),
2892
  )
2893
  )
2894
  );
2899
  woocommerce_wp_select(
2900
  array(
2901
  'id' => '_woosea_max_energy_efficiency_class',
2902
+ 'label' => __( 'Maximum energy efficiency class', 'woo-product-feed-pro' ),
2903
  'desc_tip' => 'true',
2904
+ 'description' => __( 'Select the maximum product energy efficiency class.', 'woo-product-feed-pro' ),
2905
  'options' => array (
2906
+ '' => __( '', 'woo-product-feed-pro' ),
2907
+ 'A+++' => __( 'A+++', 'woo-product-feed-pro' ),
2908
+ 'A++' => __( 'A++', 'woo-product-feed-pro' ),
2909
+ 'A+' => __( 'A+', 'woo-product-feed-pro' ),
2910
+ 'A' => __( 'A', 'woo-product-feed-pro' ),
2911
+ 'B' => __( 'B', 'woo-product-feed-pro' ),
2912
+ 'C' => __( 'C', 'woo-product-feed-pro' ),
2913
+ 'D' => __( 'D', 'woo-product-feed-pro' ),
2914
+ 'E' => __( 'E', 'woo-product-feed-pro' ),
2915
+ 'F' => __( 'F', 'woo-product-feed-pro' ),
2916
+ 'G' => __( 'G', 'woo-product-feed-pro' ),
2917
  )
2918
  )
2919
  );
2924
  woocommerce_wp_text_input(
2925
  array(
2926
  'id' => '_woosea_is_promotion',
2927
+ 'label' => __( 'Is promotion', 'woo-product-feed-pro' ),
2928
  'desc_tip' => 'true',
2929
+ 'description' => __( 'Enter your promotion ID.', 'woo-product-feed-pro' ),
2930
  )
2931
  );
2932
  }
2936
  woocommerce_wp_text_input(
2937
  array(
2938
  'id' => '_woosea_custom_field_0',
2939
+ 'label' => __( 'Custom field 0', 'woo-product-feed-pro' ),
2940
  'desc_tip' => 'true',
2941
+ 'description' => __( 'Enter your custom field 0', 'woo-product-feed-pro' ),
2942
  )
2943
  );
2944
  }
2948
  woocommerce_wp_text_input(
2949
  array(
2950
  'id' => '_woosea_custom_field_1',
2951
+ 'label' => __( 'Custom field 1', 'woo-product-feed-pro' ),
2952
  'desc_tip' => 'true',
2953
+ 'description' => __( 'Enter your custom field 1', 'woo-product-feed-pro' ),
2954
  )
2955
  );
2956
  }
2960
  woocommerce_wp_text_input(
2961
  array(
2962
  'id' => '_woosea_custom_field_2',
2963
+ 'label' => __( 'Custom field 2', 'woo-product-feed-pro' ),
2964
  'desc_tip' => 'true',
2965
+ 'description' => __( 'Enter your custom field 2', 'woo-product-feed-pro' ),
2966
  )
2967
  );
2968
  }
2972
  woocommerce_wp_text_input(
2973
  array(
2974
  'id' => '_woosea_custom_field_3',
2975
+ 'label' => __( 'Custom field 3', 'woo-product-feed-pro' ),
2976
  'desc_tip' => 'true',
2977
+ 'description' => __( 'Enter your custom field 3', 'woo-product-feed-pro' ),
2978
  )
2979
  );
2980
  }
2984
  woocommerce_wp_text_input(
2985
  array(
2986
  'id' => '_woosea_custom_field_4',
2987
+ 'label' => __( 'Custom field 4', 'woo-product-feed-pro' ),
2988
  'desc_tip' => 'true',
2989
+ 'description' => __( 'Enter your custom field 4', 'woo-product-feed-pro' ),
2990
  )
2991
  );
2992
  }
2995
  woocommerce_wp_checkbox(
2996
  array(
2997
  'id' => '_woosea_exclude_product',
2998
+ 'label' => __( 'Exclude from feeds', 'woo-product-feed-pro' ),
2999
  'desc_tip' => 'true',
3000
+ 'description' => __( 'Check this box if you want this product to be excluded from product feeds.', 'woo-product-feed-pro' ),
3001
  )
3002
  );
3003
 
3153
  woocommerce_wp_text_input(
3154
  array(
3155
  'id' => '_woosea_variable_brand['.$loop.']',
3156
+ 'label' => __( '<br>Brand', 'woo-product-feed-pro' ),
3157
  'placeholder' => 'Brand',
3158
  'desc_tip' => 'true',
3159
+ 'description' => __( 'Enter the product Brand here.', 'woo-product-feed-pro' ),
3160
  'value' => get_post_meta($variation->ID, '_woosea_brand', true),
3161
  'wrapper_class' => 'form-row-full',
3162
  )
3168
  woocommerce_wp_text_input(
3169
  array(
3170
  'id' => '_woosea_variable_gtin['.$loop.']',
3171
+ 'label' => __( '<br>GTIN', 'woo-product-feed-pro' ),
3172
  'placeholder' => 'GTIN',
3173
  'desc_tip' => 'true',
3174
+ 'description' => __( 'Enter the product GTIN here.', 'woo-product-feed-pro' ),
3175
  'value' => get_post_meta($variation->ID, '_woosea_gtin', true),
3176
  'wrapper_class' => 'form-row-last',
3177
  )
3183
  woocommerce_wp_text_input(
3184
  array(
3185
  'id' => '_woosea_variable_mpn['.$loop.']',
3186
+ 'label' => __( '<br>MPN', 'woo-product-feed-pro' ),
3187
  'placeholder' => 'Manufacturer Product Number',
3188
  'desc_tip' => 'true',
3189
+ 'description' => __( 'Enter the MPN here.', 'woo-product-feed-pro' ),
3190
  'value' => get_post_meta($variation->ID, '_woosea_mpn', true),
3191
  'wrapper_class' => 'form-row-first',
3192
  )
3198
  woocommerce_wp_text_input(
3199
  array(
3200
  'id' => '_woosea_variable_upc['.$loop.']',
3201
+ 'label' => __( '<br>UPC', 'woo-product-feed-pro' ),
3202
  'placeholder' => 'UPC',
3203
  'desc_tip' => 'true',
3204
+ 'description' => __( 'Enter the product UPC here.', 'woo-product-feed-pro' ),
3205
  'value' => get_post_meta($variation->ID, '_woosea_upc', true),
3206
  'wrapper_class' => 'form-row-last',
3207
  )
3213
  woocommerce_wp_text_input(
3214
  array(
3215
  'id' => '_woosea_variable_ean['.$loop.']',
3216
+ 'label' => __( '<br>EAN', 'woo-product-feed-pro' ),
3217
  'placeholder' => 'EAN',
3218
  'desc_tip' => 'true',
3219
+ 'description' => __( 'Enter the product EAN here.', 'woo-product-feed-pro' ),
3220
  'value' => get_post_meta($variation->ID, '_woosea_ean', true),
3221
  'wrapper_class' => 'form-row-first',
3222
  )
3228
  woocommerce_wp_text_input(
3229
  array(
3230
  'id' => '_woosea_variable_color['.$loop.']',
3231
+ 'label' => __( '<br>Color', 'woo-product-feed-pro' ),
3232
  'placeholder' => 'Color',
3233
  'desc_tip' => 'true',
3234
+ 'description' => __( 'Enter the product Color here.', 'woo-product-feed-pro' ),
3235
  'value' => get_post_meta($variation->ID, '_woosea_color', true),
3236
  'wrapper_class' => 'form-row-first',
3237
  )
3243
  woocommerce_wp_text_input(
3244
  array(
3245
  'id' => '_woosea_variable_size['.$loop.']',
3246
+ 'label' => __( '<br>Size', 'woo-product-feed-pro' ),
3247
  'placeholder' => 'Size',
3248
  'desc_tip' => 'true',
3249
+ 'description' => __( 'Enter the product Size here.', 'woo-product-feed-pro' ),
3250
  'value' => get_post_meta($variation->ID, '_woosea_size', true),
3251
  'wrapper_class' => 'form-row-first',
3252
  )
3258
  woocommerce_wp_select(
3259
  array(
3260
  'id' => '_woosea_gender['.$loop.']',
3261
+ 'label' => __( 'Gender', 'woo-product-feed-pro' ),
3262
  'placeholder' => 'Gender',
3263
  'desc_tip' => 'true',
3264
+ 'description' => __( 'Select the gender.', 'woo-product-feed-pro' ),
3265
  'value' => get_post_meta($variation->ID, '_woosea_gender', true),
3266
  'wrapper_class' => 'form-row form-row-full',
3267
  'options' => array (
3268
+ '' => __( '', 'woo-product-feed-pro' ),
3269
+ 'female' => __( 'female', 'woo-product-feed-pro' ),
3270
+ 'male' => __( 'male', 'woo-product-feed-pro' ),
3271
+ 'unisex' => __( 'unisex', 'woo-product-feed-pro' ),
3272
  )
3273
  )
3274
  );
3279
  woocommerce_wp_text_input(
3280
  array(
3281
  'id' => '_woosea_variable_material['.$loop.']',
3282
+ 'label' => __( '<br>Material', 'woo-product-feed-pro' ),
3283
  'placeholder' => 'Material',
3284
  'desc_tip' => 'true',
3285
+ 'description' => __( 'Enter the product Material here.', 'woo-product-feed-pro' ),
3286
  'value' => get_post_meta($variation->ID, '_woosea_material', true),
3287
  'wrapper_class' => 'form-row-first',
3288
  )
3294
  woocommerce_wp_text_input(
3295
  array(
3296
  'id' => '_woosea_variable_pattern['.$loop.']',
3297
+ 'label' => __( '<br>Pattern', 'woo-product-feed-pro' ),
3298
  'placeholder' => 'Pattern',
3299
  'desc_tip' => 'true',
3300
+ 'description' => __( 'Enter the product Pattern here.', 'woo-product-feed-pro' ),
3301
  'value' => get_post_meta($variation->ID, '_woosea_pattern', true),
3302
  'wrapper_class' => 'form-row-first',
3303
  )
3309
  woocommerce_wp_text_input(
3310
  array(
3311
  'id' => '_woosea_variable_unit_pricing_measure['.$loop.']',
3312
+ 'label' => __( '<br>Unit pricing measure', 'woo-product-feed-pro' ),
3313
  'placeholder' => 'Unit pricing measure',
3314
  'desc_tip' => 'true',
3315
+ 'description' => __( 'Enter the product Unit pricing measure here.', 'woo-product-feed-pro' ),
3316
  'value' => get_post_meta($variation->ID, '_woosea_unit_pricing_measure', true),
3317
  'wrapper_class' => 'form-row-first',
3318
  )
3324
  woocommerce_wp_text_input(
3325
  array(
3326
  'id' => '_woosea_variable_unit_pricing_base_measure['.$loop.']',
3327
+ 'label' => __( '<br>Unit pricing base measure', 'woo-product-feed-pro' ),
3328
  'placeholder' => 'Unit pricing base measure',
3329
  'desc_tip' => 'true',
3330
+ 'description' => __( 'Enter the product Unit pricing base measure here.', 'woo-product-feed-pro' ),
3331
  'value' => get_post_meta($variation->ID, '_woosea_unit_pricing_base_measure', true),
3332
  'wrapper_class' => 'form-row-first',
3333
  )
3339
  woocommerce_wp_text_input(
3340
  array(
3341
  'id' => '_woosea_optimized_title['.$loop.']',
3342
+ 'label' => __( '<br>Optimized title', 'woo-product-feed-pro' ),
3343
  'placeholder' => 'Optimized title',
3344
  'desc_tip' => 'true',
3345
+ 'description' => __( 'Enter a optimized product title here.', 'woo-product-feed-pro' ),
3346
  'value' => get_post_meta($variation->ID, '_woosea_optimized_title', true),
3347
  'wrapper_class' => 'form-row-last',
3348
  )
3354
  woocommerce_wp_text_input(
3355
  array(
3356
  'id' => '_woosea_installment_months['.$loop.']',
3357
+ 'label' => __( '<br>Installment months', 'woo-product-feed-pro' ),
3358
  'placeholder' => 'Installment months',
3359
  'desc_tip' => 'true',
3360
+ 'description' => __( 'Enter the number of montly installments for the buyer here.', 'woo-product-feed-pro' ),
3361
  'value' => get_post_meta($variation->ID, '_woosea_installment_months', true),
3362
  'wrapper_class' => 'form-row-last',
3363
  )
3369
  woocommerce_wp_text_input(
3370
  array(
3371
  'id' => '_woosea_installment_amount['.$loop.']',
3372
+ 'label' => __( '<br>Installment amount', 'woo-product-feed-pro' ),
3373
  'placeholder' => 'Installment amount',
3374
  'desc_tip' => 'true',
3375
+ 'description' => __( 'Enter the installment amount here.', 'woo-product-feed-pro' ),
3376
  'value' => get_post_meta($variation->ID, '_woosea_installment_amount', true),
3377
  'wrapper_class' => 'form-row-last',
3378
  )
3384
  woocommerce_wp_select(
3385
  array(
3386
  'id' => '_woosea_condition['.$loop.']',
3387
+ 'label' => __( 'Product condition', 'woo-product-feed-pro' ),
3388
  'placeholder' => 'Product condition',
3389
  'desc_tip' => 'true',
3390
+ 'description' => __( 'Select the product condition.', 'woo-product-feed-pro' ),
3391
  'value' => get_post_meta($variation->ID, '_woosea_condition', true),
3392
  'wrapper_class' => 'form-row form-row-full',
3393
  'options' => array (
3394
+ '' => __( '', 'woo-product-feed-pro' ),
3395
+ 'new' => __( 'new', 'woo-product-feed-pro' ),
3396
+ 'refurbished' => __( 'refurbished', 'woo-product-feed-pro' ),
3397
+ 'used' => __( 'used', 'woo-product-feed-pro' ),
3398
+ 'damaged' => __( 'damaged', 'woo-product-feed-pro' ),
3399
  )
3400
  )
3401
  );
3406
  woocommerce_wp_select(
3407
  array(
3408
  'id' => '_woosea_age_group['.$loop.']',
3409
+ 'label' => __( 'Product age group', 'woo-product-feed-pro' ),
3410
  'placeholder' => 'Product age group',
3411
  'desc_tip' => 'true',
3412
+ 'description' => __( 'Select the product age group.', 'woo-product-feed-pro' ),
3413
  'value' => get_post_meta($variation->ID, '_woosea_age_group', true),
3414
  'wrapper_class' => 'form-row form-row-full',
3415
  'options' => array (
3416
+ '' => __( '', 'woo-product-feed-pro' ),
3417
+ 'newborn' => __( 'newborn', 'woo-product-feed-pro' ),
3418
+ 'infant' => __( 'infant', 'woo-product-feed-pro' ),
3419
+ 'toddler' => __( 'toddler', 'woo-product-feed-pro' ),
3420
+ 'kids' => __( 'kids', 'woo-product-feed-pro' ),
3421
+ 'adult' => __( 'adult', 'woo-product-feed-pro' ),
3422
  )
3423
  )
3424
  );
3429
  woocommerce_wp_text_input(
3430
  array(
3431
  'id' => '_woosea_cost_of_good_sold['.$loop.']',
3432
+ 'label' => __( '<br>Cost of good sold', 'woo-product-feed-pro' ),
3433
  'placeholder' => 'Cost of good sold',
3434
  'desc_tip' => 'true',
3435
+ 'description' => __( 'Enter the cost of good sold.', 'woo-product-feed-pro' ),
3436
  'value' => get_post_meta($variation->ID, '_woosea_cost_of_good_sold', true),
3437
  'wrapper_class' => 'form-row-last',
3438
  )
3444
  woocommerce_wp_text_input(
3445
  array(
3446
  'id' => '_woosea_multipack['.$loop.']',
3447
+ 'label' => __( '<br>Multipack', 'woo-product-feed-pro' ),
3448
  'placeholder' => 'Multipack amount',
3449
  'desc_tip' => 'true',
3450
+ 'description' => __( 'Enter the multipack amount here.', 'woo-product-feed-pro' ),
3451
  'value' => get_post_meta($variation->ID, '_woosea_multipack', true),
3452
  'wrapper_class' => 'form-row-last',
3453
  )
3459
  woocommerce_wp_select(
3460
  array(
3461
  'id' => '_woosea_is_bundle['.$loop.']',
3462
+ 'label' => __( 'Is bundle', 'woo-product-feed-pro' ),
3463
  'placeholder' => 'Is bundle',
3464
  'desc_tip' => 'true',
3465
+ 'description' => __( 'Select the is bundle value.', 'woo-product-feed-pro' ),
3466
  'value' => get_post_meta($variation->ID, '_woosea_is_bundle', true),
3467
  'wrapper_class' => 'form-row form-row-full',
3468
  'options' => array (
3479
  woocommerce_wp_select(
3480
  array(
3481
  'id' => '_woosea_energy_efficiency_class['.$loop.']',
3482
+ 'label' => __( 'Energy efficiency class', 'woo-product-feed-pro' ),
3483
  'placeholder' => 'Energy efficiency class',
3484
  'desc_tip' => 'true',
3485
+ 'description' => __( 'Select the energy efficiency class.', 'woo-product-feed-pro' ),
3486
  'value' => get_post_meta($variation->ID, '_woosea_energy_efficiency_class', true),
3487
  'wrapper_class' => 'form-row form-row-full',
3488
  'options' => array (
3489
+ '' => __( '', 'woo-product-feed-pro' ),
3490
+ 'A+++' => __( 'A+++', 'woo-product-feed-pro' ),
3491
+ 'A++' => __( 'A++', 'woo-product-feed-pro' ),
3492
+ 'A+' => __( 'A+', 'woo-product-feed-pro' ),
3493
+ 'A' => __( 'A', 'woo-product-feed-pro' ),
3494
+ 'B' => __( 'B', 'woo-product-feed-pro' ),
3495
+ 'C' => __( 'C', 'woo-product-feed-pro' ),
3496
+ 'D' => __( 'D', 'woo-product-feed-pro' ),
3497
+ 'E' => __( 'E', 'woo-product-feed-pro' ),
3498
+ 'F' => __( 'F', 'woo-product-feed-pro' ),
3499
+ 'G' => __( 'G', 'woo-product-feed-pro' ),
3500
  )
3501
  )
3502
  );
3507
  woocommerce_wp_select(
3508
  array(
3509
  'id' => '_woosea_min_energy_efficiency_class['.$loop.']',
3510
+ 'label' => __( 'Minimum energy efficiency class', 'woo-product-feed-pro' ),
3511
  'placeholder' => 'Minimum energy efficiency class',
3512
  'desc_tip' => 'true',
3513
+ 'description' => __( 'Select the minimum energy efficiency class.', 'woo-product-feed-pro' ),
3514
  'value' => get_post_meta($variation->ID, '_woosea_min_energy_efficiency_class', true),
3515
  'wrapper_class' => 'form-row form-row-full',
3516
  'options' => array (
3517
+ '' => __( '', 'woo-product-feed-pro' ),
3518
+ 'A+++' => __( 'A+++', 'woo-product-feed-pro' ),
3519
+ 'A++' => __( 'A++', 'woo-product-feed-pro' ),
3520
+ 'A+' => __( 'A+', 'woo-product-feed-pro' ),
3521
+ 'A' => __( 'A', 'woo-product-feed-pro' ),
3522
+ 'B' => __( 'B', 'woo-product-feed-pro' ),
3523
+ 'C' => __( 'C', 'woo-product-feed-pro' ),
3524
+ 'D' => __( 'D', 'woo-product-feed-pro' ),
3525
+ 'E' => __( 'E', 'woo-product-feed-pro' ),
3526
+ 'F' => __( 'F', 'woo-product-feed-pro' ),
3527
+ 'G' => __( 'G', 'woo-product-feed-pro' ),
3528
  )
3529
  )
3530
  );
3535
  woocommerce_wp_select(
3536
  array(
3537
  'id' => '_woosea_max_energy_efficiency_class['.$loop.']',
3538
+ 'label' => __( 'Maximum energy efficiency class', 'woo-product-feed-pro' ),
3539
  'placeholder' => 'Maximum energy efficiency class',
3540
  'desc_tip' => 'true',
3541
+ 'description' => __( 'Select the maximum energy efficiency class.', 'woo-product-feed-pro' ),
3542
  'value' => get_post_meta($variation->ID, '_woosea_max_energy_efficiency_class', true),
3543
  'wrapper_class' => 'form-row form-row-full',
3544
  'options' => array (
3545
+ '' => __( '', 'woo-product-feed-pro' ),
3546
+ 'A+++' => __( 'A+++', 'woo-product-feed-pro' ),
3547
+ 'A++' => __( 'A++', 'woo-product-feed-pro' ),
3548
+ 'A+' => __( 'A+', 'woo-product-feed-pro' ),
3549
+ 'A' => __( 'A', 'woo-product-feed-pro' ),
3550
+ 'B' => __( 'B', 'woo-product-feed-pro' ),
3551
+ 'C' => __( 'C', 'woo-product-feed-pro' ),
3552
+ 'D' => __( 'D', 'woo-product-feed-pro' ),
3553
+ 'E' => __( 'E', 'woo-product-feed-pro' ),
3554
+ 'F' => __( 'F', 'woo-product-feed-pro' ),
3555
+ 'G' => __( 'G', 'woo-product-feed-pro' ),
3556
  )
3557
  )
3558
  );
3563
  woocommerce_wp_text_input(
3564
  array(
3565
  'id' => '_woosea_is_promotion['.$loop.']',
3566
+ 'label' => __( '<br>Is promotion', 'woo-product-feed-pro' ),
3567
  'placeholder' => 'Is promotion',
3568
  'desc_tip' => 'true',
3569
+ 'description' => __( 'Enter your promotion ID', 'woo-product-feed-pro' ),
3570
  'value' => get_post_meta($variation->ID, '_woosea_is_promotion', true),
3571
  'wrapper_class' => 'form-row-last',
3572
  )
3578
  woocommerce_wp_text_input(
3579
  array(
3580
  'id' => '_woosea_custom_field_0['.$loop.']',
3581
+ 'label' => __( '<br>Custom field 0', 'woo-product-feed-pro' ),
3582
  'placeholder' => 'Custom field 0',
3583
  'desc_tip' => 'true',
3584
+ 'description' => __( 'Enter your custom field 0', 'woo-product-feed-pro' ),
3585
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_0', true),
3586
  'wrapper_class' => 'form-row-last',
3587
  )
3593
  woocommerce_wp_text_input(
3594
  array(
3595
  'id' => '_woosea_custom_field_1['.$loop.']',
3596
+ 'label' => __( '<br>Custom field 1', 'woo-product-feed-pro' ),
3597
  'placeholder' => 'Custom field 1',
3598
  'desc_tip' => 'true',
3599
+ 'description' => __( 'Enter your custom field 1', 'woo-product-feed-pro' ),
3600
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_1', true),
3601
  'wrapper_class' => 'form-row-last',
3602
  )
3608
  woocommerce_wp_text_input(
3609
  array(
3610
  'id' => '_woosea_custom_field_2['.$loop.']',
3611
+ 'label' => __( '<br>Custom field 2', 'woo-product-feed-pro' ),
3612
  'placeholder' => 'Custom field 2',
3613
  'desc_tip' => 'true',
3614
+ 'description' => __( 'Enter your custom field 2', 'woo-product-feed-pro' ),
3615
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_2', true),
3616
  'wrapper_class' => 'form-row-last',
3617
  )
3623
  woocommerce_wp_text_input(
3624
  array(
3625
  'id' => '_woosea_custom_field_3['.$loop.']',
3626
+ 'label' => __( '<br>Custom field 3', 'woo-product-feed-pro' ),
3627
  'placeholder' => 'Custom field 3',
3628
  'desc_tip' => 'true',
3629
+ 'description' => __( 'Enter your custom field 3', 'woo-product-feed-pro' ),
3630
  'value' => get_post_meta($variation->ID, '_woosea_custom_field_3', true),
3631
  'wrapper_class' => 'form-row-last',
3632
  )
3652
  woocommerce_wp_checkbox(
3653
  array(
3654
  'id' => '_woosea_exclude_product['.$loop.']',
3655
+ 'label' => __( '&nbsp;Exclude from feeds', 'woo-product-feed-pro' ),
3656
  'placeholder' => 'Exclude from feeds',
3657
  'desc_tip' => 'true',
3658
+ 'description' => __( 'Check this box if you want this product to be excluded from product feeds.', 'woo-product-feed-pro' ),
3659
  'value' => get_post_meta($variation->ID, '_woosea_exclude_product', true),
3660
  )
3661
  );
3669
  function woosea_save_custom_variable_fields( $post_id ) {
3670
 
3671
  if (isset( $_POST['variable_sku'] ) ) {
3672
+ $variable_sku = sanitize_text_field($_POST['variable_sku']);
3673
+ $variable_post_id = sanitize_text_field($_POST['variable_post_id']);
3674
 
3675
+ if(is_array($variable_post_id)){
3676
+ $max_loop = max( array_keys( $variable_post_id ) );
3677
+ } else {
3678
+ $max_loop = 0;
3679
+ }
3680
 
3681
  for ( $i = 0; $i <= $max_loop; $i++ ) {
3682
 
3686
 
3687
  // Brand Field
3688
  if(isset($_POST['_woosea_variable_brand'])){
3689
+ $_brand = sanitize_text_field($_POST['_woosea_variable_brand']);
3690
  $variation_id = (int) $variable_post_id[$i];
3691
  if ( isset( $_brand[$i] ) ) {
3692
  update_post_meta( $variation_id, '_woosea_brand', stripslashes( sanitize_text_field( $_brand[$i] )));
3695
 
3696
  // MPN Field
3697
  if(isset($_POST['_woosea_variable_mpn'])){
3698
+ $_mpn = sanitize_text_field($_POST['_woosea_variable_mpn']);
3699
  $variation_id = (int) $variable_post_id[$i];
3700
  if ( isset( $_mpn[$i] ) ) {
3701
  update_post_meta( $variation_id, '_woosea_mpn', stripslashes( sanitize_text_field( $_mpn[$i] )));
3704
 
3705
  // UPC Field
3706
  if(isset($_POST['_woosea_variable_upc'])){
3707
+ $_upc = sanitize_text_field($_POST['_woosea_variable_upc']);
3708
  $variation_id = (int) $variable_post_id[$i];
3709
  if ( isset( $_upc[$i] ) ) {
3710
  update_post_meta( $variation_id, '_woosea_upc', stripslashes( sanitize_text_field( $_upc[$i] )));
3713
 
3714
  // EAN Field
3715
  if(isset($_POST['_woosea_variable_ean'])){
3716
+ $_ean = sanitize_text_field($_POST['_woosea_variable_ean']);
3717
  $variation_id = (int) $variable_post_id[$i];
3718
  if ( isset( $_ean[$i] ) ) {
3719
  update_post_meta( $variation_id, '_woosea_ean', stripslashes( sanitize_text_field( $_ean[$i] )));
3722
 
3723
  // GTIN Field
3724
  if(isset($_POST['_woosea_variable_gtin'])){
3725
+ $_gtin = sanitize_text_field($_POST['_woosea_variable_gtin']);
3726
  $variation_id = (int) $variable_post_id[$i];
3727
  if ( isset( $_gtin[$i] ) ) {
3728
  update_post_meta( $variation_id, '_woosea_gtin', stripslashes( sanitize_text_field( $_gtin[$i] )));
3731
 
3732
  // Color Field
3733
  if(isset($_POST['_woosea_variable_color'])){
3734
+ $_color = sanitize_text_field($_POST['_woosea_variable_color']);
3735
  $variation_id = (int) $variable_post_id[$i];
3736
  if ( isset( $_color[$i] ) ) {
3737
  update_post_meta( $variation_id, '_woosea_color', stripslashes( sanitize_text_field( $_color[$i] )));
3740
 
3741
  // Size Field
3742
  if(isset($_POST['_woosea_variable_size'])){
3743
+ $_size = sanitize_text_field($_POST['_woosea_variable_size']);
3744
  $variation_id = (int) $variable_post_id[$i];
3745
  if ( isset( $_size[$i] ) ) {
3746
  update_post_meta( $variation_id, '_woosea_size', stripslashes( sanitize_text_field( $_size[$i] )));
3749
 
3750
  // Gender Field
3751
  if(isset($_POST['_woosea_variable_gender'])){
3752
+ $_gender = sanitize_text_field($_POST['_woosea_variable_gender']);
3753
  $variation_id = (int) $variable_post_id[$i];
3754
  if ( isset( $_gender[$i] ) ) {
3755
  update_post_meta( $variation_id, '_woosea_gender', stripslashes( sanitize_text_field( $_gender[$i] )));
3758
 
3759
  // Material Field
3760
  if(isset($_POST['_woosea_variable_material'])){
3761
+ $_material = sanitize_text_field($_POST['_woosea_variable_material']);
3762
  $variation_id = (int) $variable_post_id[$i];
3763
  if ( isset( $_material[$i] ) ) {
3764
  update_post_meta( $variation_id, '_woosea_material', stripslashes( sanitize_text_field( $_material[$i] )));
3767
 
3768
  // Pattern Field
3769
  if(isset($_POST['_woosea_variable_pattern'])){
3770
+ $_pattern = sanitize_text_field($_POST['_woosea_variable_pattern']);
3771
  $variation_id = (int) $variable_post_id[$i];
3772
  if ( isset( $_pattern[$i] ) ) {
3773
  update_post_meta( $variation_id, '_woosea_pattern', stripslashes( sanitize_text_field( $_pattern[$i] )));
3776
 
3777
  // Unit pricing measure Field
3778
  if(isset($_POST['_woosea_variable_unit_pricing_measure'])){
3779
+ $_pricing_measure = sanitize_text_field($_POST['_woosea_variable_unit_pricing_measure']);
3780
  $variation_id = (int) $variable_post_id[$i];
3781
  if ( isset( $_pricing_measure[$i] ) ) {
3782
  update_post_meta( $variation_id, '_woosea_unit_pricing_measure', stripslashes( sanitize_text_field( $_pricing_measure[$i] )));
3785
 
3786
  // Unit pricing base measure Field
3787
  if(isset($_POST['_woosea_variable_unit_pricing_base_measure'])){
3788
+ $_pricing_base = sanitize_text_field($_POST['_woosea_variable_unit_pricing_base_measure']);
3789
  $variation_id = (int) $variable_post_id[$i];
3790
  if ( isset( $_pricing_base[$i] ) ) {
3791
  update_post_meta( $variation_id, '_woosea_unit_pricing_base_measure', stripslashes( sanitize_text_field( $_pricing_base[$i] )));
3794
 
3795
  // Optimized title Field
3796
  if(isset($_POST['_woosea_optimized_title'])){
3797
+ $_opttitle = sanitize_text_field($_POST['_woosea_optimized_title']);
3798
  $variation_id = (int) $variable_post_id[$i];
3799
  if ( isset( $_opttitle[$i] ) ) {
3800
  update_post_meta( $variation_id, '_woosea_optimized_title', stripslashes( sanitize_text_field( $_opttitle[$i] )));
3803
 
3804
  // Installment months Field
3805
  if(isset($_POST['_woosea_installment_months'])){
3806
+ $_installment_months = sanitize_text_field($_POST['_woosea_installment_months']);
3807
  $variation_id = (int) $variable_post_id[$i];
3808
  if ( isset( $_installment_months[$i] ) ) {
3809
  update_post_meta( $variation_id, '_woosea_installment_months', stripslashes( sanitize_text_field( $_installment_months[$i] )));
3812
 
3813
  // Installment amount Field
3814
  if(isset($_POST['_woosea_installment_amount'])){
3815
+ $_installment_amount = sanitize_text_field($_POST['_woosea_installment_amount']);
3816
  $variation_id = (int) $variable_post_id[$i];
3817
  if ( isset( $_installment_amount[$i] ) ) {
3818
  update_post_meta( $variation_id, '_woosea_installment_amount', stripslashes( sanitize_text_field( $_installment_amount[$i] )));
3821
 
3822
  // Product condition Field
3823
  if(isset($_POST['_woosea_condition'])){
3824
+ $_condition = sanitize_text_field($_POST['_woosea_condition']);
3825
  $variation_id = (int) $variable_post_id[$i];
3826
  if ( isset( $_condition[$i] ) ) {
3827
  update_post_meta( $variation_id, '_woosea_condition', stripslashes( sanitize_text_field( $_condition[$i] )));
3830
 
3831
  // Product age group
3832
  if(isset($_POST['_woosea_age_group'])){
3833
+ $_age_group = sanitize_text_field($_POST['_woosea_age_group']);
3834
  $variation_id = (int) $variable_post_id[$i];
3835
  if ( isset( $_age_group[$i] ) ) {
3836
  update_post_meta( $variation_id, '_woosea_age_group', stripslashes( sanitize_text_field( $_age_group[$i] )));
3840
 
3841
  // Cost of good sold
3842
  if(isset($_POST['_woosea_cost_of_good_sold'])){
3843
+ $_cost_of_good_sold = sanitize_text_field($_POST['_woosea_cost_of_good_sold']);
3844
  $variation_id = (int) $variable_post_id[$i];
3845
  if ( isset( $_cost_of_good_sold[$i] ) ) {
3846
  update_post_meta( $variation_id, '_woosea_cost_of_good_sold', stripslashes( sanitize_text_field( $_cost_of_good_sold[$i] )));
3849
 
3850
  // Multipack
3851
  if(isset($_POST['_woosea_multipack'])){
3852
+ $_multipack = sanitize_text_field($_POST['_woosea_multipack']);
3853
  $variation_id = (int) $variable_post_id[$i];
3854
  if ( isset( $_multipack[$i] ) ) {
3855
  update_post_meta( $variation_id, '_woosea_multipack', stripslashes( sanitize_text_field( $_multipack[$i] )));
3858
 
3859
  // Is promotion
3860
  if(isset($_POST['_woosea_is_promotion'])){
3861
+ $_is_promotion = sanitize_text_field($_POST['_woosea_is_promotion']);
3862
  $variation_id = (int) $variable_post_id[$i];
3863
  if ( isset( $_is_promotion[$i] ) ) {
3864
  update_post_meta( $variation_id, '_woosea_is_promotion', stripslashes( sanitize_text_field( $_is_promotion[$i] )));
3867
 
3868
  // Is bundle
3869
  if(isset($_POST['_woosea_is_bundle'])){
3870
+ $_is_bundle = sanitize_text_field($_POST['_woosea_is_bundle']);
3871
  $variation_id = (int) $variable_post_id[$i];
3872
  if ( isset( $_is_bundle[$i] ) ) {
3873
  update_post_meta( $variation_id, '_woosea_is_bundle', stripslashes( sanitize_text_field( $_is_bundle[$i] )));
3876
 
3877
  // Energy efficiency class
3878
  if(isset($_POST['_woosea_energy_efficiency_class'])){
3879
+ $_energy_efficiency_class = sanitize_text_field($_POST['_woosea_energy_efficiency_class']);
3880
  $variation_id = (int) $variable_post_id[$i];
3881
  if ( isset( $_energy_efficiency_class[$i] ) ) {
3882
  update_post_meta( $variation_id, '_woosea_energy_efficiency_class', stripslashes( sanitize_text_field( $_energy_efficiency_class[$i] )));
3885
 
3886
  // Minimum energy efficiency class
3887
  if(isset($_POST['_woosea_min_energy_efficiency_class'])){
3888
+ $_min_energy_efficiency_class = sanitize_text_field($_POST['_woosea_min_energy_efficiency_class']);
3889
  $variation_id = (int) $variable_post_id[$i];
3890
  if ( isset( $_min_energy_efficiency_class[$i] ) ) {
3891
  update_post_meta( $variation_id, '_woosea_min_energy_efficiency_class', stripslashes( sanitize_text_field( $_min_energy_efficiency_class[$i] )));
3894
 
3895
  // Maximum energy efficiency class
3896
  if(isset($_POST['_woosea_max_energy_efficiency_class'])){
3897
+ $_max_energy_efficiency_class = sanitize_text_field($_POST['_woosea_max_energy_efficiency_class']);
3898
  $variation_id = (int) $variable_post_id[$i];
3899
  if ( isset( $_max_energy_efficiency_class[$i] ) ) {
3900
  update_post_meta( $variation_id, '_woosea_max_energy_efficiency_class', stripslashes( sanitize_text_field( $_max_energy_efficiency_class[$i] )));
3903
 
3904
  // Custom field 0
3905
  if(isset($_POST['_woosea_custom_field_0'])){
3906
+ $_custom_field_0 = sanitize_text_field($_POST['_woosea_custom_field_0']);
3907
  $variation_id = (int) $variable_post_id[$i];
3908
  if ( isset( $_custom_field_0[$i] ) ) {
3909
  update_post_meta( $variation_id, '_woosea_custom_field_0', stripslashes( sanitize_text_field( $_custom_field_0[$i] )));
3912
 
3913
  // Custom field 1
3914
  if(isset($_POST['_woosea_custom_field_1'])){
3915
+ $_custom_field_1 = sanitize_text_field($_POST['_woosea_custom_field_1']);
3916
  $variation_id = (int) $variable_post_id[$i];
3917
  if ( isset( $_custom_field_1[$i] ) ) {
3918
  update_post_meta( $variation_id, '_woosea_custom_field_1', stripslashes( sanitize_text_field( $_custom_field_1[$i] )));
3921
 
3922
  // Custom field 2
3923
  if(isset($_POST['_woosea_custom_field_2'])){
3924
+ $_custom_field_2 = sanitize_text_field($_POST['_woosea_custom_field_2']);
3925
  $variation_id = (int) $variable_post_id[$i];
3926
  if ( isset( $_custom_field_2[$i] ) ) {
3927
  update_post_meta( $variation_id, '_woosea_custom_field_2', stripslashes( sanitize_text_field( $_custom_field_2[$i] )));
3930
 
3931
  // Custom field 3
3932
  if(isset($_POST['_woosea_custom_field_3'])){
3933
+ $_custom_field_3 = sanitize_text_field($_POST['_woosea_custom_field_3']);
3934
  $variation_id = (int) $variable_post_id[$i];
3935
  if ( isset( $_custom_field_3[$i] ) ) {
3936
  update_post_meta( $variation_id, '_woosea_custom_field_3', stripslashes( sanitize_text_field( $_custom_field_3[$i] )));
3939
 
3940
  // Custom field 4
3941
  if(isset($_POST['_woosea_custom_field_4'])){
3942
+ $_custom_field_4 = sanitize_text_field($_POST['_woosea_custom_field_4']);
3943
  $variation_id = (int) $variable_post_id[$i];
3944
  if ( isset( $_custom_field_4[$i] ) ) {
3945
  update_post_meta( $variation_id, '_woosea_custom_field_4', stripslashes( sanitize_text_field( $_custom_field_4[$i] )));
3950
  if(empty($_POST['_woosea_exclude_product'])){
3951
  $_excludeproduct[$i] = "no";
3952
  } else {
3953
+ $_excludeproduct = sanitize_text_field($_POST['_woosea_exclude_product']);
3954
  }
3955
  $variation_id = (int) $variable_post_id[$i];
3956
  if ( isset( $_excludeproduct[$i] ) ) {
4093
  * Get the dropdowns for the fieldmapping page
4094
  */
4095
  function woosea_fieldmapping_dropdown(){
4096
+ check_ajax_referer('woosea_ajax_nonce', 'security');
4097
  $channel_hash = sanitize_text_field($_POST['channel_hash']);
4098
  $rowCount = sanitize_text_field($_POST['rowCount']);
4099
  $channel_data = WooSEA_Update_Project::get_channel_data($channel_hash);
4150
  }
4151
  add_action( 'wp_ajax_woosea_autocomplete_dropdown', 'woosea_autocomplete_dropdown' );
4152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4153
  /**
4154
  * Function for serving different HTML templates while configuring the feed
4155
  * Some cases are left blank for future steps and pages in the configurations process
4203
  if (!$_POST){
4204
  $generate_step = 0;
4205
  } else {
4206
+ $from_post = stripslashes_recursive($_POST);
 
 
4207
  $channel_hash = sanitize_text_field($_POST['channel_hash']);
4208
  $step = sanitize_text_field($_POST['step']);
4209
  $generate_step = $step;
4450
  return $last_updated;
4451
  }
4452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4453
  /**
4454
  * Process next batch for product feed
4455
  */
4620
  * Add plugin links to Wordpress menu
4621
  */
4622
  add_action( 'admin_menu' , 'woosea_menu_addition' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4623
  ?>