Product Feed PRO for WooCommerce - Version 10.3.5

Version Description

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.

Download this release

Release Info

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

Code changes from version 9.3.7 to 10.3.5

TODO.txt CHANGED
@@ -3,20 +3,28 @@ 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 Facebook Conversion API connection
10
+ - Add automotive fields for Facebook feed, see: https://developers.facebook.com/docs/marketing-api/dynamic-ads-auto/auto-catalog/
11
+ - Autosuggest for category mapping broken
12
+ - Add AddToCart event on buttons again
13
+ - Add Vivino EXTRA fields, see: https://vivino.slab.com/public/posts/9gq0o3dg
14
+ - Local product feed - store code should also work with an attribute and not just static values
15
+ - Add Pinterest Tag; https://help.pinterest.com/nl/business/article/install-the-pinterest-tag
16
  - License key input field needs to be a password field (asterixes)
17
+ - Allow adding multiple pictures to Yandex feeds, see:https://wordpress.org/support/topic/yandex-yml-support/#post-14344829
18
+ - A seperate FB pixel per WPML website / language
19
  - Add a preview option so only 5-10 products are being generated
20
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
21
  - Google local product feed inventory in XML format (not just TXT like it is now)
22
  - Add support for Multisites
23
  - Add a filter on review score (and amount of reviews)
24
  - Make extra woosea fields available for front-end usage
 
25
  - Add header to extra fields on product edit pages
26
  - Add possibility to create OR rules
27
  - Add support for Google My Business product feeds
 
28
  - AMAZON integration:
29
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
30
+ - only then we can use their MWS service needed to connect our plugin
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",
@@ -116,6 +116,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 +277,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",
116
  "format" => "required",
117
  "woo_suggest" => "categories",
118
  ),
119
+ "product_type" => array(
120
+ "name" => "product_type",
121
+ "feed_name" => "g:product_type",
122
+ "format" => "required",
123
+ "woo_suggest" => "category_path",
124
+ ),
125
  "fb_product_category" => array(
126
  "name" => "fb_product_category",
127
  "feed_name" => "g:fb_product_category",
277
  "feed_name" => "g:inventory",
278
  "format" => "optional",
279
  ),
280
+ "quantity_to_sell_on_facebook" => array(
281
+ "name" => "quantity_to_sell_on_facebook",
282
+ "feed_name" => "g:quantity_to_sell_on_facebook",
283
+ "format" => "optional",
284
+ ),
285
  "ingredients" => array(
286
  "name" => "ingredients",
287
  "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,11 @@ class WooSEA_google_shopping {
356
  "feed_name" => "g:max_handling_time",
357
  "format" => "optional",
358
  ),
 
 
 
 
 
359
  ),
360
  "Tax" => array(
361
  "Tax" => array(
@@ -425,6 +440,106 @@ 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
  ),
375
  "Tax" => array(
376
  "Tax" => array(
440
  "feed_name" => "g:google_funded_promotion_eligibility",
441
  "format" => "optional",
442
  ),
443
+ "Pickup method" => array(
444
+ "name" => "pickup_method",
445
+ "feed_name" => "g:pickup_method",
446
+ "format" => "optional",
447
+ ),
448
+ "Pickup SLA" => array(
449
+ "name" => "pickup_SLA",
450
+ "feed_name" => "g:pickup_SLA",
451
+ "format" => "optional",
452
+ ),
453
+ "Pickup link template" => array(
454
+ "name" => "pickup_link_template",
455
+ "feed_name" => "g:pickup_link_template",
456
+ "format" => "optional",
457
+ ),
458
+ "Store code" => array(
459
+ "name" => "store_code",
460
+ "feed_name" => "g:store_code",
461
+ "format" => "optional",
462
+ ),
463
+ "Mobile pickup link template" => array(
464
+ "name" => "mobile_pickup_link_template",
465
+ "feed_name" => "g:mobile_pickup_link_template",
466
+ "format" => "optional",
467
+ ),
468
+ "Seller name" => array(
469
+ "name" => "seller_name",
470
+ "feed_name" => "g:seller_name",
471
+ "format" => "optional",
472
+ ),
473
+ "Count" => array(
474
+ "name" => "count",
475
+ "feed_name" => "g:count",
476
+ "format" => "optional",
477
+ ),
478
+ "Disclosure date" => array(
479
+ "name" => "disclosure_date",
480
+ "feed_name" => "g:disclosure_date",
481
+ "format" => "optional",
482
+ ),
483
+ "Feature description" => array(
484
+ "name" => "feature_description",
485
+ "feed_name" => "g:feature_description",
486
+ "format" => "optional",
487
+ ),
488
+ "Flavor" => array(
489
+ "name" => "flavor",
490
+ "feed_name" => "g:flavor",
491
+ "format" => "optional",
492
+ ),
493
+ "Scent" => array(
494
+ "name" => "scent",
495
+ "feed_name" => "g:scent",
496
+ "format" => "optional",
497
+ ),
498
+ "Format" => array(
499
+ "name" => "format",
500
+ "feed_name" => "g:format",
501
+ "format" => "optional",
502
+ ),
503
+ "Product line" => array(
504
+ "name" => "product_line",
505
+ "feed_name" => "g:product_line",
506
+ "format" => "optional",
507
+ ),
508
+ "Product name" => array(
509
+ "name" => "product_name",
510
+ "feed_name" => "g:product_name",
511
+ "format" => "optional",
512
+ ),
513
+ "Product page url" => array(
514
+ "name" => "product_page_url",
515
+ "feed_name" => "g:product_page_url",
516
+ "format" => "optional",
517
+ ),
518
+ "Size system" => array(
519
+ "name" => "size_system",
520
+ "feed_name" => "g:size_system",
521
+ "format" => "optional",
522
+ ),
523
+ "Size type" => array(
524
+ "name" => "size_type",
525
+ "feed_name" => "g:size_type",
526
+ "format" => "optional",
527
+ ),
528
+ "Suggested retail price" => array(
529
+ "name" => "suggested_retail_price",
530
+ "feed_name" => "g:suggested_retail_price",
531
+ "format" => "optional",
532
+ ),
533
+ "Theme" => array(
534
+ "name" => "theme",
535
+ "feed_name" => "g:theme",
536
+ "format" => "optional",
537
+ ),
538
+ "Video link" => array(
539
+ "name" => "video_link",
540
+ "feed_name" => "g:video_link",
541
+ "format" => "optional",
542
+ ),
543
  ),
544
  );
545
  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/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,7 +97,7 @@ 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
  ),
@@ -740,7 +747,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" ),
@@ -1112,6 +1119,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",
@@ -1321,8 +1335,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 (
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
  ),
747
  "Idealo.de" => array (
748
  "channel_hash" => md5("Idealo.de"),
749
  "name" => "Idealo.de",
750
+ "fields" => "idealo",
751
  "taxonomy" => "none",
752
  "utm_source" => "Idealo.de",
753
  "type" => "Comparison shopping engine" ),
1119
  "taxonomy" => "none",
1120
  "utm_source" => "Tweakers.nl",
1121
  "type" => "Comparison shopping engine" ),
1122
+ "Boetiek.nl" => array (
1123
+ "channel_hash" => md5("Boetiek.nl"),
1124
+ "name" => "Boetiek.nl",
1125
+ "fields" => "boetiek",
1126
+ "taxonomy" => "none",
1127
+ "utm_source" => "Boetiek.nl",
1128
+ "type" => "Comparison shopping engine" ),
1129
  "Fashionchick.nl" => array (
1130
  "channel_hash" => md5("Fashionchick.nl"),
1131
  "name" => "Fashionchick.nl",
1335
  "fields" => "compari_ro",
1336
  "taxonomy" => "none",
1337
  "utm_source" => "Compari.ro",
1338
+ "type" => "Comparison shopping engine" ),
 
1339
  ),
1340
  "Russian Federation" => array (
1341
  "Yandex" => array (
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",
@@ -235,8 +239,13 @@ public function get_mapping_attributes_dropdown() {
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 +256,10 @@ 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 +277,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 +362,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 +411,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 +447,11 @@ 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",
@@ -456,7 +475,11 @@ public function get_mapping_attributes_dropdown() {
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 +487,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",
239
  "vivino_sale_price" => "Pinterest / Vivino sale price",
240
  "vivino_regular_price" => "Pinterest / Vivino regular price",
241
  "non_geo_wcml_price" => "Non GEO WCML price",
242
+ "mm_min_price" => "Mix & Match minimum price",
243
+ "mm_min_regular_price" => "Mix & Match minimum regular price",
244
+ "mm_max_price" => "Mix & Match maximum price",
245
+ "mm_max_regular_price" => "Mix & Match maximum regular price",
246
  "discount_percentage" => "Discount percentage",
247
  "link" => "Link",
248
+ "link_no_tracking" => "Link without parameters",
249
  "variable_link" => "Product variable link",
250
  "add_to_cart_link" => "Add to cart link",
251
  "product_creation_date" => "Product creation date",
256
  "category_path" => "Category path",
257
  "category_path_short" => "Category path short",
258
  "category_path_skroutz" => "Category path Skroutz",
259
+ "one_category" => "Yoast / Rankmath primary category",
260
  "condition" => "Condition",
261
+ "availability" => "Availability",
262
+ "stock_status" => "Stock Status WooCommerce",
263
  "quantity" => "Quantity [Stock]",
264
  "product_type" => "Product Type",
265
  "content_type" => "Content Type",
277
  "length" => "Length",
278
  "shipping" => "Shipping",
279
  "shipping_price" => "Shipping cost",
280
+ "lowest_shipping_costs" => "Lowest shipping costs",
281
+ "shipping_label" => "Shipping class slug",
282
+ "shipping_label_name" => "Shipping class name",
283
  "visibility" => "Visibility",
284
  "rating_total" => "Total rating",
285
  "rating_average" => "Average rating",
362
 
363
  foreach ($custom_attributes as $key => $value) {
364
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
365
+ $value = ltrim($value);
366
+ if (!empty($value)){
367
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
368
+ }
369
  }
370
  }
371
 
411
  "parent_sku" => "SKU parent variable product",
412
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
413
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
414
+ "title" => "Product name",
415
+ "title_hyphen" => "Product name hyphen",
416
+ "mother_title" => "Product name parent product",
417
+ "mother_title_hyphen" => "Product name parent product hyphen",
418
  "title_lc" => "Product name lowercase",
419
+ "title_lcw" => "Product name uppercase first characters",
420
  "description" => "Product description",
421
  "short_description" => "Product short description",
422
  "raw_description" => "Unfiltered product description",
423
  "raw_short_description" => "Unfiltered product short description",
424
+ "mother_description" => "Product description parent product",
425
+ "mother_short_description" => "Product short description parent product",
426
+ "link" => "Link",
427
+ "link_no_tracking" => "Link without parameters",
428
  "variable_link" => "Product variable link",
429
  "add_to_cart_link" => "Add to cart link",
430
  "image" => "Main image",
447
  "category_path" => "Category path",
448
  "category_path_short" => "Category path short",
449
  "category_path_skroutz" => "Category path Skroutz",
450
+ "one_category" => "Yoast / Rankmath primary category",
451
  "condition" => "Condition",
452
  "availability" => "Availability",
453
+ "stock_status" => "Stock Status WooCommerce",
454
+ "quantity" => "Quantity [Stock]",
455
  "price" => "Price",
456
  "regular_price" => "Regular price",
457
  "sale_price" => "Sale price",
475
  "vivino_sale_price" => "Pinterest / Vivino sale price",
476
  "vivino_regular_price" => "Pinterest / Vivino regular price",
477
  "non_geo_wcml_price" => "Non GEO WCML price",
478
+ "mm_min_price" => "Mix & Match minimum price",
479
+ "mm_min_regular_price" => "Mix & Match minimum regular price",
480
+ "mm_max_price" => "Mix & Match maximum price",
481
+ "mm_max_regular_price" => "Mix & Match maximum regular price",
482
+ "discount_percentage" => "Discount percentage",
483
  "item_group_id" => "Item group ID",
484
  "weight" => "Weight",
485
  "width" => "Width",
487
  "length" => "Length",
488
  "shipping" => "Shipping",
489
  "shipping_price" => "Shipping cost",
490
+ "lowest_shipping_costs" => "Lowest shipping costs",
491
+ "shipping_label" => "Shipping class slug",
492
+ "shipping_label_name" => "Shipping class name",
493
  "visibility" => "Visibility",
494
  "rating_total" => "Total rating",
495
  "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,61 @@ 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 +187,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 +213,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
  }
@@ -256,9 +269,13 @@ class WooSEA_Get_Products {
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
  }
@@ -324,7 +341,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 +380,15 @@ class WooSEA_Get_Products {
363
  return $chain;
364
  }
365
 
 
 
 
 
 
 
 
 
 
366
  /**
367
  * Get all configured shipping zones
368
  */
@@ -652,7 +678,7 @@ 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;
@@ -712,6 +738,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'])){
@@ -743,7 +771,7 @@ class WooSEA_Get_Products {
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;
@@ -754,22 +782,22 @@ class WooSEA_Get_Products {
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 +815,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")){
@@ -931,6 +1027,16 @@ class WooSEA_Get_Products {
931
  unset($shipping_cost);
932
  }
933
  }
 
 
 
 
 
 
 
 
 
 
934
  }
935
 
936
  if(isset($zone_details)){
@@ -948,7 +1054,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 +1068,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 +1100,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 +1120,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
  }
@@ -1141,20 +1254,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)){
@@ -1317,10 +1434,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 +1472,203 @@ 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');
@@ -1676,11 +1802,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
  */
@@ -1747,6 +1872,7 @@ class WooSEA_Get_Products {
1747
  }
1748
 
1749
  if(is_object($xml)){
 
1750
  $xml->asXML($file);
1751
  }
1752
  unset($product);
@@ -1798,7 +1924,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 +1941,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 +2006,7 @@ class WooSEA_Get_Products {
1880
  fwrite($fp, $tab_line);
1881
  }
1882
  } else {
 
1883
  $tofile = fputcsv($fp, $pieces, $csv_delimiter, '"');
1884
  }
1885
 
@@ -1993,7 +2120,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 +2168,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 +2202,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 +2242,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 +2403,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 +2444,19 @@ 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 +2492,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 +2506,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 +2514,18 @@ 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
  /**
@@ -2358,6 +2534,7 @@ class WooSEA_Get_Products {
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") {
@@ -2430,6 +2607,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 +2618,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 +2631,57 @@ 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 +2693,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 +2734,16 @@ 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'])){
@@ -2557,21 +2773,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 +2799,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);
@@ -2690,6 +2912,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 +2937,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,15 +2962,43 @@ 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){
@@ -2735,15 +3009,15 @@ class WooSEA_Get_Products {
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 +3025,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 +3034,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 +3049,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 +3136,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 +3146,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,7 +3160,6 @@ 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
  }
@@ -2928,7 +3225,15 @@ class WooSEA_Get_Products {
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'];
@@ -2977,7 +3282,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 +3300,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
 
@@ -3028,9 +3333,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
 
@@ -3106,23 +3411,27 @@ 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 +3569,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 +3603,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;
@@ -3440,14 +3752,32 @@ 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
  */
@@ -3513,16 +3843,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 +3868,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 +3882,79 @@ 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 +3988,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 +4060,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 +4244,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 +4281,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 +4551,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 +4811,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 +5312,531 @@ 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'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
112
+
113
+ $review['reviewer_id'] = $review_raw->user_id;
114
+ $review['review_timestamp'] = $review_raw->comment_date;
115
+
116
+ // Remove strange characters from review title
117
+ $review['title'] = empty($product_data['title']) ? '' : $product_data['title'];
118
+ $review['title'] = $this->rip_tags($review['title']);
119
+ $review['title'] = html_entity_decode((str_replace("\r", "", $review['title'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
120
+ $review['title'] = preg_replace( '/\[(.*?)\]/', ' ', $review['title'] );
121
+ $review['title'] = str_replace("&#xa0;", "", $review['title']);
122
+ $review['title'] = $this->woosea_utf8_for_xml( $review['title'] );
123
+
124
+ // Remove strange charchters from review content
125
+ $review['content'] = $review_raw->comment_content;
126
+ $review['content'] = $this->rip_tags($review['content']);
127
+ $review['content'] = html_entity_decode((str_replace("\r", "", $review['content'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
128
+ $review['content'] = preg_replace( '/\[(.*?)\]/', ' ', $review['content'] );
129
+ $review['content'] = str_replace("&#xa0;", "", $review['content']);
130
+ $review['content'] = $this->woosea_utf8_for_xml( $review['content'] );
131
+
132
+ $review['review_product_name'] = $product_data['title'];
133
+ $review['review_url'] = $product_data['link'];
134
+ $review['review_product_url'] = $product_data['link'];
135
+ array_push($approved_reviews, $review);
136
+ }
137
  }
138
  $review_count = $product->get_review_count();
139
  $review_average = $product->get_average_rating();
187
  if($feed_config['fields'] == "google_drm"){
188
  $utm_part .= "&$key=$value";
189
  } else {
190
+ $utm_part .= "&$key=$value";
191
  }
192
  }
193
 
213
  if($parentId > 0){
214
  # Even though variation products always have parameters in the URL we still need to check and make sure they are there
215
  if(strpos($link, '?') !== false){
216
+ $utm_part = "&".ltrim($utm_part, '&amp;');
217
  } else {
218
  $utm_part = "?".ltrim($utm_part, '&amp;');
219
  }
269
  } else {
270
  $product_attr = unserialize($value->type);
271
  if(!empty($product_attr)){
272
+ foreach ($product_attr as $key_inner => $arr_value) {
273
+ if(is_array($arr_value)){
274
+ if(!array_key_exists('name', $arr_value)){
275
+ $value_display = @str_replace("_", " ",$arr_value['name']);
276
+ $list[$key_inner] = ucfirst($value_display);
277
+ }
278
+ }
279
  }
280
  }
281
  }
341
  /**
342
  * Get category path (needed for Prisjakt)
343
  */
344
+ public function woosea_get_term_parents( $id, $taxonomy, string $link = null, $project_taxonomy, $nicename = false, $visited = array() ) {
345
  // Only add Home to the beginning of the chain when we start buildin the chain
346
  if(empty($visited)){
347
  $chain = 'Home';
380
  return $chain;
381
  }
382
 
383
+ /**
384
+ * Create a floatval for prices
385
+ */
386
+ public function woosea_floatvalue($val){
387
+ $val = str_replace(",",".",$val);
388
+ $val = preg_replace('/\.(?=.*\.)/', '', $val);
389
+ return floatval($val);
390
+ }
391
+
392
  /**
393
  * Get all configured shipping zones
394
  */
678
  /**
679
  * Get shipping cost for product
680
  */
681
+ public function woosea_get_shipping_cost ($class_cost_id, $project_config, $price, $tax_rates, $fullrate, $shipping_zones, $product_id, $item_group_id) {
682
  $shipping_cost = 0;
683
  $shipping_arr = array();
684
  $zone_count = 0;
738
  $shipping_methods = $zone['shipping_methods'];
739
 
740
  foreach ($shipping_methods as $k => $v){
741
+ $method = $v->method_title;
742
+ $shipping_rate_id = $v->instance_id;
743
 
744
  if($v->enabled == "yes"){
745
  if(empty($zone_details['country'])){
771
  if($taxable == "taxable"){
772
  foreach ($tax_rates as $k_inner => $w){
773
  if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
774
+ $rate = (($fullrate)/100);
775
 
776
  $shipping_cost = str_replace(",", ".", $shipping_cost);
777
  $shipping_cost = $shipping_cost*$rate;
782
  }
783
  }
784
 
785
+ // WooCommerce Table Rate - Bolder Elements
786
+ if($method == "Table Rate"){
787
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
788
+ // Set shipping cost
789
+ $shipping_cost = 0;
790
+ if(!empty($product_id)){
791
+ // Add product to cart
792
+ if ((isset($product_id)) AND ($product_id > 0)){
793
+ $quantity = 1;
794
+ if(!empty($code_from_config)){
795
+ defined( 'WC_ABSPATH' ) || exit;
796
+
797
+ // Load cart functions which are loaded only on the front-end.
798
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
799
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
800
+
801
  wc_load_cart();
802
 
803
  WC()->customer->set_shipping_country( $code_from_config );
815
  // Read cart and get schipping costs
816
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
817
  $total_cost = WC()->cart->get_total();
818
+ $shipping_cost = WC()->cart->get_shipping_total();
819
+ $shipping_tax = WC()->cart->get_shipping_tax();
820
+ $shipping_cost = ($shipping_cost+$shipping_tax);
821
  $shipping_cost = wc_format_localized_price($shipping_cost);
822
+ }
 
823
  // Make sure to empty the cart again
824
  WC()->cart->empty_cart();
825
+ }
826
+ }
827
+ }
828
+ }
829
+ }
830
+
831
+ // Official WooCommerce Table Rate plugin
832
+ if($method == "Table rates"){
833
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
834
+ // Set shipping cost
835
+ $shipping_cost = 0;
836
+ if(!empty($product_id)){
837
+ // Add product to cart
838
+ if ((isset($product_id)) AND ($product_id > 0)){
839
+ $quantity = 1;
840
+ if(!empty($code_from_config)){
841
+ defined( 'WC_ABSPATH' ) || exit;
842
+
843
+ // Load cart functions which are loaded only on the front-end.
844
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
845
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
846
+
847
+ wc_load_cart();
848
+
849
+ WC()->shipping()->reset_shipping();
850
+ WC()->customer->set_shipping_country( $code_from_config );
851
+
852
+ if(isset($zone_details['region'])){
853
+ WC()->customer->set_shipping_state(wc_clean( $zone_details['region'] ));
854
+ }
855
+
856
+ if(isset($zone_details['postal_code'])){
857
+ WC()->customer->set_shipping_postcode(wc_clean( $zone_details['postal_code'] ));
858
+ }
859
+ WC()->cart->add_to_cart( $product_id, $quantity );
860
+
861
+ // Read cart and get schipping costs
862
+ foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
863
+ // Loop though shipping packages
864
+ foreach ( WC()->shipping->get_packages() as $key => $package ) {
865
+ // Loop through Shipping rates
866
+ foreach($package['rates'] as $rate_id => $rate ){
867
+ if($rate->instance_id == $shipping_rate_id){
868
+ $shipping_cost = $rate->cost;
869
+ }
870
+ }
871
+ }
872
+ $shipping_tax = WC()->cart->get_shipping_tax();
873
+ $shipping_cost = ($shipping_cost+$shipping_tax);
874
+ $shipping_cost = wc_format_localized_price($shipping_cost);
875
+ }
876
+
877
+ if($taxable == "taxable"){
878
+ foreach ($tax_rates as $k_inner => $w){
879
+ if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
880
+ $rate = (($w['rate']+100)/100);
881
+
882
+ $shipping_cost = str_replace(",", ".", $shipping_cost);
883
+ $shipping_cost = $shipping_cost*$rate;
884
+ $shipping_cost = round($shipping_cost, 2);
885
+ $shipping_cost = wc_format_localized_price($shipping_cost);
886
+ }
887
+ }
888
+ }
889
+
890
+ // Make sure to empty the cart again
891
+ WC()->cart->empty_cart();
892
+ }
893
+ }
894
+ }
895
+ }
896
+ }
897
 
898
  // CLASS SHIPPING COSTS
899
  if((isset($v->instance_settings[$class_cost_id])) AND ($class_cost_id != "no_class_cost")){
1027
  unset($shipping_cost);
1028
  }
1029
  }
1030
+
1031
+ // User do not want to have free shipping in their feed
1032
+ $remove_free_shipping = "no";
1033
+ $remove_free_shipping = get_option ('remove_free_shipping');
1034
+
1035
+ if($remove_free_shipping == "yes"){
1036
+ unset($zone_details['service']);
1037
+ unset($zone_details['price']);
1038
+ unset($shipping_cost);
1039
+ }
1040
  }
1041
 
1042
  if(isset($zone_details)){
1054
  }
1055
  }
1056
  }
1057
+
1058
+ // For Heureka remove currency
1059
+ if($project_config['fields'] == "heureka"){
1060
+ $currency = "";
1061
+ }
1062
+
1063
  if(isset($shipping_cost)){
1064
  if(strlen($shipping_cost) > 0){
1065
  if($project_config['ship_suffix'] == "false"){
1068
  $zone_details['price'] = trim($shipping_cost);
1069
  }
1070
  } else {
 
1071
  if(isset($shipping_cost)){
1072
  $zone_details['price'] = trim($currency." ".$shipping_cost);
1073
  }
 
 
1074
  }
1075
  }
1076
  }
1100
 
1101
  // Remove other shipping classes when free shipping is relevant
1102
  $free_check = "yes";
 
1103
 
1104
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
1105
  foreach($shipping_arr as $k => $v) {
1106
  if(!in_array($free_check, $v)){
1107
+
1108
+ // User do not want to have free shipping in their feed
1109
+ // Only remove the other shipping classes when free shipping is not being removed
1110
+ $remove_free_shipping = "no";
1111
+ $remove_free_shipping = get_option ('remove_free_shipping');
1112
+
1113
+ if($remove_free_shipping == "no"){
1114
+ unset($shipping_arr[$k]);
1115
+ }
1116
  }
1117
  }
1118
  }
1120
  // Fix empty services
1121
  foreach($shipping_arr as $k => $v){
1122
  if(empty($v['service'])){
 
 
1123
  unset($shipping_arr[$k]);
1124
  }
1125
  }
1254
  $link = $product->addChild('g:additional_image_link', $v, $namespace['g']);
1255
  //$product->$k = $v;
1256
  } elseif (preg_match("/g:product_highlight/i",$k)){
1257
+ $v = preg_replace('/&/', '&#38;', $v);
1258
  $product_highlight = $product->addChild('g:product_highlight', $v, $namespace['g']);
1259
  } elseif (preg_match("/g:product_detail/i",$k)){
1260
  if(!empty($v)){
1261
  $product_detail_split = explode("#", $v);
1262
+ $detail_complete = count($product_detail_split);
1263
+ if($detail_complete == 2){
1264
+ $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1265
+ $name = str_replace("_", " ", $product_detail_split[0]);
1266
+
1267
+ $section_name = explode(":", $name);
1268
+ $section_name_start = ucfirst($section_name[0]);
1269
+ $name = ucfirst(trim($section_name[1]));
1270
+
1271
+ $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1272
+ $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1273
+ $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
1274
+ }
1275
  }
1276
  } elseif ($k == "g:installment"){
1277
  if(!empty($v)){
1434
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><products></products>');
1435
  $xml->addAttribute('version', '1.0');
1436
  $xml->addAttribute('standalone', 'yes');
1437
+ //$xml->addChild('datetime', date('Y-m-d H:i:s'));
1438
+ //$xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1439
+ //$xml->addChild('link', site_url());
1440
+ //$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 ');
1441
  $xml->asXML($file);
1442
  }
1443
  } else {
1472
 
1473
  // For Google Product review template
1474
  if (($feed_config['name'] == "Google Product Review") AND (empty($xml->channel))) {
1475
+
1476
+ if(!is_bool($xml)){
1477
+ $product = $xml->addChild('reviews');
1478
 
1479
+ foreach ($products as $key => $value){
1480
 
1481
+ $expl = "||";
1482
+ if(strpos($value['reviews'], $expl)) {
1483
+ $review_data = explode("||", $value['reviews']);
1484
+ foreach($review_data as $rk => $rv){
1485
 
1486
+ $review_comp = explode(":::", $rv);
1487
+ $nr_reviews = count($review_comp);
1488
 
1489
+ if($nr_reviews > 1){
1490
+ $productz = $xml->reviews->addChild('review');
1491
 
1492
+ foreach($review_comp as $rck => $rcv){
1493
+ $nodes = explode("##", $rcv);
1494
+ $nodes = str_replace("::", "", $nodes);
1495
 
1496
+ if($nodes[0] == "REVIEW_RATINGS"){
1497
+ // Do nothing
1498
+ } elseif($nodes[0] == "REVIEW_URL"){
1499
+ $rev_url = $productz->addChild(strtolower($nodes[0]), htmlspecialchars($nodes[1]));
1500
+ $rev_url->addAttribute('type', 'singleton');
1501
+ } elseif(($nodes[0] == "REVIEWER_NAME") OR ($nodes[0] == "REVIEWER_ID")){
1502
+ if(isset($productz->reviewer)){
1503
+ if($nodes[0] == "REVIEWER_NAME"){
1504
+ $name = $nodes[1];
1505
+ if(empty($name)){
1506
+ $reviewer->addChild('name','Anonymous');
1507
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1508
+ } else {
1509
+ $reviewer->addChild('name',$name);
1510
+ }
1511
  } else {
1512
+ if(is_numeric($nodes[1])){
1513
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1514
+ }
1515
  }
1516
  } else {
1517
+ $reviewer = $productz->addChild('reviewer');
1518
+ if($nodes[0] == "REVIEWER_NAME"){
1519
+ $name = $nodes[1];
1520
+ if(empty($name)){
1521
+ $reviewer->addChild('name','Anonymous');
1522
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1523
+ } else {
1524
+ $reviewer->addChild('name',$name);
1525
+ }
1526
  } else {
1527
+ if(is_numeric($nodes[1])){
1528
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1529
+ }
1530
  }
 
 
1531
  }
1532
+ } else {
1533
+ if(isset($nodes[1])){
1534
+ $content = html_entity_decode($nodes[1]);
1535
+ $content = htmlspecialchars($content);
1536
+ $rev = $productz->addChild(strtolower($nodes[0]), $content);
1537
+ }
1538
  }
1539
  }
 
1540
 
1541
+ foreach($review_comp as $rck => $rcv){
1542
+ $nodes = explode("##", $rcv);
1543
+ $nodes = str_replace("::", "", $nodes);
1544
 
1545
+ if($nodes[0] == "REVIEW_RATINGS"){
1546
+ $rev = $productz->addChild('ratings');
1547
+ $over = $productz->ratings->addChild('overall', $nodes[1]);
1548
+ $over->addAttribute('min', '1');
1549
+ $over->addAttribute('max', '5');
1550
+ }
1551
  }
 
 
1552
 
1553
+ $yo = $productz->addChild('products');
1554
+ $po = $yo->addChild('product');
1555
 
1556
+ $identifiers = array("gtin","mpn","sku","brand");
1557
 
1558
+ // Start determining order of product_ids in the Google review feed
1559
+ $proper_order = array("product_name","gtin","mpn","sku","brand","product_url","review_url","reviews");
1560
+ $order_sorted = array();
1561
+ foreach ($proper_order as &$order_value){
1562
+ if(isset($value[$order_value])){
1563
+ $order_sorted[$order_value] = $value[$order_value];
1564
+ }
1565
  }
1566
+ // End
1567
+
1568
+ foreach($order_sorted as $k => $v) {
1569
+ if(($k != "product_name") AND ($k != "product_url")){
1570
+ if(!in_array($k, $identifiers)){
1571
+ if(($k != "reviews") AND ($k != "review_url")){
1572
+ if($k != "product_url"){
1573
+ $v = str_replace("&", "and", $v);
1574
+ }
1575
+ $poa = $po->addChild($k,htmlspecialchars($v));
1576
+ }
1577
+ } else {
1578
+ if(isset($po->product_ids)){
1579
+ if ($k == "gtin"){
1580
+ $poig = $poi->addChild('gtins');
1581
+ $poig->$k = $v;
1582
+ } elseif ($k == "mpn"){
1583
+ $poim = $poi->addChild('mpns');
1584
+ $poim->$k = $v;
1585
+ } elseif ($k == "sku"){
1586
+ $poix = $poi->addChild('skus');
1587
+ $poix->$k = $v;
1588
+ } elseif($k == "brand"){
1589
+ $poib = $poi->addChild('brands');
1590
+ $poib->$k = $v;
1591
+ } else {
1592
+ // Do nothing
1593
+ }
1594
+ } else {
1595
+ $poi = $po->addChild('product_ids');
1596
+ if ($k == "gtin"){
1597
+ $poig = $poi->addChild('gtins');
1598
+ $poig->$k = $v;
1599
+ } elseif ($k == "mpn"){
1600
+ $poim = $poi->addChild('mpns');
1601
+ $poim->$k = $v;
1602
+ } elseif ($k == "sku"){
1603
+ $poix = $poi->addChild('skus');
1604
+ $poix->$k = $v;
1605
+ } elseif($k == "brand"){
1606
+ $poib = $poi->addChild('brands');
1607
+ $poib->$k = $v;
1608
+ } else {
1609
+ // Do nothing
1610
+ }
1611
  }
1612
+ }
1613
+ }
1614
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1615
 
1616
+ // foreach for product name and product url as order seems to mather to Google
1617
+ foreach($value as $k => $v) {
1618
+ if(($k == "product_name") OR ($k == "product_url")){
1619
+ if(!in_array($k, $identifiers)){
1620
+ if(($k != "reviews") AND ($k != "review_url")){
1621
+ if($k != "product_url"){
1622
+ $v = str_replace("&", "and", $v);
1623
+ }
1624
+ $poa = $po->addChild($k,htmlspecialchars($v));
1625
+ }
1626
+ } else {
1627
+ if(isset($po->product_ids)){
1628
+ if ($k == "gtin"){
1629
+ $poig = $poi->addChild('gtins');
1630
+ $poig->$k = $v;
1631
+ } elseif ($k == "mpn"){
1632
+ $poim = $poi->addChild('mpns');
1633
+ $poim->$k = $v;
1634
+ } elseif($k == "sku"){
1635
+ $poix = $poi->addChild('skus');
1636
+ $poix->$k = $v;
1637
+ } elseif($k == "brand"){
1638
+ $poib = $poi->addChild('brands');
1639
+ $poib->$k = $v;
1640
+ } else {
1641
+ // Do nothing
1642
+ }
1643
+ } else {
1644
+ $poi = $po->addChild('product_ids');
1645
+ if ($k == "gtin"){
1646
+ $poig = $poi->addChild('gtins');
1647
+ $poig->$k = $v;
1648
+ } elseif ($k == "mpn"){
1649
+ $poim = $poi->addChild('mpns');
1650
+ $poim->$k = $v;
1651
+ } elseif ($k == "sku"){
1652
+ $poix = $poi->addChild('skus');
1653
+ $poix->$k = $v;
1654
+ } elseif($k == "brand"){
1655
+ $poib = $poi->addChild('brands');
1656
+ $poib->$k = $v;
1657
+ } else {
1658
+ // Do nothing
1659
+ }
1660
  }
1661
+ }
1662
+ }
1663
+ }
1664
+ }
1665
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1666
  }
1667
  }
1668
  }
1669
  }
1670
 
1671
  foreach ($products as $key => $value){
 
1672
  if ((is_array ( $value )) and (!empty( $value ))) {
1673
  if ($feed_config['name'] == "Yandex") {
1674
  $product = $xml->shop->offers->addChild('offer');
1802
  $product->addChild("$k");
1803
  $product->$k = $v;
1804
  } else {
1805
+ if (($feed_config['fields'] != 'standard') AND ($feed_config['fields'] != "customfeed")){
1806
  $k = $this->get_alternative_key ($channel_attributes, $k);
1807
  }
1808
  if(!empty($k)){
 
1809
  /**
1810
  * Some Zbozi and Heureka attributes need some extra XML nodes
1811
  */
1872
  }
1873
 
1874
  if(is_object($xml)){
1875
+ //$xml = html_entity_decode($xml->asXML());
1876
  $xml->asXML($file);
1877
  }
1878
  unset($product);
1924
  $channel_attributes = get_option('channel_attributes');
1925
  }
1926
  }
1927
+
1928
  // Append or write to file
1929
  $fp = fopen($file, 'a+');
1930
 
1941
  $pieces = str_replace("'", "", $pieces);
1942
 
1943
  foreach ($pieces as $k_inner => $v){
1944
+ if (($feed_config['fields'] != 'standard') AND ($feed_config['fields'] != "customfeed")){
1945
  $v = $this->get_alternative_key ($channel_attributes, $v);
1946
  }
1947
 
2006
  fwrite($fp, $tab_line);
2007
  }
2008
  } else {
2009
+ $pieces = array_map('trim', $pieces);
2010
  $tofile = fputcsv($fp, $pieces, $csv_delimiter, '"');
2011
  }
2012
 
2120
  $xml_piece = "";
2121
 
2122
  // Get taxonomies
2123
+ $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");
2124
  $taxonomies = get_taxonomies();
2125
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
2126
 
2168
  }
2169
  }
2170
 
2171
+ // Get WooCommerce categories
2172
+ $product_categories = get_terms( 'product_cat', 'hide_empty=0' );
2173
+ $prod_cats = array();
2174
+ if ( ! empty( $product_categories ) && ! is_wp_error( $product_categories ) ) {
2175
+ foreach ( $product_categories as $category ) {
2176
+ $prod_cats[$category->slug] = $category->name;
2177
+ }
2178
+ }
2179
+
2180
+ // Get Fiters on categories
2181
+ $prod_cats_slugs = array();
2182
+ if(isset($project_config['rules'])){
2183
+ foreach ($project_config['rules'] as $rule){
2184
+ if(($rule['attribute'] == "categories") AND ($rule['condition'] == "=")){
2185
+ $slug = array_search($rule['criteria'], $prod_cats);
2186
+ array_push($prod_cats_slugs, $slug);
2187
+ }
2188
+ }
2189
+ }
2190
+
2191
+ $product_cat = "";
2192
+ if(count($prod_cats_slugs) > 0){
2193
+ foreach ( $prod_cats_slugs as $cat_slug ){
2194
+ $product_cat .= $cat_slug .",";
2195
+ }
2196
+ }
2197
+
2198
  // Construct WP query
2199
  $wp_query = array(
2200
  'posts_per_page' => $offset_step_size,
2202
  'post_type' => $post_type,
2203
  'post_status' => 'publish',
2204
  'fields' => 'ids',
2205
+ 'no_found_rows' => true,
2206
+ // 'product_cat' => $product_cat
2207
+ );
2208
+
2209
  $prods = new WP_Query($wp_query);
2210
  $shipping_zones = $this->woosea_get_shipping_zones();
2211
 
2242
  if(!in_array($product_data['id'], $allowed_product_orders)){ continue; }
2243
  }
2244
  }
 
2245
  $product_data['title'] = $product->get_title();
2246
+ $product_data['title'] = $this->woosea_utf8_for_xml( $product_data['title'] );
2247
  $product_data['mother_title'] = $product->get_title();
2248
  $product_data['mother_title'] = $this->woosea_utf8_for_xml( $product_data['mother_title'] );
2249
  $product_data['title_hyphen'] = $product_data['title'];
2403
  // Check if there are mother categories
2404
  if(!empty($product_cat)){
2405
  $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
 
 
2406
 
2407
+ if(!is_object($category_path)){
2408
+ $category_path_skroutz = preg_replace('/&gt;/', '>', $category_path);
2409
  $product_data['category_path'] = $category_path;
2410
  $product_data['category_path_skroutz'] = $category_path_skroutz;
2411
  $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
2444
  }
2445
  }
2446
 
2447
+ // Get the RankMath primary category
2448
+ if ($this->woosea_is_plugin_active('seo-by-rank-math/rank-math.php')){
2449
+ $item_id = $product_data['id'];
2450
+ if($product_data['item_group_id'] > 0){
2451
+ $item_id = $product_data['item_group_id'];
2452
+ }
2453
+ $primary_cat_id = get_post_meta( $item_id, 'rank_math_primary_product_cat', true );
2454
+ if ( $primary_cat_id ) {
2455
+ $product_cat = get_term( $primary_cat_id, 'product_cat' );
2456
+ $product_data['one_category'] = $product_cat->name;
2457
+ }
2458
+ }
2459
+
2460
  $product_data['category_path_short'] = str_replace("Home &gt;","",$product_data['category_path']);
2461
  $product_data['category_path_short'] = str_replace("&gt;",">",$product_data['category_path_short']);
2462
  $product_data['category_link'] = $catlink;
2492
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2493
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2494
 
2495
+ // Parent variable description
2496
+ $product_data['mother_description'] = $product_data['description'];
2497
+ $product_data['mother_short_description'] = $product_data['short_description'];
2498
+
2499
  /**
2500
  * Check of we need to add Google Analytics UTM parameters
2501
  */
2506
  }
2507
 
2508
  $product_data['link'] = get_permalink( $product_data['id'])."$utm_part";
2509
+ $product_data['link_no_tracking'] = get_permalink( $product_data['id']);
2510
  $variable_link = htmlspecialchars(get_permalink( $product_data['id']));
2511
  $vlink_piece = explode("?", $variable_link);
2512
  $qutm_part = ltrim($utm_part, "&amp;");
2514
  $qutm_part = ltrim($qutm_part, "?");
2515
  if($qutm_part){
2516
  $product_data['variable_link'] = $vlink_piece[0]."?".$qutm_part;
2517
+ $product_data['link_no_tracking'] = $vlink_piece[0];
2518
  } else {
2519
  $product_data['variable_link'] = $vlink_piece[0];
2520
+ $product_data['link_no_tracking'] = $vlink_piece[0];
2521
  }
2522
 
2523
  $product_data['condition'] = ucfirst( get_post_meta( $product_data['id'], '_woosea_condition', true ) );
2524
  if(empty($product_data['condition']) || $product_data['condition'] == "Array"){
2525
  $product_data['condition'] = "New";
2526
  }
2527
+
2528
+ // get_stock only works as of WC 5 and higher?
2529
  $product_data['availability'] = $this->get_stock( $this->childID );
2530
 
2531
  /**
2534
  * Therefor, we need to check the stock_status and overwrite te availability value
2535
  */
2536
  $stock_status = $product->get_stock_status();
2537
+ $product_data['stock_status'] = $stock_status;
2538
  if ($stock_status == "outofstock"){
2539
  $product_data['availability'] = "out of stock";
2540
  } elseif ($stock_status == "onbackorder") {
2607
 
2608
  $product_data['shipping'] = 0;
2609
  $tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class() );
2610
+ $all_standard_taxes = WC_Tax::get_rates_for_tax_class( '' );
2611
+
2612
  $shipping_class_id = $product->get_shipping_class_id();
2613
  $shipping_class= $product->get_shipping_class();
2614
 
2618
  }
2619
 
2620
  $product_data['shipping_label'] = $product->get_shipping_class();
2621
+ $term = get_term_by( 'slug', $product->get_shipping_class(), 'product_shipping_class' );
2622
+ if(is_object($term)){
2623
+ $product_data['shipping_label_name'] = $term->name;
2624
+ }
2625
 
2626
  // Get product prices
2627
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2631
  $product_data['regular_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_regular_price()));
2632
  $product_data['regular_price'] = wc_format_decimal($product_data['regular_price'],2);
2633
 
2634
+ // Untouched raw system pricing - DO NOT CHANGE THESE
2635
+ $float_system_net_price = floatval(wc_get_price_excluding_tax( $product ));
2636
+ $product_data['system_net_price'] = round($float_system_net_price, 2);
2637
+ $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2638
+
2639
+ // System regular price
2640
+ $float_system_regular_price = floatval($product->get_regular_price());
2641
+ $product_data['system_regular_price'] = round($float_system_regular_price,2);
2642
+ $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2643
+
2644
+ // System sale price
2645
+ $float_system_sale_price = floatval($product->get_sale_price());
2646
+ if($float_system_sale_price > 0){
2647
+ $product_data['system_sale_price'] = round($float_system_sale_price,2);
2648
+ $product_data['system_sale_price'] = wc_format_decimal($product_data['system_sale_price'],2);
2649
+ $sale_price = $product_data['system_sale_price'];
2650
+ }
2651
 
2652
+ $code_from_config = $this->woosea_country_to_code($project_config['countries']);
2653
 
2654
+ $nr_standard_rates = count($all_standard_taxes);
2655
+ if(!empty($all_standard_taxes) AND ($nr_standard_rates > 1)){
2656
+ foreach ($all_standard_taxes as $rate){
2657
+ $rate_arr = get_object_vars($rate);
2658
+ if($rate_arr['tax_rate_country'] == $code_from_config){
2659
+ $tax_rates[1]['rate'] = $rate_arr['tax_rate'];
2660
+ }
2661
+ }
2662
+ } else {
2663
+ if(!empty($tax_rates)){
2664
+ foreach ($tax_rates as $tk => $tv){
2665
+ if($tv['rate'] > 0){
2666
+ $tax_rates[1]['rate'] = $tv['rate'];
2667
+ } else {
2668
+ $tax_rates[1]['rate'] = 0;
2669
+ }
2670
  }
2671
+ } else {
2672
+ $tax_rates[1]['rate'] = 0;
2673
+ }
2674
+ }
2675
+
2676
+ if(empty($tax_rates[1]['rate'])){
2677
+ if(!empty($all_standard_taxes) AND ($nr_standard_rates > 1)){
2678
+ foreach ($all_standard_taxes as $rate){
2679
+ $rate_arr = get_object_vars($rate);
2680
+ if($rate_arr['tax_rate_country'] == ""){
2681
+ $tax_rates[1]['rate'] = $rate_arr['tax_rate'];
2682
+ }
2683
+ }
2684
  }
 
 
2685
  }
2686
 
2687
  $fullrate = 100+$tax_rates[1]['rate'];
2693
  if($product->get_type() == "bundle"){
2694
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2695
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
2696
+ $product_data['sale_price'] = get_post_meta($product_data['id'], '_sale_price', true);
2697
  if(is_numeric($tax_rates[1]['rate'])){
2698
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2699
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2734
 
2735
  // Make sure the product ID is not NULL either
2736
  global $woocommerce_wpml;
2737
+ if(!is_null($project_config['WCML'])){
2738
+ //$product_data['non_geo_wcml_price'] = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $product_data['id'], $project_config['WCML'] );
2739
+ $product_data['non_geo_wcml_price'] = wc_format_decimal(get_post_meta( $product_data['id'], '_regular_price', true),2);
2740
+ $product_data['non_geo_wcml_price'] = wc_format_localized_price($product_data['non_geo_wcml_price']);
2741
+ $non_geo_sale = get_post_meta( $product_data['id'], '_sale_price', true );
2742
+ if(!empty($non_geo_sale)){
2743
+ $product_data['non_geo_wcml_sale_price'] = wc_format_decimal(get_post_meta( $product_data['id'], '_sale_price', true),2);
2744
+ $product_data['non_geo_wcml_sale_price'] = wc_format_localized_price($product_data['non_geo_wcml_sale_price']);
2745
+ }
2746
+ }
2747
 
2748
  // When WCML manual prices have been entered
2749
  if(!is_null($product_data['id'])){
2773
  }
2774
  if($product->get_regular_price()){
2775
  $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);
2776
+ $product_data['net_regular_price'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())),2);
2777
+ //$product_data['net_regular_price'] = ($product->get_regular_price()/$fullrate)*100;
2778
+ //$product_data['net_regular_price'] = round($product_data['net_regular_price'],2);
2779
  }
2780
  if($product->get_sale_price()){
2781
  $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);
2782
+ $product_data['net_sale_price'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())),2);
2783
+
 
2784
  // We do not want to have 0 sale price values in the feed
2785
  if($product_data['net_sale_price'] == 0){
2786
  $product_data['net_sale_price'] = "";
2787
  }
2788
  }
2789
+ $float_net_price = floatval(wc_get_price_excluding_tax( $product ));
2790
+ $product_data['net_price'] = round($float_net_price, 2);
2791
+ $product_data['net_price'] = wc_format_decimal($product_data['net_price'],2);
2792
+
2793
  $price = wc_get_price_including_tax($product,array('price'=> $product->get_price()));
2794
  if($product_data['sale_price'] > 0){
2795
  $price = $product_data['sale_price'];
2799
  if ($this->woosea_is_plugin_active('woo-discount-rules/woo-discount-rules.php')){
2800
  $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);
2801
  if($discount !== false){
2802
+ // round discounted price on 2 decimals
2803
+ $discount = round($discount,2);
2804
+
2805
  $product_data['sale_price'] = $discount;
2806
+ $product_data['price'] = $discount;
2807
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2808
  if($price_incl_tax == "yes"){
2809
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
2912
  }
2913
  }
2914
 
2915
+ // Is the Mix and Match plugin active
2916
+ if ($this->woosea_is_plugin_active('woocommerce-mix-and-match-products/woocommerce-mix-and-match-products.php')){
2917
+ if($product->is_type('mix-and-match')){
2918
+ if($product_data['price'] == "0.00"){
2919
+ $product_data['price'] = "";
2920
+ $product_data['regular_price'] = "";
2921
+ }
2922
+
2923
+ // Get minimum prices
2924
+ $product_data['mm_min_price'] = wc_format_localized_price($product->get_mnm_price());
2925
+ $product_data['mm_min_regular_price'] = wc_format_localized_price($product->get_mnm_regular_price());
2926
+
2927
+ // Get maximum prices
2928
+ $product_data['mm_max_price'] = wc_format_localized_price($product->get_mnm_price('max'));
2929
+ $product_data['mm_max_regular_price'] = wc_format_localized_price($product->get_mnm_regular_price('max'));
2930
+ }
2931
+ }
2932
+
2933
  // Localize the price attributes
2934
  $decimal_separator = wc_get_price_decimal_separator();
2935
  $product_data['price'] = wc_format_localized_price($product_data['price']);
2937
  $product_data['sale_price'] = wc_format_localized_price($product_data['sale_price']);
2938
  if($product->get_price()){
2939
  $product_data['price_forced'] = wc_format_localized_price($product_data['price_forced']);
2940
+ //$product_data['price_forced'] = (float)$product_data['price_forced'];
2941
+ //$product_data['price_forced_rounded'] = round($product_data['price_forced'],0);
2942
  }
2943
  if($product->get_regular_price()){
2944
  $product_data['regular_price_forced'] = wc_format_localized_price($product_data['regular_price_forced']);
2945
+ //$product_data['regular_price_forced'] = (float)$product_data['regular_price_forced'];
2946
+ //$product_data['regular_price_forced_rounded'] = round($product_data['regular_price_forced'],0);
2947
  }
2948
  if($product->get_sale_price()){
2949
  $product_data['sale_price_forced'] = wc_format_localized_price($product_data['sale_price_forced']);
2950
+ //$product_data['sale_price_forced_rounded'] = round($product_data['sale_price_forced'],0);
2951
+
2952
  }
2953
  $product_data['net_price'] = wc_format_localized_price($product_data['net_price']);
2954
 
2962
  $product_data['net_sale_price'] = wc_format_localized_price($product_data['net_sale_price']);
2963
  }
2964
 
2965
+ if(!empty($product_data['system_price'])){
2966
+ $product_data['system_price'] = wc_format_localized_price($product_data['system_price']);
2967
+ }
2968
+
2969
+ if(!empty($product_data['system_net_price'])){
2970
+ $product_data['system_net_price'] = wc_format_localized_price($product_data['system_net_price']);
2971
+ }
2972
+
2973
+ if(!empty($product_data['system_regular_price'])){
2974
+ $product_data['system_regular_price'] = wc_format_localized_price($product_data['system_regular_price']);
2975
+ }
2976
+
2977
+ if(!empty($product_data['system_sale_price'])){
2978
+ $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
2979
+ }
2980
 
2981
  // Add rounded price options
2982
+ $decimal_separator = wc_get_price_decimal_separator();
2983
+ $float_price = floatval($product_data['price']);
2984
+ $float_regular_price = floatval($product_data['regular_price']);
2985
+ $float_sale_price = floatval($product_data['sale_price']);
2986
+
2987
+ if($decimal_separator == ","){
2988
+ $product_data['rounded_price'] = str_replace(',', '.', $product_data['price']);
2989
+ $product_data['rounded_price'] = round(number_format($product_data['rounded_price'], 2, '.', ''));
2990
+ $product_data['rounded_regular_price'] = str_replace(',', '.', $product_data['regular_price']);
2991
+ $product_data['rounded_regular_price'] = round(number_format($product_data['rounded_regular_price'], 2, '.', ''));
2992
+
2993
+ if($product_data['sale_price'] > 0){
2994
+ $product_data['rounded_sale_price'] = str_replace(',', '.', $product_data['sale_price']);
2995
+ $product_data['rounded_sale_price'] = round(number_format($product_data['rounded_sale_price'], 2, '.', ''));
2996
+ }
2997
+ } else {
2998
+ $product_data['rounded_price'] = round($float_price,0);
2999
+ $product_data['rounded_regular_price'] = (string) round($float_regular_price,0);
3000
+ $product_data['rounded_sale_price'] = round($float_sale_price,0);
3001
+ }
3002
 
3003
  // Calculate discount percentage
3004
  if($product_data['sale_price'] > 0){
3009
  if(is_array($attr_arr)){
3010
  if($attr_arr['attribute'] == "g:shipping"){
3011
  if($product_data['price'] > 0){
3012
+ $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']);
3013
  $shipping_str = $product_data['shipping'];
3014
  }
3015
  }
3016
  }
3017
  }
3018
 
3019
+ 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")){
3020
+ $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']);
3021
  $shipping_str = $product_data['shipping'];
3022
  }
3023
 
3025
  if(!empty($shipping_str)){
3026
  $product_data['shipping_price'] = 0;
3027
  }
3028
+ $lowest_shipping_price = array();
3029
+ $shipping_arr = $product_data['shipping'];
3030
 
3031
  if(is_array($shipping_arr)){
3032
  foreach($shipping_arr as $akey => $arr){
3034
  $pieces_ship = explode (" ", $arr['price']);
3035
  if(isset($pieces_ship['1'])){
3036
  $product_data['shipping_price'] = $pieces_ship['1'];
3037
+ $lowest_shipping_price[] = $pieces_ship['1'];
3038
  }
3039
  }
3040
 
3049
  }
3050
  }
3051
 
3052
+ // Get the lowest shipping costs
3053
+ if(!empty($lowest_shipping_price)){
3054
+ $decimal_separator = wc_get_price_decimal_separator();
3055
+ if($decimal_separator == ","){
3056
+ $numeric_lowest_shipping_price = array();
3057
+ foreach ($lowest_shipping_price as &$value) {
3058
+ $number = str_replace(',', '.', $value);
3059
+ if (is_numeric($number)) {
3060
+ $value = number_format($number, 2, '.', '');
3061
+ $numeric_lowest_shipping_price[] = $value;
3062
+ }
3063
+ }
3064
+ $lowest_shipping_price = $numeric_lowest_shipping_price;
3065
+ unset($value);
3066
+ }
3067
+ $product_data['lowest_shipping_costs'] = min($lowest_shipping_price);
3068
+
3069
+ if($decimal_separator == ","){
3070
+ $product_data['lowest_shipping_costs'] = str_replace('.', ',', $product_data['lowest_shipping_costs']);
3071
+ }
3072
+ }
3073
+
3074
  // Google Dynamic Remarketing feeds require the English price notation
3075
  if ($project_config['name'] == "Google Remarketing - DRM"){
3076
  $thousand_separator = wc_get_price_thousand_separator();
3136
 
3137
  foreach($diff_taxonomies as $taxo){
3138
  $term_value = get_the_terms($product_data['id'], $taxo);
3139
+ $product_data["$taxo"] = "";
3140
 
3141
  if(is_array($term_value)){
3142
  // Do not add variation values to the feed when they are out of stock
3146
  $variations = $product_skroutz->get_available_variations();
3147
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
3148
  $skroutz_att_array = array();
3149
+
3150
  foreach($variations_id as $var_id){
3151
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
3152
  if($stock_value == "instock"){
3160
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
3161
  }
3162
  }
 
3163
  foreach($skroutz_att_array as $skrtz_value){
3164
  $product_data[$taxo] .= ",". $skrtz_value;
3165
  }
3225
  foreach($custom_attributes as $custom_kk => $custom_vv){
3226
  $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
3227
  $new_key ="custom_attributes_" . $custom_kk;
3228
+
3229
+ // This is a ACF image field (PLEASE NOTE: the ACF field needs to contain image or bild in the name)
3230
+ if(preg_match("/image|bild/i", $custom_kk)) {
3231
+ if (class_exists('ACF') AND ($custom_value > 0)) {
3232
+ //$image = wp_get_attachment_image_src($custom_value, "large");
3233
+ $custom_value = $image[0];
3234
+ }
3235
+ }
3236
+
3237
  // Just to make sure the title is never empty
3238
  if(($custom_kk == "_aioseop_title") && ($custom_value == "")){
3239
  $custom_value = $product_data['title'];
3282
  $data = $wpdb->get_results($sql);
3283
  if (count($data)) {
3284
  foreach ($data as $key => $value) {
3285
+ $value_display = str_replace("_", " ",$value->name);
3286
  if (preg_match("/_product_attributes/i",$value->name)){
3287
  $product_attr = unserialize($value->type);
3288
  if(!empty($product_attr)){
3300
 
3301
  /**
3302
  * Get Product Attributes for Single products
3303
+ * These are the attributes users create themselves in WooCommerce
3304
  */
3305
+ 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')) OR ($product->is_type('variable')))){
3306
  $single_attributes = $product->get_attributes();
 
3307
  foreach ($single_attributes as $attribute){
3308
+ $attr_name = strtolower($attribute->get_name());
3309
+ $attr_value = $product->get_attribute($attr_name);
3310
+ $product_data[$attr_name] = $attr_value;
3311
  }
3312
  }
3313
 
3333
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3334
  $variations = $product_variations->get_variation_attributes();
3335
 
3336
+ // For Skroutz and Bestprice apparal products we can only append colours to the product name
3337
  // When a product has both a size and color attribute we assume its an apparal product
3338
+ if(($project_config['fields'] == "skroutz") OR ($project_config['fields'] == "bestprice")){
3339
  $size_found = "no";
3340
  $color_found = "no";
3341
 
3411
  }
3412
  }
3413
 
 
 
3414
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
 
3415
  // Determine the default variation product
3416
  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"))){
3417
+ $mother_product = new WC_Product_Variable($product_data['item_group_id']);
3418
+ //$mother_product = wc_get_product($product_data['item_group_id']);
3419
+ $def_attributes = $mother_product->get_default_attributes();
3420
 
3421
  if(isset($project_config['lowest_price_variations'])){
3422
+
3423
  // Determine lowest priced variation
3424
  $variation_min_price = $mother_product->get_variation_price('min');
3425
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3426
  $variation_min_price = wc_format_localized_price($variation_min_price);
3427
+ $var_price = get_post_meta($product_data['id'], '_price', true);
3428
+ $var_price = wc_format_decimal($var_price,2);
3429
+ $var_price = wc_format_localized_price($var_price);
3430
+ $variation_prices = $mother_product->get_variation_prices();
3431
+ $variation_prices_price = array_values($variation_prices['price']);
3432
+ $lowest_price = min($variation_prices_price);
3433
+
3434
+ 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)){
3435
  $variation_pass = "true";
3436
  } else {
3437
  $variation_pass = "false";
3569
  /**
3570
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3571
  */
3572
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3573
+ //if($stock_value == "instock"){
3574
  foreach($diff_taxonomies as $taxo){
3575
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3576
  unset($product_data[$taxo]);
3577
  if(is_array($term_value)){
3578
  foreach($term_value as $term){
3579
  if(empty($product_data[$taxo])){
3580
+ $product_data[$taxo] = $term->name;
3581
  } else {
3582
+ $product_data[$taxo] .= " ".$term->name;
3583
  }
3584
  }
3585
  }
3586
+ }
3587
 
3588
  /**
3589
  * Add product tags to the product data array
3603
 
3604
  // Add attribute values to the variation product names to make them unique
3605
  $product_data['title_hyphen'] = $product_data['title']." - ";
3606
+ $product_data['mother_title_hyphen'] = $product_data['mother_title']." - ";
3607
 
3608
  foreach($variations as $kk => $vv){
3609
  $custom_key = $kk;
3752
  * we will add CDATA brackets to the title and description attributes
3753
  */
3754
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
3755
+ $product_data['title_lcw'] = ucwords(strtolower($product_data['title']));
3756
+
3757
+ // Add CDATA to title and descriptions
3758
+ //$add_woosea_cdata = get_option ('add_woosea_cdata');
3759
+ //if($add_woosea_cdata == "yes"){
3760
+ // $product_data['title'] = $this->woosea_append_cdata ( $product_data['title'] );
3761
+ // $product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3762
+ // $product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3763
+ //}
3764
 
3765
  /**
3766
  * Get product reviews for Google Product Review Feeds
3767
  */
3768
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3769
 
3770
+ /**
3771
+ * Filter out reviews that do not have text
3772
+ */
3773
+ if(!empty($product_data['reviews'])){
3774
+ foreach($product_data['reviews'] as $review_id => $review_details){
3775
+ if(empty($review_details['content'])){
3776
+ unset($product_data['reviews'][$review_id]);
3777
+ }
3778
+ }
3779
+ }
3780
+
3781
  /**
3782
  * Check if individual products need to be excluded
3783
  */
3843
  // For these channels parent products are allowed
3844
  $allowed_channel_parents = array(
3845
  "skroutz",
3846
+ "bestprice",
3847
  "google_dsa",
3848
  "google_product_review",
3849
  );
3850
 
3851
+ if(array_key_exists('fields', $project_config)){
3852
+ if (!in_array($project_config['fields'], $allowed_channel_parents)){
3853
+ if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
3854
+ $product_data = array();
3855
+ $product_data = null;
3856
+ }
3857
+ }
3858
+ }
3859
 
3860
  /**
3861
  * Remove variation products that are not THE default variation product
3868
  /**
3869
  * And item_group_id is not allowed for simple products, prevent users from adding this to the feedd
3870
  */
3871
+ 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')) OR ($product->is_type('variable')))){
3872
  unset($product_data['item_group_id']);
3873
  }
3874
 
3882
  }
3883
  }
3884
 
3885
+ /**
3886
+ * Do final check on Skroutz out of stock sizes
3887
+ * When a size is not on stock remove it
3888
+ */
3889
+ if($project_config['fields'] == "skroutz"){
3890
+ if(isset($product_data['id'])){
3891
+ foreach($project_config['attributes'] as $ky => $vy){
3892
+ if(isset($vy['attribute'])){
3893
+ if($vy['attribute'] == "size"){
3894
+ $size_found = "yes";
3895
+ $sz_attribute = $vy['mapfrom'];
3896
+ }
3897
+ if($vy['attribute'] == "color"){
3898
+ $color_found = "yes";
3899
+ $clr_attribute = $vy['mapfrom'];
3900
+ }
3901
+ }
3902
+ }
3903
+
3904
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3905
+ $sz_attr_value = get_post_meta( $product_data['id'], $sz_attribute, true );
3906
+ if(!empty($clr_attribute)){
3907
+ $clr_attr_value = get_post_meta( $product_data['id'], "attribute_".$clr_attribute, true );
3908
+ }
3909
+
3910
+ // HIER MOET EEN CHECK IN OP product_type
3911
+ if(isset($product_data['item_group_id']) AND ($product_data['product_type'] == "variable")){
3912
+ if($product_data['item_group_id'] > 0){
3913
+ $product_skroutz = wc_get_product($product_data['item_group_id']);
3914
+ $variations = $product_skroutz->get_available_variations();
3915
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
3916
+
3917
+ foreach($variations_id as $var_id){
3918
+ $clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
3919
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
3920
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
3921
+ if($clr_variation == $clr_attr_value){
3922
+ if($stock_variation == "outofstock"){
3923
+ // Remove this size as it is not on stock
3924
+ if(array_key_exists($sz_attribute, $product_data)){
3925
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
3926
+ $product_data[$sz_attribute] = str_replace(", , ",",",$product_data[$sz_attribute]);
3927
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], " ");
3928
+ $product_data[$sz_attribute] = trim($product_data[$sz_attribute], ",");
3929
+ }
3930
+ }
3931
+ }
3932
+ }
3933
+ } else {
3934
+ // This is a parent variable product
3935
+ $product_skroutz = wc_get_product($product_data['id']);
3936
+ $variations = $product_skroutz->get_available_variations();
3937
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
3938
+
3939
+ foreach($variations_id as $var_id){
3940
+ //$clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
3941
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
3942
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
3943
+ if($stock_variation == "outofstock"){
3944
+ // Remove this size as it is not on stock
3945
+ if(array_key_exists($sz_attribute, $product_data)){
3946
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
3947
+ $product_data[$sz_attribute] = str_replace(", , ",",",$product_data[$sz_attribute]);
3948
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], " ");
3949
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], ",");
3950
+ }
3951
+ }
3952
+ }
3953
+ }
3954
+ }
3955
+ }
3956
+ }
3957
+
3958
  /**
3959
  * When product has passed the filter rules it can continue with the rest
3960
  */
3988
  }
3989
  } else {
3990
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
3991
+ 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")){
3992
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3993
  } else {
3994
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
4060
  }
4061
  } else {
4062
  if(strlen($product_data[$attr_value['mapfrom']])){
4063
+ 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")){
4064
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4065
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4066
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
4244
  $shipping_str .= ":WOOSEA_POSTAL_CODE##$v";
4245
  } elseif ($k == "price"){
4246
  $shipping_str .= ":WOOSEA_PRICE##$attr_value[prefix] $v $attr_value[suffix]";
4247
+ //$shipping_str .= ":WOOSEA_PRICE##$v";
4248
  } else {
4249
  // UNKNOWN, DO NOT ADD
4250
  }
4281
  }
4282
  } else {
4283
  if(strlen($product_data[$attr_value['mapfrom']])){
4284
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
4285
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4286
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4287
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
4551
  }
4552
  // New policy of Google, only when the value is yes add it to the feed
4553
  // 28 October 2019
4554
+ if(array_key_exists('calculated', $project_config['attributes'])){
4555
  $xml_product['g:identifier_exists'] = $identifier_exists;
4556
+ }
4557
  }
4558
  return $xml_product;
4559
  }
4811
  return $product_data;
4812
  }
4813
 
4814
+ /**
4815
+ * Execute project rules
4816
+ */
4817
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4818
  $aantal_prods = count($product_data);
4819
+ if($aantal_prods > 0){
4820
 
4821
+ foreach ($project_rules2 as $pr_key => $pr_array){
4822
 
4823
+ foreach ($product_data as $pd_key => $pd_value){
4824
 
4825
+ // Check is there is a rule on specific attributes
4826
+ if($pd_key == $pr_array['attribute']){
4827
+ // This is because for data manipulation the than attribute is empty
4828
+ if(!array_key_exists('than_attribute', $pr_array)){
4829
+ $pr_array['than_attribute'] = $pd_key;
4830
+ }
 
4831
 
4832
  // Check if a rule has been set for Google categories
4833
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4834
+
4835
+ $pr_array['than_attribute'] = "categories";
4836
  $category_id = explode("-", $pr_array['newvalue']);
4837
  $pr_array['newvalue'] = $category_id[0];
4838
+ $product_data['categories'] = $pr_array['newvalue'];
4839
+ }
4840
 
4841
+ // Make sure that rules on numerics are on true numerics
4842
+ if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4843
+ $pd_value = strtr($pd_value, ',', '.');
4844
+ }
4845
 
4846
 
4847
+ // Make sure the price or sale price is numeric
4848
+ if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4849
+ settype($pd_value, "double");
4850
+ }
4851
 
4852
+ if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4853
 
4854
+ // Rules for numeric values
4855
+ switch ($pr_array['condition']) {
4856
+ case($pr_array['condition'] = "contains"):
4857
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4858
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4859
+ }
4860
+ break;
4861
+ case($pr_array['condition'] = "containsnot"):
4862
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4863
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4864
+ }
4865
+ break;
4866
+ case($pr_array['condition'] = "="):
4867
+ if (($pd_value == $pr_array['criteria'])){
4868
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4869
+ }
4870
+ break;
4871
+ case($pr_array['condition'] = "!="):
4872
+ if (($pd_value != $pr_array['criteria'])){
4873
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4874
+ }
4875
+ break;
4876
+ case($pr_array['condition'] = ">"):
4877
+ if (($pd_value > $pr_array['criteria'])){
4878
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4879
+ }
4880
+ break;
4881
+ case($pr_array['condition'] = ">="):
4882
+ if (($pd_value >= $pr_array['criteria'])){
4883
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4884
+ }
4885
+ break;
4886
+ case($pr_array['condition'] = "<"):
4887
+ if (($pd_value < $pr_array['criteria'])){
4888
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4889
+ }
4890
+ break;
4891
+ case($pr_array['condition'] = "=<"):
4892
+ if (($pd_value <= $pr_array['criteria'])){
4893
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4894
+ }
4895
+ break;
4896
+ case($pr_array['condition'] = "empty"):
4897
+ if(empty($product_data[$pr_array['attribute']])){
4898
+ if ((strlen($pd_value) < 1)){
4899
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4900
+ } else {
4901
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4902
+ }
4903
+ }
4904
+ break;
4905
+ case($pr_array['condition'] = "multiply"):
4906
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4907
+ $convert_back = "false";
4908
+ $pos = strpos($pd_value, ',');
4909
+ if($pos !== false){
4910
+ $convert_back = "true";
4911
+ }
4912
+ $pd_value = strtr($pd_value, ',', '.');
4913
+ $newvalue = $pd_value*$pr_array['criteria'];
4914
+ $newvalue = round($newvalue, 2);
4915
+ if($convert_back == "true"){
4916
+ $newvalue = strtr($newvalue, '.',',');
4917
+ }
4918
+ $product_data[$pr_array['attribute']] = $newvalue;
4919
+ break;
4920
+ case($pr_array['condition'] = "divide"):
4921
+ $newvalue = ($pd_value / $pr_array['criteria']);
4922
+ $newvalue = round($newvalue, 2);
4923
+ $newvalue = strtr($newvalue, '.',',');
4924
+ $product_data[$pr_array['attribute']] = $newvalue;
4925
+ break;
4926
+ case($pr_array['condition'] = "plus"):
4927
+ $newvalue = ($pd_value + $pr_array['criteria']);
4928
+ $product_data[$pr_array['attribute']] = $newvalue;
4929
+ break;
4930
+ case($pr_array['condition'] = "minus"):
4931
+ $newvalue = ($pd_value - $pr_array['criteria']);
4932
+ $product_data[$pr_array['attribute']] = $newvalue;
4933
+ break;
4934
+ case($pr_array['condition'] = "findreplace"):
4935
+ if (strpos($pd_value, $pr_array['criteria']) !== false){
4936
  // Make sure that a new value has been set
4937
+ if(!empty($pr_array['newvalue'])){
4938
+ // Find and replace only work on same attribute field, otherwise create a contains rule
4939
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4940
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4941
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4942
  }
4943
+ }
4944
+ }
4945
+ break;
4946
+ default:
4947
+ break;
4948
+ }
4949
+ } elseif (is_array($pd_value)) {
4950
+
4951
+ // For now only shipping details are in an array
4952
+ foreach ($pd_value as $k => $v){
4953
+ if(is_array($v)){
4954
+ foreach ($v as $kk => $vv){
4955
+ // Only shipping detail rule can be on price for now
4956
+ if($kk == "price"){
4957
+ switch ($pr_array['condition']) {
4958
+ case($pr_array['condition'] = "contains"):
4959
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4960
+ $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4961
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4962
+ }
4963
+ break;
4964
+ case($pr_array['condition'] = "containsnot"):
4965
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4966
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4967
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4968
+ }
4969
+ break;
4970
+ case($pr_array['condition'] = "="):
4971
+ if (($vv == $pr_array['criteria'])){
4972
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4973
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4974
+ }
4975
+ break;
4976
+ case($pr_array['condition'] = "!="):
4977
+ if (($vv != $pr_array['criteria'])){
4978
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4979
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4980
+ }
4981
+ break;
4982
+ case($pr_array['condition'] = ">"):
4983
+ if (($vv > $pr_array['criteria'])){
4984
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4985
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4986
+ }
4987
+ break;
4988
+ case($pr_array['condition'] = ">="):
4989
+ if (($vv >= $pr_array['criteria'])){
4990
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4991
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4992
+ }
4993
+ break;
4994
+ case($pr_array['condition'] = "<"):
4995
+ if (($vv < $pr_array['criteria'])){
4996
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4997
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4998
+ }
4999
+ break;
5000
+ case($pr_array['condition'] = "=<"):
5001
+ if (($vv <= $pr_array['criteria'])){
5002
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5003
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5004
+ }
5005
+ break;
5006
+ case($pr_array['condition'] = "empty"):
5007
+ if ((strlen($vv) < 1)){
5008
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
5009
+ $product_data[$pr_array['than_attribute']] = $pd_value;
5010
+ }
5011
+ break;
5012
+ case($pr_array['condition'] = "multiply"):
5013
+ // Only shipping array
5014
+ if(is_array($pd_value)){
5015
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
5016
+ foreach ($pd_value as $ship_a_key => $shipping_arr){
5017
+ foreach($shipping_arr as $ship_key => $ship_value){
5018
+ if($ship_key == "price"){
5019
+ $ship_pieces = explode(" ", $ship_value);
5020
+ $pd_value = strtr($ship_pieces[1], ',', '.');
5021
+ $newvalue = $pd_value*$pr_array['criteria'];
5022
+ $newvalue = round($newvalue, 2);
5023
+ $newvalue = strtr($newvalue, '.',',');
5024
+ $newvalue = $ship_pieces[0]." ".$newvalue;
5025
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
5026
+ }
5027
+ }
5028
+ }
5029
+ }
5030
+ break;
5031
+ default:
5032
+ break;
5033
+ }
5034
+ }
5035
+ }
5036
+ } else {
5037
+ // Rules on product tags
5038
+ foreach ($pd_value as $k => $v){
5039
+
5040
+ // Rules for string values
5041
+ if (!array_key_exists('cs', $pr_array)){
5042
+ $v = strtolower($v);
5043
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5044
+ }
5045
+
5046
+ switch ($pr_array['condition']) {
5047
+ case($pr_array['condition'] = "contains"):
5048
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5049
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5050
+ }
5051
+ break;
5052
+ case($pr_array['condition'] = "containsnot"):
5053
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5054
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5055
+ }
5056
+ break;
5057
+ case($pr_array['condition'] = "="):
5058
+ if (($v == $pr_array['criteria'])){
5059
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5060
+ }
5061
+ break;
5062
+ case($pr_array['condition'] = "!="):
5063
+ if (($v != $pr_array['criteria'])){
5064
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5065
+ }
5066
+ break;
5067
+ case($pr_array['condition'] = ">"):
5068
+ if (($v > $pr_array['criteria'])){
5069
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5070
+ }
5071
+ break;
5072
+ case($pr_array['condition'] = ">="):
5073
+ if (($v >= $pr_array['criteria'])){
5074
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5075
+ }
5076
+ break;
5077
+ case($pr_array['condition'] = "<"):
5078
+ if (($v < $pr_array['criteria'])){
5079
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5080
+ }
5081
+ break;
5082
+ case($pr_array['condition'] = "=<"):
5083
+ if (($v <= $pr_array['criteria'])){
5084
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5085
+ }
5086
+ break;
5087
+ case($pr_array['condition'] = "empty"):
5088
+ if ((strlen($v) < 1)){
5089
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5090
+ }
5091
+ break;
5092
+ case($pr_array['condition'] = "multiply"):
5093
+ // Only shipping array
5094
+ if(is_array($v)){
5095
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
5096
+ foreach ($v as $ship_a_key => $shipping_arr){
5097
+ foreach($shipping_arr as $ship_key => $ship_value){
5098
+ if($ship_key == "price"){
5099
+ $ship_pieces = explode(" ", $ship_value);
5100
+ $pd_value = strtr($ship_pieces[1], ',', '.');
5101
+ $newvalue = $pd_value*$pr_array['criteria'];
5102
+ $newvalue = round($newvalue, 2);
5103
+ $newvalue = strtr($newvalue, '.',',');
5104
+ $newvalue = $ship_pieces[0]." ".$newvalue;
5105
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
5106
+ }
5107
+ }
5108
+ }
5109
+ }
5110
+ break;
5111
+ default:
5112
+ break;
5113
+ }
5114
+ }
5115
+ }
5116
+ }
5117
+ } else {
5118
  // Rules for string values
5119
  if (!array_key_exists('cs', $pr_array)){
5120
+ if($pr_array['attribute'] != "image"){
5121
+ $pd_value = strtolower($pd_value);
5122
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5123
+ }
5124
+ }
5125
 
5126
+ switch ($pr_array['condition']) {
5127
+ case($pr_array['condition'] = "contains"):
5128
  if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5129
+ // Specifically for shipping price rules
5130
+ if(!empty($product_data[$pr_array['than_attribute']])){
5131
+ if(is_array($product_data[$pr_array['than_attribute']])){
5132
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5133
+ for ($x = 0; $x <= $arr_size; $x++) {
5134
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5135
+ }
5136
+ } else {
5137
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5138
+ }
5139
+ } else {
5140
+ // This attribute value is empty for this product
5141
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5142
+ }
5143
+ }
5144
+ break;
5145
+ case($pr_array['condition'] = "containsnot"):
5146
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5147
+ // Specifically for shipping price rules
5148
+ if(is_array($product_data[$pr_array['than_attribute']])){
5149
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5150
+ for ($x = 0; $x <= $arr_size; $x++) {
5151
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5152
+ }
5153
+ } else {
5154
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5155
+ }
5156
+ }
5157
+ break;
5158
+ case($pr_array['condition'] = "="):
5159
+ if (($pr_array['criteria'] == "$pd_value")){
5160
+ // Specifically for shipping price rules
5161
+ if(is_array($product_data[$pr_array['than_attribute']])){
5162
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5163
+ for ($x = 0; $x <= $arr_size; $x++) {
5164
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5165
+ }
5166
+ } else {
5167
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5168
+ }
5169
+ }
5170
+ $ship = $product_data['shipping'];
5171
+ break;
5172
+ case($pr_array['condition'] = "!="):
5173
+ if (($pr_array['criteria'] != "$pd_value")){
5174
+ // Specifically for shipping price rules
5175
+ if(is_array($product_data[$pr_array['than_attribute']])){
5176
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5177
+ for ($x = 0; $x <= $arr_size; $x++) {
5178
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5179
+ }
5180
+ } else {
5181
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5182
+ }
5183
+ }
5184
+ break;
5185
+ case($pr_array['condition'] = ">"):
5186
+ // Use a lexical order on relational string operators
5187
+ if (($pd_value > $pr_array['criteria'])){
5188
+ // Specifically for shipping price rules
5189
+ if(is_array($product_data[$pr_array['than_attribute']])){
5190
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5191
+ for ($x = 0; $x <= $arr_size; $x++) {
5192
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5193
+ }
5194
+ } else {
5195
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5196
+ }
5197
+ }
5198
+ break;
5199
+ case($pr_array['condition'] = ">="):
5200
+ // Use a lexical order on relational string operators
5201
+ if (($pd_value >= $pr_array['criteria'])){
5202
+ // Specifically for shipping price rules
5203
+ if(is_array($product_data[$pr_array['than_attribute']])){
5204
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5205
+ for ($x = 0; $x <= $arr_size; $x++) {
5206
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5207
+ }
5208
+ } else {
5209
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5210
+ }
5211
+ }
5212
+ break;
5213
+ case($pr_array['condition'] = "<"):
5214
+ // Use a lexical order on relational string operators
5215
+ if (($pd_value < $pr_array['criteria'])){
5216
+ // Specifically for shipping price rules
5217
+ if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
5218
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5219
+ for ($x = 0; $x <= $arr_size; $x++) {
5220
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5221
+ }
5222
+ } else {
5223
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5224
+ }
5225
+ }
5226
+ break;
5227
+ case($pr_array['condition'] = "=<"):
5228
+ // Use a lexical order on relational string operators
5229
+ if (($pd_value <= $pr_array['criteria'])){
5230
+ // Specifically for shipping price rules
5231
+ if(is_array($product_data[$pr_array['than_attribute']])){
5232
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5233
+ for ($x = 0; $x <= $arr_size; $x++) {
5234
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5235
+ }
5236
+ } else {
5237
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5238
+ }
5239
+ }
5240
+ break;
5241
 
5242
+ case($pr_array['condition'] = "empty"):
5243
+ if(empty($product_data[$pr_array['attribute']])){
5244
+ if(empty($product_data[$pr_array['than_attribute']])){
5245
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5246
+ } else {
5247
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5248
+ }
5249
+ }
5250
+ break;
5251
+ case($pr_array['condition'] = "replace"):
5252
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
5253
+ break;
5254
  case($pr_array['condition'] = "findreplace"):
5255
  if (strpos($pd_value, $pr_array['criteria']) !== false){
5256
+ // Make sure that a new value has been set
5257
+ if(!empty($pr_array['newvalue'])){
5258
+ // Find and replace only work on same attribute field, otherwise create a contains rule
5259
  if($pr_array['attribute'] == $pr_array['than_attribute']){
5260
+ $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
5261
+ //$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
5262
+ $product_data[$pr_array['than_attribute']] = $newvalue;
5263
+ }
5264
+ }
5265
+ }
5266
  break;
5267
+ default:
5268
+ break;
5269
+ }
5270
+ }
5271
+ } else {
5272
+ // When a rule has been set on an attribute that is not in product_data
5273
+ // Add the newvalue to product_data
5274
+ if (!array_key_exists($pr_array['attribute'], $product_data)){
5275
  if(!empty($pr_array['newvalue'])){
5276
+ if ($pr_array['condition'] == "empty") {
5277
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5278
+ }
5279
  } else {
5280
+ if(!empty($pr_array['than_attribute'])){
5281
+ if(array_key_exists($pr_array['than_attribute'], $product_data)){
5282
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5283
+ }
5284
  }
5285
+ }
5286
+ }
5287
+ }
5288
+ }
5289
+ }
5290
+ }
5291
+ return $product_data;
5292
+ }
5293
 
5294
  /**
5295
  * Function to exclude products based on individual product exclusions
5312
  }
5313
  }
5314
 
5315
+
5316
+ /**
5317
+ * Execute project filters (include / exclude)
5318
+ */
5319
  private function woocommerce_sea_filters( $project_rules, $product_data ){
5320
+ $allowed = 1;
5321
 
5322
+ // Check if product was already excluded from the feed
5323
+ $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
5324
 
5325
+ if( $product_excluded == "Yes"){
5326
+ $allowed = 0;
5327
+ }
5328
 
5329
+ foreach ($project_rules as $pr_key => $pr_array){
5330
 
5331
+ if($pr_array['attribute'] == "categories"){
5332
+ $pr_array['attribute'] = "raw_categories";
5333
  }
5334
 
5335
+ if(!array_key_exists($pr_array['attribute'], $product_data)) {
5336
+ $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
5337
+ }
 
 
5338
 
5339
+ foreach ($product_data as $pd_key => $pd_value){
5340
+ // Check is there is a rule on specific attributes
5341
+ if(in_array($pd_key, $pr_array, TRUE)){
5342
+ if($pd_key == "price" || $pd_key == "regular_price"){
5343
+ //$pd_value = @number_format($pd_value,2);
5344
+ $pd_value = wc_format_decimal($pd_value);
5345
+ }
5346
 
5347
+ if (is_numeric($pd_value)){
5348
+ $old_value = $pd_value;
5349
+ if($pd_key == "price" || $pd_key == "regular_price"){
5350
+ $pd_value = @number_format($pd_value,2);
5351
+ }
5352
 
5353
+ // Rules for numeric values
5354
+ switch ($pr_array['condition']) {
5355
+ case($pr_array['condition'] = "contains"):
5356
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5357
+ $allowed = 0;
5358
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5359
+ $allowed = 0;
5360
+ }
5361
+ break;
5362
+ case($pr_array['condition'] = "containsnot"):
5363
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5364
+ $allowed = 0;
5365
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5366
+ $allowed = 0;
5367
+ }
5368
+ break;
 
 
 
 
 
 
 
 
 
 
 
5369
  case($pr_array['condition'] = "="):
5370
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5371
+ $allowed = 0;
5372
+ } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5373
+ $allowed = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5374
  }
5375
+ break;
5376
+ case($pr_array['condition'] = "!="):
5377
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5378
+ if($allowed <> 0){
5379
+ $allowed = 1;
5380
+ }
5381
+ } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5382
+ $allowed = 0;
5383
+ }
5384
+ break;
5385
+ case($pr_array['condition'] = ">"):
5386
+ if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5387
+ $allowed = 0;
5388
+ } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5389
+ $allowed = 0;
5390
+ }
5391
+ break;
5392
+ case($pr_array['condition'] = ">="):
5393
+ if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5394
+ $allowed = 0;
5395
+ } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5396
+ $allowed = 0;
5397
+ }
5398
+ break;
5399
+ case($pr_array['condition'] = "<"):
5400
+ if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5401
+ $allowed = 0;
5402
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5403
+ $allowed = 0;
5404
+ }
5405
+ break;
5406
+ case($pr_array['condition'] = "=<"):
5407
+ if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5408
+ $allowed = 0;
5409
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5410
+ $allowed = 0;
5411
+ }
5412
+ break;
5413
+ case($pr_array['condition'] = "empty"):
5414
+ if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5415
+ $allowed = 0;
5416
+ } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5417
+ $allowed = 0;
5418
+ }
5419
+ break;
5420
+ default:
5421
+ break;
5422
+ }
5423
+ } elseif (is_array($pd_value)){
5424
+ // Tis can either be a shipping or product_tag array
5425
+ if($pr_array['attribute'] == "product_tag"){
5426
+ $in_tag_array = "not";
5427
+
5428
+ foreach($pd_value as $pt_key => $pt_value){
5429
+ // Rules for string values
5430
+ if (!array_key_exists('cs', $pr_array)){
5431
+ $pt_value = strtolower($pt_value);
5432
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5433
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5434
 
5435
+ if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5436
+ $in_tag_array = "yes";
5437
+ }
5438
+ }
5439
+
5440
+ if($in_tag_array == "yes"){
5441
+ //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5442
+ $v = $pr_array['criteria'];
5443
+ switch ($pr_array['condition']) {
5444
+ case($pr_array['condition'] = "contains"):
5445
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5446
+ if($pr_array['than'] == "include_only"){
5447
+ if($allowed <> 0){
5448
+ $allowed = 1;
5449
+ }
5450
+ } else {
5451
+ $allowed = 0;
5452
+ }
5453
+ } else {
5454
+ $allowed = 0;
5455
+ }
5456
+ break;
5457
+ case($pr_array['condition'] = "containsnot"):
5458
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5459
+ if($pr_array['than'] == "include_only"){
5460
+ if($allowed <> 0){
5461
+ $allowed = 1;
5462
+ }
5463
+ } else {
5464
+ $allowed = 0;
5465
+ }
5466
+ } else {
5467
+ $allowed = 0;
5468
+ }
5469
+ break;
5470
+ case($pr_array['condition'] = "="):
5471
+ if (($v == $pr_array['criteria'])){
5472
+ if($pr_array['than'] == "include_only"){
5473
+ if($allowed <> 0){
5474
+ $allowed = 1;
5475
+ }
5476
+ } else {
5477
+ $allowed = 0;
5478
+ }
5479
+ } else {
5480
+ $allowed = 0;
5481
+ }
5482
+ break;
5483
+ case($pr_array['condition'] = "!="):
5484
+ if (($v != $pr_array['criteria'])){
5485
+ if($pr_array['than'] == "include_only"){
5486
+ if($allowed <> 0){
5487
+ $allowed = 1;
5488
+ }
5489
+ } else {
5490
+ $allowed = 0;
5491
+ }
5492
+ }
5493
+ break;
5494
+ case($pr_array['condition'] = ">"):
5495
+ if (($v > $pr_array['criteria'])){
5496
+ if($pr_array['than'] == "include_only"){
5497
+ if($allowed <> 0){
5498
+ $allowed = 1;
5499
+ }
5500
+ } else {
5501
+ $allowed = 0;
5502
+ }
5503
+ }
5504
+ break;
5505
+ case($pr_array['condition'] = ">="):
5506
+ if (($v >= $pr_array['criteria'])){
5507
+ if($pr_array['than'] == "include_only"){
5508
+ if($allowed <> 0){
5509
+ $allowed = 1;
5510
+ }
5511
+ } else {
5512
+ $allowed = 0;
5513
+ }
5514
+ }
5515
+ break;
5516
+ case($pr_array['condition'] = "<"):
5517
+ if (($v < $pr_array['criteria'])){
5518
+ if($pr_array['than'] == "include_only"){
5519
+ if($allowed <> 0){
5520
+ $allowed = 1;
5521
+ }
5522
+ } else {
5523
+ $allowed = 0;
5524
+ }
5525
+ }
5526
+ break;
5527
+ case($pr_array['condition'] = "=<"):
5528
+ if (($v <= $pr_array['criteria'])){
5529
+ if($pr_array['than'] == "include_only"){
5530
+ if($allowed <> 0){
5531
+ $allowed = 1;
5532
+ }
5533
+ } else {
5534
+ $allowed = 0;
5535
+ }
5536
+ }
5537
+ break;
5538
+ case($pr_array['condition'] = "empty"):
5539
+ if (strlen($v) < 1){
5540
+ if($pr_array['than'] == "include_only"){
5541
+ if($allowed <> 0){
5542
+ $allowed = 1;
5543
+ }
5544
+ } else {
5545
+ if(!empty($pt_value)){
5546
+ $allowed = 1;
5547
+ } else {
5548
+ $allowed = 0;
5549
+ }
5550
+ }
5551
+ }
5552
+ break;
5553
+ default:
5554
+ break;
5555
+ }
5556
+ } else {
5557
+ switch ($pr_array['condition']) {
5558
+ case($pr_array['condition'] = "contains"):
5559
+ if($pr_array['than'] == "include_only"){
5560
+ $allowed = 0;
5561
+ } else {
5562
+ if($allowed <> 0){
5563
+ $allowed = 1;
5564
+ }
5565
+ }
5566
+ break;
5567
+ case($pr_array['condition'] = "containsnot"):
5568
+ if($pr_array['than'] == "include_only"){
5569
+ if($allowed <> 0){
5570
+ $allowed = 1;
5571
+ }
5572
+ } else {
5573
+ $allowed = 0;
5574
+ }
5575
+ break;
5576
+ case($pr_array['condition'] = "="):
5577
+ if($pr_array['than'] == "include_only"){
5578
+ $allowed = 0;
5579
+ } else {
5580
+ if($allowed <> 0){
5581
+ $allowed = 1;
5582
+ }
5583
+ }
5584
+ break;
5585
+ case($pr_array['condition'] = "!="):
5586
+ if($pr_array['than'] == "include_only"){
5587
+ if($allowed <> 0){
5588
+ $allowed = 1;
5589
+ }
5590
+ } else {
5591
+ $allowed = 0;
5592
+ }
5593
+ break;
5594
+ case($pr_array['condition'] = ">"):
5595
+ if($pr_array['than'] == "include_only"){
5596
+ $allowed = 0;
5597
+ } else {
5598
+ $allowed = 0;
5599
+ }
5600
+ break;
5601
+ case($pr_array['condition'] = ">="):
5602
+ if($pr_array['than'] == "include_only"){
5603
+ $allowed = 0;
5604
+ } else {
5605
+ $allowed = 0;
5606
+ }
5607
+ break;
5608
+ case($pr_array['condition'] = "<"):
5609
+ if($pr_array['than'] == "include_only"){
5610
+ $allowed = 0;
5611
+ } else {
5612
+ $allowed = 0;
5613
+ }
5614
+ break;
5615
+ case($pr_array['condition'] = "=<"):
5616
+ if($pr_array['than'] == "include_only"){
5617
+ $allowed = 0;
5618
+ } else {
5619
+ $allowed = 0;
5620
+ }
5621
+ break;
5622
+ case($pr_array['condition'] = "empty"):
5623
+ if($pr_array['than'] == "include_only"){
5624
+ if($allowed <> 0){
5625
+ $allowed = 1;
5626
+ }
5627
+ } else {
5628
+ $allowed = 0;
5629
+ }
5630
+ break;
5631
+ default:
5632
+ break;
5633
+ }
5634
+ }
5635
+ } else {
5636
+ // For now only shipping details are in an array
5637
+ foreach ($pd_value as $k => $v){
5638
+ foreach ($v as $kk => $vv){
5639
+ // Only shipping detail rule can be on price for now
5640
+ if($kk == "price"){
5641
+ switch ($pr_array['condition']) {
5642
+ case($pr_array['condition'] = "contains"):
5643
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5644
+ $allowed = 0;
5645
+ }
5646
+ break;
5647
+ case($pr_array['condition'] = "containsnot"):
5648
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5649
+ $allowed = 0;
5650
+ }
5651
+ break;
5652
+ case($pr_array['condition'] = "="):
5653
+ if (($vv == $pr_array['criteria'])){
5654
+ $allowed = 0;
5655
+ }
5656
+ break;
5657
+ case($pr_array['condition'] = "!="):
5658
+ if (($vv != $pr_array['criteria'])){
5659
+ $allowed = 0;
5660
+ }
5661
+ break;
5662
+ case($pr_array['condition'] = ">"):
5663
+ if (($vv > $pr_array['criteria'])){
5664
+ $allowed = 0;
5665
+ }
5666
+ break;
5667
+ case($pr_array['condition'] = ">="):
5668
+ if (($vv >= $pr_array['criteria'])){
5669
+ $allowed = 0;
5670
+ }
5671
+ break;
5672
+ case($pr_array['condition'] = "<"):
5673
+ if (($vv < $pr_array['criteria'])){
5674
+ $allowed = 0;
5675
+ }
5676
+ break;
5677
+ case($pr_array['condition'] = "=<"):
5678
+ if (($vv <= $pr_array['criteria'])){
5679
+ $allowed = 0;
5680
+ }
5681
+ break;
5682
+ case($pr_array['condition'] = "empty"):
5683
+ if (strlen($vv) < 1){
5684
+ $allowed = 0;
5685
+ }
5686
+ break;
5687
+ default:
5688
+ break;
5689
+ }
5690
+ }
5691
+ }
5692
+ }
5693
+ }
5694
+ } else {
5695
+ // Filters for string values
5696
+ // If case-sensitve is off than lowercase both the criteria and attribute value
5697
+ if (array_key_exists('cs', $pr_array)){
5698
+ if ($pr_array['cs'] != "on"){
5699
+ $pd_value = strtolower($pd_value);
5700
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5701
+ }
5702
+ }
5703
+ $pos = strpos($pd_value, '&amp;');
5704
+ $pos_slash = strpos($pr_array['criteria'], '\\');
5705
+ if($pos !== false){
5706
+ $pd_value = str_replace("&amp;","&",$pd_value);
5707
+ }
5708
+ if($pos_slash !== false){
5709
+ $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5710
+ }
5711
+
5712
+ switch ($pr_array['condition']) {
5713
+ case($pr_array['condition'] = "contains"):
5714
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5715
+ $allowed = 0;
5716
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5717
+ $allowed = 0;
5718
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5719
+ if($allowed <> 0){
5720
+ $allowed = 1;
5721
+ }
5722
+ }
5723
+ break;
5724
+ case($pr_array['condition'] = "containsnot"):
5725
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5726
+ $allowed = 0;
5727
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5728
+ $allowed = 0;
5729
+ }
5730
+ break;
5731
  case($pr_array['condition'] = "="):
5732
+ //if(($pr_array['attribute'] == "raw_categories") AND ($pr_array['than'] == "include_only")){
5733
+ // $allowed = 1;
5734
+ // error_log("Ja hier 1");
5735
+ //} elseif (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
5736
+ if (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
5737
  $allowed = 0;
5738
  } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5739
  $found = strpos($pd_value,$pr_array['criteria']);
5740
+ if ($found !== false) {
5741
+ //for category mapping check if its an array
5742
+ if($pr_array['attribute'] == "raw_categories"){
5743
+ $raw_cats_arr = explode("||",$pd_value);
5744
+ if(is_array($raw_cats_arr)){
5745
+ if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5746
+ if($allowed <> 0){
5747
+ $allowed = 1;
5748
+ }
5749
+ } else {
5750
+ $allowed = 0;
5751
+ }
5752
+ }
5753
+ } else {
5754
+ if($allowed <> 0){
5755
+ $allowed = 1;
5756
+ }
5757
+ }
5758
+ } else {
5759
+ $allowed = 0;
5760
+ }
5761
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
 
 
 
 
 
 
 
 
 
 
 
5762
  if($allowed <> 0){
5763
+ $allowed = 1;
5764
+ }
5765
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5766
+ // $allowed = 0;
5767
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5768
+ $allowed = 1;
5769
+ } else {
5770
+ // $allowed = 1; // Change made on February 24th 2021
5771
+ }
5772
+ break;
5773
+ case($pr_array['condition'] = "!="):
5774
+ if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5775
+ if($allowed <> 0){
5776
+ $allowed = 1;
5777
+ }
5778
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5779
+ $allowed = 0;
5780
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5781
+ $allowed = 0;
5782
+ }
5783
+ break;
5784
+ case($pr_array['condition'] = ">"):
5785
+ // Use a lexical order on relational string operators
5786
+ if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5787
+ $allowed = 0;
5788
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5789
+ $allowed = 0;
5790
+ }
5791
+ break;
5792
+ case($pr_array['condition'] = ">="):
5793
+ // Use a lexical order on relational string operators
5794
+ if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5795
+ $allowed = 0;
5796
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5797
+ $allowed = 0;
5798
+ }
5799
+ break;
5800
+ case($pr_array['condition'] = "<"):
5801
+ // Use a lexical order on relational string operators
5802
+ if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5803
+ $allowed = 0;
5804
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5805
+ $allowed = 0;
5806
+ }
5807
+ break;
5808
+ case($pr_array['condition'] = "=<"):
5809
+ // Use a lexical order on relational string operators
5810
+ if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5811
+ $allowed = 0;
5812
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5813
+ $allowed = 0;
5814
+ }
5815
+ break;
5816
+ case($pr_array['condition'] = "empty"):
5817
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5818
+ $allowed = 0;
5819
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5820
+ if($allowed <> 0){
5821
+ $allowed = 1;
5822
+ }
5823
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5824
+ $allowed = 0;
5825
+ }
5826
+ break;
5827
+ default:
5828
+ break;
5829
+ }
5830
+ }
5831
+ }
5832
+ }
5833
+ }
5834
 
5835
+ if ($allowed < 1){
5836
+ $product_data = array();
5837
+ $product_data = null;
5838
+ } else {
5839
+ return $product_data;
5840
+ }
5841
+ }
5842
  }
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
@@ -5695,8 +5695,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 +5710,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;
@@ -5741,7 +5742,6 @@ jQuery(document).ready(function($) {
5741
  }
5742
  } else {
5743
  var map_to_category = "";
5744
-
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
5695
  jQuery(".js-autosuggest").on('click',function(){
5696
  var className = $(this).attr("class").split(' ')[3];
5697
  var rowCount = className.split("_")[1]
5698
+
5699
+ //$('#the-basics-11603 .autocomplete_11603').typeahead({
5700
+ jQuery("." + className).typeahead({
5701
+ //jQuery(".autocomplete_" + rowCount ).typeahead({
5702
  input: '.js-autosuggest',
5703
  source: google_taxonomy,
5704
  hint: true,
5710
  });
5711
  jQuery( ".autocomplete_" + rowCount ).focus();
5712
 
 
5713
  jQuery(this).on('change', function(){ // on change of state
5714
 
5715
  var minimum = 1;
5742
  }
5743
  } else {
5744
  var map_to_category = "";
 
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
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',
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.3.5',
30
  jsonp: 'callback',
31
  dataType: 'jsonp',
32
  type: 'GET',
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;
@@ -256,6 +257,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 +297,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,13 +331,19 @@ 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>');
@@ -309,7 +356,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 +371,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){
@@ -381,13 +475,19 @@ jQuery(function($) {
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>');
@@ -400,7 +500,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();
@@ -414,7 +518,7 @@ jQuery(function($) {
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
@@ -456,7 +560,30 @@ jQuery(function($) {
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
 
1
  jQuery(function($) {
2
+
3
+ //jQuery(document).ready(function($) {
4
  var project_hash = null;
5
  var project_status = null;
6
  var get_value = null;
257
  }
258
  })
259
 
260
+ // Check if user would like the plugin to remove the free shipping class
261
+ $('#remove_free_shipping').on('change', function(){ // on change of state
262
+ if(this.checked){
263
+
264
+ // Checkbox is on
265
+ jQuery.ajax({
266
+ method: "POST",
267
+ url: ajaxurl,
268
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "on" }
269
+ })
270
+ } else {
271
+ // Checkbox is off
272
+ jQuery.ajax({
273
+ method: "POST",
274
+ url: ajaxurl,
275
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "off" }
276
+ })
277
+ }
278
+ })
279
+
280
  // Check if user would like to enable debug logging
281
  $('#add_woosea_logging').on('change', function(){ // on change of state
282
  if(this.checked){
297
  }
298
  })
299
 
300
+ // Check if user would like to enable addition of CDATA
301
+ $('#add_woosea_cdata').on('change', function(){ // on change of state
302
+ if(this.checked){
303
+
304
+ // Checkbox is on
305
+ jQuery.ajax({
306
+ method: "POST",
307
+ url: ajaxurl,
308
+ data: { 'action': 'woosea_add_woosea_cdata', 'status': "on" }
309
+ })
310
+ } else {
311
+ // Checkbox is off
312
+ jQuery.ajax({
313
+ method: "POST",
314
+ url: ajaxurl,
315
+ data: { 'action': 'woosea_add_woosea_cdata', 'status': "off" }
316
+ })
317
+ }
318
+ })
319
+
320
  // Check if user would like to add a Facebook Pixel to their website
321
  $('#woosea_content_ids').on('change', function(){ // on change of state
322
  var content_ids = $('#woosea_content_ids').val();
331
 
332
  // Check if user would like to add a Facebook Pixel to their website
333
  $('#add_facebook_pixel').on('change', function(){ // on change of state
334
+ var nonce = $('#add_facebook_pixel').val();
335
+
336
  if(this.checked){
337
 
338
  // Checkbox is on
339
  jQuery.ajax({
340
  method: "POST",
341
  url: ajaxurl,
342
+ data: {
343
+ 'action': 'woosea_add_facebook_pixel_setting',
344
+ 'security': nonce,
345
+ 'status': "on"
346
+ }
347
  })
348
  .done(function( data ) {
349
  $('#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>');
356
  jQuery.ajax({
357
  method: "POST",
358
  url: ajaxurl,
359
+ data: {
360
+ 'action': 'woosea_add_facebook_pixel_setting',
361
+ 'security': nonce,
362
+ 'status': "off"
363
+ }
364
  })
365
  .done(function( data ) {
366
  $('#facebook_pixel_id').remove();
371
  }
372
  })
373
 
374
+ // Check if user would like to enable the Facebook Conversion API
375
+ $('#add_facebook_capi').on('change', function(){ // on change of state
376
+ var nonce = $('#add_facebook_capi').val();
377
+
378
+ if(this.checked){
379
+
380
+ // Checkbox is on
381
+ jQuery.ajax({
382
+ method: "POST",
383
+ url: ajaxurl,
384
+ data: {
385
+ 'action': 'woosea_add_facebook_capi_setting',
386
+ 'security': nonce,
387
+ 'status': "on"
388
+ }
389
+ })
390
+ .done(function( data ) {
391
+ $('#facebook_capi').after('<tr id="facebook_capi_token"><td colspan="2"><span>Insert your Facebook Conversion API token:</span><br/><br/><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>');
392
+ })
393
+ .fail(function( data ) {
394
+ console.log('Failed AJAX Call :( /// Return Data: ' + data);
395
+ });
396
+ } else {
397
+ // Checkbox is off
398
+ jQuery.ajax({
399
+ method: "POST",
400
+ url: ajaxurl,
401
+ data: {
402
+ 'action': 'woosea_add_facebook_capi_setting',
403
+ 'security': nonce,
404
+ 'status': "off"
405
+ }
406
+ })
407
+ .done(function( data ) {
408
+ $('#facebook_capi_token').remove();
409
+ })
410
+ .fail(function( data ) {
411
+ console.log('Failed AJAX Call :( /// Return Data: ' + data);
412
+ });
413
+ }
414
+ })
415
+
416
+
417
  // Check if user would like to change the batch size
418
  $('#add_batch').on('change', function(){ // on change of state
419
  if(this.checked){
475
 
476
  // Check if user would like to enable Dynamic Remarketing
477
  $('#add_remarketing').on('change', function(){ // on change of state
478
+ var nonce = $('#add_remarketing').val();
479
+
480
+ if(this.checked){
481
 
482
  // Checkbox is on
483
  jQuery.ajax({
484
  method: "POST",
485
  url: ajaxurl,
486
+ data: {
487
+ 'action': 'woosea_add_remarketing',
488
+ 'security': nonce,
489
+ 'status': "on"
490
+ }
491
  })
492
  .done(function( data ) {
493
  $('#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>');
500
  jQuery.ajax({
501
  method: "POST",
502
  url: ajaxurl,
503
+ data: {
504
+ 'action': 'woosea_add_remarketing',
505
+ 'security': nonce,
506
+ 'status': "off"
507
+ }
508
  })
509
  .done(function( data ) {
510
  $('#adwords_conversion_id').remove();
518
  // Save Google Dynamic Remarketing pixel ID
519
  jQuery("#save_conversion_id").on('click',function(){
520
  var adwords_conversion_id = $('#adwords_conv_id').val();
521
+ var re = /^[0-9,-]*$/;
522
 
523
  var woosea_valid_conversion_id=re.test(adwords_conversion_id);
524
  // Check for allowed characters
560
  url: ajaxurl,
561
  data: { 'action': 'woosea_save_facebook_pixel_id', 'facebook_pixel_id': facebook_pixel_id }
562
  })
563
+ }
564
+ })
565
+
566
+ // Save Facebook Conversion API token
567
+ jQuery("#save_facebook_capi_token").on('click',function(){
568
+ var facebook_capi_token = $('#fb_capi_token').val();
569
+ var re = /^[0-9A-Za-z]*$/;
570
+ var woosea_valid_facebook_capi_token=re.test(facebook_capi_token);
571
+
572
+ // Check for allowed characters
573
+ if (!woosea_valid_facebook_capi_token){
574
+ $('.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>");
575
+ // Disable submit button too
576
+ $('#save_facebook_capi_token').attr('disabled',true);
577
+ } else {
578
+ $('.woosea-notice-conversion').remove();
579
+ $('#save_facebook_capi_token').attr('disabled',false);
580
+
581
+ // Now we need to save the Facebook Conversion API Token
582
+ jQuery.ajax({
583
+ method: "POST",
584
+ url: ajaxurl,
585
+ data: { 'action': 'woosea_save_facebook_capi_token', 'facebook_capi_token': facebook_capi_token }
586
+ })
587
  }
588
  })
589
 
pages/admin/woosea-generate-feed-step-0.php CHANGED
@@ -395,7 +395,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 +410,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 +425,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
395
  </td>
396
  </tr>
397
  <tr id="product_variations">
398
+ <td><span><?php _e('Include product variations','woo-product-feed-pro' );?>:</span></td>
399
  <td>
400
  <label class="woo-product-feed-pro-switch">
401
  <?php
410
  </td>
411
  </tr>
412
  <tr id="default_variation">
413
+ <td><span><?php _e( 'And only include default product variation','woo-product-feed-pro' );?>:</span></td>
414
  <td>
415
  <label class="woo-product-feed-pro-switch">
416
  <?php
425
  </td>
426
  </tr>
427
  <tr id="lowest_price_variation">
428
+ <td><span><?php _e( 'And 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
pages/admin/woosea-generate-feed-step-1.php CHANGED
@@ -101,7 +101,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 +115,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
  }
@@ -227,7 +227,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>
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><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>";
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
  } 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><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>";
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
  }
227
 
228
  <table class="woo-product-feed-pro-table">
229
  <tr>
230
+ <td><strong><?php _e( 'We have got you covered!','woo-product-feed-pro' );?></strong></td>
231
  </tr>
232
  <tr>
233
  <td>
pages/admin/woosea-generate-feed-step-4.php CHANGED
@@ -77,7 +77,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>
@@ -155,7 +155,7 @@ if (array_key_exists('project_hash', $_GET)){
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>
@@ -314,7 +314,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
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>
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>
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
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,18 @@ 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>
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
 
150
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
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,24 @@ if(isset($_GET["tab"])) {
326
  </label>
327
  </td>
328
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
  <tr id="facebook_pixel">
331
  <td>
@@ -336,9 +390,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>
@@ -373,20 +427,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>
@@ -423,7 +505,7 @@ if(isset($_GET["tab"])) {
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 +522,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 +616,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
+ <tr>
366
+ <td>
367
+ <span><?php _e( 'Add CDATA to title, description and short description:', 'woo-product-feed-pro');?></span>
368
+ </td>
369
+ <td>
370
+ <label class="woo-product-feed-pro-switch">
371
+ <?php
372
+ $add_woosea_cdata = get_option ('add_woosea_cdata');
373
+ if($add_woosea_cdata == "yes"){
374
+ print "<input type=\"checkbox\" id=\"add_woosea_cdata\" name=\"add_woosea_cdata\" class=\"checkbox-field\" checked>";
375
+ } else {
376
+ print "<input type=\"checkbox\" id=\"add_woosea_cdata\" name=\"add_woosea_cdata\" class=\"checkbox-field\">";
377
+ }
378
+ ?>
379
+ <div class="woo-product-feed-pro-slider round"></div>
380
+ </label>
381
+ </td>
382
+ </tr>
383
 
384
  <tr id="facebook_pixel">
385
  <td>
390
  <?php
391
  $add_facebook_pixel = get_option ('add_facebook_pixel');
392
  if($add_facebook_pixel == "yes"){
393
+ print "<input type=\"checkbox\" id=\"add_facebook_pixel\" name=\"add_facebook_pixel\" class=\"checkbox-field\" value=\"$nonce\" checked>";
394
  } else {
395
+ print "<input type=\"checkbox\" id=\"add_facebook_pixel\" name=\"add_facebook_pixel\" class=\"checkbox-field\" value=\"$nonce\">";
396
  }
397
  ?>
398
  <div class="woo-product-feed-pro-slider round"></div>
427
  </select>
428
  </td>
429
  </tr>
430
+ <?php
431
+ if($elite_disable == "enabled"){
432
+ ?>
433
+ <tr class="<?php print"$elite_disable";?>" id="facebook_capi">
434
+ <td>
435
+ <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>
436
+ </td>
437
+ <td>
438
+ <label class="woo-product-feed-pro-switch">
439
+ <?php
440
+ $add_facebook_capi = get_option ('add_facebook_capi');
441
+ if($add_facebook_capi == "yes"){
442
+ print "<input type=\"checkbox\" id=\"add_facebook_capi\" name=\"add_facebook_capi\" class=\"checkbox-field\" value=\"$nonce\" checked>";
443
+ } else {
444
+ print "<input type=\"checkbox\" id=\"add_facebook_capi\" name=\"add_facebook_capi\" class=\"checkbox-field\" value=\"$nonce\">";
445
+ }
446
+ ?>
447
+ <div class="woo-product-feed-pro-slider round"></div>
448
+ </label>
449
+ </td>
450
+ </tr>
451
+ <?php
452
+ if($add_facebook_capi == "yes"){
453
+ $facebook_capi_token = get_option('woosea_facebook_capi_token');
454
+ print "<tr id=\"facebook_capi_token\"><td colspan=\"2\"><span>Insert your Facebook Conversion API token:</span><br/><br/><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>";
455
+ }
456
+ ?>
457
+ <?php
458
+ }
459
+ ?>
460
  <tr id="remarketing">
461
  <td>
462
  <span><?php _e( 'Add Google Dynamic Remarketing Pixel:', 'woo-product-feed-pro');?></span>
463
  </td>
464
  <td>
465
  <label class="woo-product-feed-pro-switch">
466
+ <?php
467
  $add_remarketing = get_option ('add_remarketing');
468
  if($add_remarketing == "yes"){
469
+ print "<input type=\"checkbox\" id=\"add_remarketing\" name=\"add_remarketing\" class=\"checkbox-field\" value=\"$nonce\" checked>";
470
  } else {
471
+ print "<input type=\"checkbox\" id=\"add_remarketing\" name=\"add_remarketing\" class=\"checkbox-field\" value=\"$nonce\">";
472
  }
473
  ?>
474
  <div class="woo-product-feed-pro-slider round"></div>
505
  if($add_batch == "yes"){
506
  $woosea_batch_size = get_option('woosea_batch_size');
507
 
508
+ 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=\"button\" id=\"save_batch_size\" value=\"Save\"></td></tr>";
509
  }
510
  ?>
511
  </form>
522
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
523
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
524
  $test_file = $external_path . "/tesfile.txt";
525
+ $test_file_xml = $external_path . "xml/tesfile.txt";
526
+ $test_file_csv = $external_path . "csv/tesfile.txt";
527
+ $test_file_txt = $external_path . "txt/tesfile.txt";
528
+ $test_file_tsv = $external_path . "tsv/tesfile.txt";
529
+ $test_file_logs = $external_path . "logs/tesfile.txt";
530
 
531
  if (is_writable($external_path)) {
532
+ // Normal root category
533
+ $fp = @fopen($test_file, 'w');
534
+ @fwrite($fp, 'Cats chase mice');
535
+ @fclose($fp);
536
+ if(is_file($test_file)){
537
+ $directory_perm = "True";
538
+ }
539
+
540
+ // XML subcategory
541
+ $fp = @fopen($test_file_xml, 'w');
542
+ if(!is_bool($fp)){
543
+ @fwrite($fp, 'Cats chase mice');
544
+ @fclose($fp);
545
+ if(is_file($test_file_xml)){
546
+ $directory_perm_xml = "True";
547
+ } else {
548
+ $directory_perm_xml = "False";
549
+ }
550
+ } else {
551
+ $directory_perm_xml = "Unknown";
552
+ }
553
+
554
+ // CSV subcategory
555
+ $fp = @fopen($test_file_csv, 'w');
556
+ if(!is_bool($fp)){
557
+ @fwrite($fp, 'Cats chase mice');
558
+ @fclose($fp);
559
+ if(is_file($test_file_csv)){
560
+ $directory_perm_csv = "True";
561
+ } else {
562
+ $directory_perm_csv = "False";
563
+ }
564
+ } else {
565
+ $directory_perm_csv = "Unknown";
566
+ }
567
+
568
+ // TXT subcategory
569
+ $fp = @fopen($test_file_txt, 'w');
570
+ if(!is_bool($fp)){
571
+ @fwrite($fp, 'Cats chase mice');
572
+ @fclose($fp);
573
+ if(is_file($test_file_txt)){
574
+ $directory_perm_txt = "True";
575
+ } else {
576
+ $directory_perm_txt = "False";
577
+ }
578
+ } else {
579
+ $directory_perm_txt = "Unknown";
580
+ }
581
+ // TSV subcategory
582
+ $fp = @fopen($test_file_tsv, 'w');
583
+ if(!is_bool($fp)){
584
+ @fwrite($fp, 'Cats chase mice');
585
+ @fclose($fp);
586
+ if(is_file($test_file_tsv)){
587
+ $directory_perm_tsv = "True";
588
+ } else {
589
+ $directory_perm_tsv = "False";
590
+ }
591
+ } else {
592
+ $directory_perm_tsv = "Uknown";
593
+ }
594
+
595
+ // Logs subcategory
596
+ $fp = @fopen($test_file_logs, 'w');
597
+ if(!is_bool($fp)){
598
+ @fwrite($fp, 'Cats chase mice');
599
+ @fclose($fp);
600
+ if(is_file($test_file_logs)){
601
+ $directory_perm_logs = "True";
602
+ } else {
603
+ $directory_perm_logs = "False";
604
+ }
605
+ } else {
606
+ $directory_perm_logs = "Unknown";
607
+ }
608
  } else {
609
  $directory_perm = "False";
610
  }
616
  $cron_enabled = "True";
617
  }
618
 
619
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
620
+ $cron_enabled = "<strong>False</strong>";
621
+ }
622
+
623
  print "<table class=\"woo-product-feed-pro-table\">";
624
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
625
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
626
+ print "<tr><td>PHP-version</td><td>$php_validation ($versions[PHP])</td></tr>";
627
  print "<tr><td>Product feed directory writable</td><td>$directory_perm</td></tr>";
628
  print "<tr><td>Product feed XML directory writable</td><td>$directory_perm_xml</td></tr>";
629
  print "<tr><td>Product feed CSV directory writable</td><td>$directory_perm_csv</td></tr>";
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,19 @@ 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,8 +167,9 @@ 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>
@@ -175,6 +185,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
@@ -229,6 +240,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
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 +261,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 +334,313 @@ 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 +3307,314 @@ 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.7
8
+ Stable tag: 10.3.5
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
 
150
  Some of the above mentioned feature can only be used by users who upgraded to the Elite version of our plugin
151
 
152
  === Elite paid features ===
153
+ * WPML / WCML support
154
  * Aelia currency switcher support
155
  * Polylang support
156
  * Addition of the extra fields on your product edit pages
157
  * Data manipulation feature
158
  * WooCommerce structured data bug fix
 
159
 
160
  === Channels ===
161
  * Custom feeds
167
  * Google Local Products
168
  * Google Local Products Inventory
169
  * Google Shopping Actions
170
+ * Facebook Dynamic Ad's / remarketing
171
  * Bing Shopping
172
+ * Bing Shopping Promotions
173
  * Pinterest
174
  * <a href="https://businesshelp.snapchat.com/en-US/a/product-catalog-specs" target="_blank">Snapchat</a>
175
  * <a href="https://yandex.com/support/market-tech-requirements/index.html" target="_blank">Yandex</a>
185
  * <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
186
  * <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
187
  * <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
188
+ * <a href="https://www.boetiek.nl" target="_blank">Boetiek.nl</a>
189
  * Bol.com
190
  * Stylight
191
  * Incurvy
240
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
241
  * Hood.de
242
  * Ladenzeile.de
243
+ * <a href="https://connect.idealo.de/import/en/csv/#_attributes_documentation" target="_blank">Idealo.de</a>
244
  * Livingo.de
245
  * Medizinfuchs.de
246
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
261
  == Installation ==
262
 
263
  === From within Wordpress ===
264
+ 1. Visit Plugins > Add New;
265
+ 1. Search for Product Feed PRO for WooCommerce;
266
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
267
 
268
  === Manually ===
269
  1. Upload the woo-product-feed-pro folder to your /wp-content/plugins/ directory;
270
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
271
 
272
  == Frequently Asked Questions ==
273
 
334
 
335
  === Changelog ===
336
 
337
+ = 10.3.5 (2021-06-29) =
338
+ * 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.
339
+
340
+ = 10.3.4 (2021-06-28) =
341
+ * Added the quantity_to_sell_on_facebook field to the Facebook template
342
+
343
+ = 10.3.3 (2021-06-25) =
344
+ * Added a 'Link without parameters' attribute (which holds no attribute or UTM parameters in the URL)
345
+
346
+ = 10.3.2 (2021-06-18) =
347
+ * 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
348
+
349
+ = 10.3.1 (2021-06-16) =
350
+ * Removed Okazii.ro from the list of supported channels
351
+
352
+ = 10.3.0 (2021-06-16) =
353
+ * Cleaning-up some debug code for the Facebook CAPI implementation
354
+
355
+ = 10.2.9 (2021-06-15) =
356
+ * Added support for the Facebook Conversion API (CAPI) - still in beta!
357
+ * Stripped whitespaces from values in CSV feeds
358
+
359
+ = 10.2.8 (2021-06-14) =
360
+ * Checked for compatibility with WooCommerce 5.4
361
+
362
+ = 10.2.7 (2021-06-13) =
363
+ * Added Adwords grouping, Adwords labels and Adwords redirect fields to the Bing Shopping template
364
+
365
+ = 10.2.6 (2021-06-11) =
366
+ * Added an array check on custom attributes
367
+
368
+ = 10.2.5 (2021-06-09) =
369
+ * When discount plugins are being used prices will be rounded on 2 decimals
370
+
371
+ = 10.2.4 (2021-06-09) =
372
+ * Fixed a CDATA issue
373
+
374
+ = 10.2.3 (2021-06-08) =
375
+ * Added seller name to Google & Bing shopping templates
376
+
377
+ = 10.2.2 (2021-06-04) =
378
+ * Removed an useless nonce
379
+
380
+ = 10.2.1 (2021-06-04) =
381
+ * Added XSS vulnerability checks on both the Google Remarketing pixel and Facebook pixel feature.
382
+
383
+ = 10.2.0 (2021-06-02) =
384
+ * Removed a CSS z-index as it conflicted with Jetpack
385
+
386
+ = 10.1.9 (2021-06-01) =
387
+ * Fixed a PHP notice that showed when users created an empty rule
388
+
389
+ = 10.1.8 (2021-05-31) =
390
+ * When the identifier exists field mapping is removed from the field mapping also remove it from the feed
391
+ * Some minor textual changes in the feed configuration forms
392
+
393
+ = 10.1.7 (2021-05-27) =
394
+ * Fixed a bug: The Facebook pixel addToCart, initiateCheckout and Purchase event does not accept comma's in prices. Fixed.
395
+
396
+ = 10.1.6 (2021-05-27) =
397
+ * Fixed a bug: The Facebook pixel viewContent event does not accept comma's in prices. Fixed.
398
+
399
+ = 10.1.5 (2021-05-24) =
400
+ * Fixed a bug: exclude filters on regular prices did not work
401
+
402
+ = 10.1.4 (2021-05-24) =
403
+ * Adding CDATA feature so CDATA can be added to the title, description and short description fields
404
+
405
+ = 10.1.3 (2021-05-24) =
406
+ * Fixed an issue with taxes being added in the system sale prices
407
+
408
+ = 10.1.2 (2021-05-14) =
409
+ * Added the product type field mapping as default mapping for Google Shopping feeds
410
+
411
+ = 10.1.1 (2021-05-12) =
412
+ * Added support for Mix and Match minimum and maximum prices
413
+ * Removed the item_group_id for Mix and Match products
414
+
415
+ = 10.1.0 (2021-05-12) =
416
+ * Tested for compatibility with WooCommerce 5.3
417
+ * Changed UI when saving new plugin batch size so it shows the correct batch number immediatly
418
+
419
+ = 10.0.9 (2021-05-04) =
420
+ * Added extra fields for Google's local storefront shopping feeds
421
+
422
+ = 10.0.8 (2021-04-28) =
423
+ * Fixed an issue with the image field for custom feeds, it was added as image_link. This has been fixed now.
424
+
425
+ = 10.0.7 (2021-04-27) =
426
+ * Added support for ACF image fields (make sure to use image or bild in your field name)
427
+
428
+ = 10.0.6 (2021-04-27) =
429
+ * Added support for the WooCommerce Shipping & Tax plugin
430
+
431
+ = 10.0.5 (2021-04-21) =
432
+ * Added the "pickup today / merchant hosted local storefront" fields for Google Shopping
433
+
434
+ = 10.0.4 (2021-04-19) =
435
+ * Fixed an issue where shipping costs where missing from feeds
436
+ * Lowest shipping costs did not return the lowest price when prices where not numeric. This has been fixed now.
437
+
438
+ = 10.0.3 (2021-04-19) =
439
+ * When variations are out of stock we remove them from the parent product for Skroutz feeds
440
+
441
+ = 10.0.2 (2021-04-18) =
442
+ * Fixed a bug: rules that where set on attributes that were empty accidently added values to the product data. This has been fixed now.
443
+
444
+ = 10.0.1 (2021-04-16) =
445
+ * Fixed a bug: the multiple standard tax rates are now also taken into account for shipping costs
446
+
447
+ = 10.0.0 (2021-04-15) =
448
+ * 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.
449
+
450
+ = 9.9.9 (2021-04-12) =
451
+ * Added a "force clean-up" feature that in one go removes all feed configurations and scheduled jobs
452
+
453
+ = 9.9.8 (2021-04-12) =
454
+ * Added support for non numeric characters in the AW Dynamic tracking ID
455
+
456
+ = 9.9.7 (2021-04-11) =
457
+ * Fixed helptexts and notifications
458
+
459
+ = 9.9.6 (2021-04-08) =
460
+ * Added support for the Rankmath primary category
461
+
462
+ = 9.9.5 (2021-04-08) =
463
+ * Fixed an issue with the product_url field for Google review feeds. The & charcater was shown as AND. Issue fixed now.
464
+
465
+ = 9.9.4 (2021-03-30) =
466
+ * Added lowest shipping costs attribute
467
+
468
+ = 9.9.3 (2021-03-29) =
469
+ * Removed currency from shipping costs of Heureka feeds
470
+
471
+ = 9.9.2 (2021-03-27) =
472
+ * Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
473
+
474
+ = 9.9.1 (2021-03-25) =
475
+ * Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
476
+
477
+ = 9.9.0 (2021-03-24) =
478
+ * Added product type field mapping to the Facebook template
479
+ * Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
480
+
481
+ = 9.8.9 (2021-03-22) =
482
+ * Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
483
+
484
+ = 9.8.8 (2021-03-22) =
485
+ * Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
486
+
487
+ = 9.8.7 (2021-03-22) =
488
+ * Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
489
+
490
+ = 9.8.6 (2021-03-19) =
491
+ * Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
492
+
493
+ = 9.8.5 (2021-03-18) =
494
+ * Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
495
+
496
+ = 9.8.4 (2021-03-18) =
497
+ * Added the Idealo.de Germany template, including their Direktkauf fields
498
+
499
+ = 9.8.3 (2021-03-15) =
500
+ * Solved a rounding issue for sale prices including VAT
501
+
502
+ = 9.8.2 (2021-03-15) =
503
+ * 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
504
+
505
+ = 9.8.1 (2021-03-13) =
506
+ * The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
507
+
508
+ = 9.8.0 (2021-03-11) =
509
+ * Only reviews that are approved make it to the review feeds, disapproved reviews are removed
510
+
511
+ = 9.7.9 (2021-03-10) =
512
+ * Checked for compatibility with WordPress 5.7
513
+ * Checked for compatibility with WooCommerce 5.1
514
+
515
+ = 9.7.8 (2021-03-10) =
516
+ * Added a boolean check on the review feed creation
517
+
518
+ = 9.7.7 (2021-03-09) =
519
+ * Removed the woosea_add_cart.js from the source as it was an empty file
520
+
521
+ = 9.7.6 (2021-03-08) =
522
+ * Fixed an issue with the Facebook Purchase event that did not track the order value correct
523
+
524
+ = 9.7.5 (2021-03-07) =
525
+ * Another recode of the lowest price variation feature
526
+
527
+ = 9.7.4 (2021-03-05) =
528
+ * Added Bing Shopping Promotions template
529
+
530
+ = 9.7.3 (2021-03-04) =
531
+ * Added a new attribute "Stock Status WooCommerce"
532
+ * Fixed another quote issue with the Facebook pixel
533
+
534
+ = 9.7.2 (2021-03-03) =
535
+ * Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
536
+
537
+ = 9.7.1 (2021-03-03) =
538
+ * Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
539
+
540
+ = 9.7.0 (2021-03-03) =
541
+ * Fixed a bug where lowest priced variations where not making it to feeds
542
+
543
+ = 9.6.9 (2021-02-28) =
544
+ * Added product name parent hyphen attribute
545
+
546
+ = 9.6.8 (2021-02-25) =
547
+ * Added Google category taxonomy mapping for Snapchat feeds
548
+
549
+ = 9.6.7 (2021-02-25) =
550
+ * When suffixes and prefixes are used for the Heureka URL fields spaces are removed
551
+
552
+ = 9.6.6 (2021-02-24) =
553
+ * Added support for PHP 8.0
554
+
555
+ = 9.6.5 (2021-02-24) =
556
+ * Do not add Skroutz variable products to the feed when they do not have item_group_id's
557
+
558
+ = 9.6.4 (2021-02-24) =
559
+ * Fixed an issue with rules and filters
560
+ * When a rule was set on an image link, no longer lowercase the image link
561
+
562
+ = 9.6.3 (2021-02-23) =
563
+ * Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
564
+ * Reverted back some changes in filters and rules
565
+
566
+ = 9.6.2 (2021-02-22) =
567
+ * For Skroutz feed removing sizes from feeds when they are out-of-stock
568
+
569
+ = 9.6.1 (2021-02-19) =
570
+ * Added attribute that will allow you to uppercase every first character of a string in product names
571
+
572
+ = 9.6.0 (2021-02-19) =
573
+ * Changed g:itemid to g:id for the Google Local Product Feeds
574
+
575
+ = 9.5.9 (2021-02-19) =
576
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
577
+
578
+ = 9.5.8 (2021-02-18) =
579
+ * Added shipping class name attribute
580
+
581
+ = 9.5.7 (2021-02-17) =
582
+ * Dynamic attribute values are now also added to parent variable products for Skroutz feeds
583
+
584
+ = 9.5.6 (2021-02-17) =
585
+ * Changed attribute name primary category to Yoast primary category as it caused lots of confussion
586
+
587
+ = 9.5.5 (2021-02-11) =
588
+ * Fixed a PHP notice that showed when creating a new rule
589
+ * Tested for compatibility with WooCommerce 5.0
590
+
591
+ = 9.5.4 (2021-02-09) =
592
+ * When free shipping zones are removed do not remove the other shipping zones
593
+
594
+ = 9.5.3 (2021-02-08) =
595
+ * Added a feature to remove free shipping zones from Google and Facebook feeds
596
+
597
+ = 9.5.2 (2021-02-08) =
598
+ * Fixed a minor issue in exclude rules for WooCommerce category names
599
+
600
+ = 9.5.1 (2021-02-02) =
601
+ * Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
602
+
603
+ = 9.5.0 (2021-02-01) =
604
+ * Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
605
+
606
+ = 9.4.9 (2021-01-31) =
607
+ * Added a seperate sale price attribute for bundled products
608
+ * Reviews for parent variable products are removed, the reviews are attached to its variations
609
+
610
+ = 9.4.8 (2021-01-30) =
611
+ * Fixed an issue with the ecomm_prodid on the cart page
612
+
613
+ = 9.4.7 (2021-01-29) =
614
+ * Solved an issue that shipping costs to the first product in a custom feed where empty
615
+
616
+ = 9.4.6 (2021-01-28) =
617
+ * Added a new attribute: product description parent product
618
+
619
+ = 9.4.5 (2021-01-28) =
620
+ * Added a Google Shopping field to their template: g:ship_from_country
621
+ * Stripping & characters from review names as it breaks the review feeds
622
+
623
+ = 9.4.4 (2021-01-27) =
624
+ * 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.
625
+
626
+ = 9.4.3 (2021-01-27) =
627
+ * Fixed an issue with an undefined ecomm_price variable on product variable pages
628
+
629
+ = 9.4.2 (2021-01-26) =
630
+ * Added the Dutch Boetiek.nl template
631
+
632
+ = 9.4.1 (2021-01-19) =
633
+ * Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
634
+
635
+ = 9.4.0 (2021-01-14) =
636
+ * Added a WP-cron check and notifications
637
+
638
+ = 9.3.9 (2021-01-14) =
639
+ * Bestprice.gr apparel products are now grouped by color
640
+
641
+ = 9.3.8 (2021-01-13) =
642
+ * Tested for compatibility with WooCommerce 4.9
643
+
644
  = 9.3.7 (2021-01-12) =
645
  * Added the Bestprice.gr template
646
 
3307
 
3308
  == Upgrade Notice ==
3309
 
3310
+ = 10.3.5 =
3311
+ 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.
3312
+
3313
+ = 10.3.4 =
3314
+ Added the quantity_to_sell_on_facebook field to the Facebook template
3315
+
3316
+ = 10.3.3 =
3317
+ Added a 'Link without parameters' attribute (which holds no attribute or UTM parameters in the URL)
3318
+
3319
+ = 10.3.2 =
3320
+ Added some product data attributes to the Google Shopping template: capacity, count, disclosure date, feature description, flavor, format, product line, product pag
3321
+ e url, release date, scent, size system, size type, suggested retail price, theme and video link
3322
+
3323
+ = 10.3.1 =
3324
+ Removed Okazii.ro from the list of supported channels
3325
+
3326
+ = 10.3.0 =
3327
+ Cleaning-up some debug code for the Facebook CAPI implementation
3328
+
3329
+ = 10.2.9 =
3330
+ Added support for the Facebook Conversion API (CAPI) - still in beta!
3331
+ Stripped whitespaces from values in CSV feeds
3332
+
3333
+ = 10.2.8 =
3334
+ Checked for compatibility with WooCommerce 5.4
3335
+
3336
+ = 10.2.7 =
3337
+ Added Adwords grouping, Adwords labels and Adwords redirect fields to the Bing Shopping template
3338
+
3339
+ = 10.2.6 =
3340
+ Added an array check on custom attributes
3341
+
3342
+ = 10.2.5 =
3343
+ When discount plugins are being used prices will be rounded on 2 decimals
3344
+
3345
+ = 10.2.4 =
3346
+ Fixed a CDATA issue
3347
+
3348
+ = 10.2.3 =
3349
+ Added seller name to Google & Bing shopping templates
3350
+
3351
+ = 10.2.2 =
3352
+ Removed an useless nonce
3353
+
3354
+ = 10.2.1 =
3355
+ Added XSS vulnerability checks on both the Google Remarketing pixel and Facebook pixel feature.
3356
+
3357
+ = 10.2.0 =
3358
+ Removed a CSS z-index as it conflicted with Jetpack
3359
+
3360
+ = 10.1.9 =
3361
+ Fixed a PHP notice that showed when users created an empty rule
3362
+
3363
+ = 10.1.8 =
3364
+ When the identifier exists field mapping is removed from the field mapping also remove it from the feed
3365
+ Some minor textual changes in the feed configuration forms
3366
+
3367
+ = 10.1.7 =
3368
+ Fixed a bug: The Facebook pixel addToCart, initiateCheckout and Purchase event does not accept comma's in prices. Fixed.
3369
+
3370
+ = 10.1.6 =
3371
+ Fixed a bug: The Facebook pixel viewContent event does not accept comma's in prices. Fixed.
3372
+
3373
+ = 10.1.5 =
3374
+ Fixed a bug: exclude filters on regular prices did not work
3375
+
3376
+ = 10.1.4 =
3377
+ Adding CDATA feature so CDATA can be added to the title, description and short description fields
3378
+
3379
+ = 10.1.3 =
3380
+ Fixed an issue with taxes being added in the system sale prices
3381
+
3382
+ = 10.1.2 =
3383
+ Added the product type field mapping as default mapping for Google Shopping feeds
3384
+
3385
+ = 10.1.1 =
3386
+ Added support for Mix and Match minimum and maximum prices
3387
+ Removed the item_group_id for Mix and Match products
3388
+
3389
+ = 10.1.0 =
3390
+ Tested for compatibility with WooCommerce 5.3
3391
+ Changed UI when saving new plugin batch size so it shows the correct batch number immediatly
3392
+
3393
+ = 10.0.9 =
3394
+ Added extra fields for Google's local storefront shopping feeds
3395
+
3396
+ = 10.0.8 =
3397
+ Fixed an issue with the image field for custom feeds, it was added as image_link. This has been fixed now.
3398
+
3399
+ = 10.0.7 =
3400
+ Added support for ACF image fields (make sure to use image or bild in your field name)
3401
+
3402
+ = 10.0.6 =
3403
+ Added support for the WooCommerce Shipping & Tax plugin
3404
+
3405
+ = 10.0.5 =
3406
+ Added the "pickup today / merchant hosted local storefront" fields for Google Shopping
3407
+
3408
+ = 10.0.4 =
3409
+ Fixed an issue where shipping costs where missing from feeds
3410
+ Lowest shipping costs did not return the lowest price when prices where not numeric. This has been fixed now.
3411
+
3412
+ = 10.0.3 =
3413
+ When variations are out of stock we remove them from the parent product for Skroutz feeds
3414
+
3415
+ = 10.0.2 =
3416
+ Fixed a bug: rules that where set on attributes that were empty accidently added values to the product data. This has been fixed now.
3417
+
3418
+ = 10.0.1 =
3419
+ Fixed a bug: the multiple standard tax rates are now also taken into account for shipping costs
3420
+
3421
+ = 10.0.0 =
3422
+ 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.
3423
+
3424
+ = 9.9.9 =
3425
+ Added a "force clean-up" feature that in one go removes all feed configurations and scheduled jobs
3426
+
3427
+ = 9.9.8 =
3428
+ Added support for non numeric characters in the AW Dynamic tracking ID
3429
+
3430
+ = 9.9.7 =
3431
+ Fixed helptexts and notifications
3432
+
3433
+ = 9.9.6 =
3434
+ Added support for the Rankmath primary category
3435
+
3436
+ = 9.9.5 =
3437
+ Fixed an issue with the product_url field for Google review feeds. The & charcater was shown as AND. Issue fixed now.
3438
+
3439
+ = 9.9.4 =
3440
+ Added lowest shipping costs attribute
3441
+
3442
+ = 9.9.3 =
3443
+ Removed currency from shipping costs of Heureka feeds
3444
+
3445
+ = 9.9.2 =
3446
+ Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
3447
+
3448
+ = 9.9.1 =
3449
+ Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
3450
+
3451
+ = 9.9.0 =
3452
+ Added product type field mapping to the Facebook template
3453
+ Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
3454
+
3455
+ = 9.8.9 =
3456
+ Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
3457
+
3458
+ = 9.8.8 =
3459
+ Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
3460
+
3461
+ = 9.8.7 =
3462
+ Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
3463
+
3464
+ = 9.8.6 =
3465
+ Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
3466
+
3467
+ = 9.8.5 =
3468
+ Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
3469
+
3470
+ = 9.8.4 =
3471
+ Added the Idealo.de Germany template, including their Direktkauf fields
3472
+
3473
+ = 9.8.3 =
3474
+ Solved a rounding issue for sale prices including VAT
3475
+
3476
+ = 9.8.2 =
3477
+ 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
3478
+
3479
+ = 9.8.1 =
3480
+ The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
3481
+
3482
+ = 9.8.0 =
3483
+ Only reviews that are approved make it to the review feeds, disapproved reviews are removed
3484
+
3485
+ = 9.7.9 =
3486
+ Checked for compatibility with WordPress 5.7
3487
+ Checked for compatibility with WooCommerce 5.1.0
3488
+
3489
+ = 9.7.8 =
3490
+ Added a boolean check on the review feed creation
3491
+
3492
+ = 9.7.7 =
3493
+ Removed the woosea_add_cart.js from the source as it was an empty file
3494
+
3495
+ = 9.7.6 =
3496
+ Fixed an issue with the Facebook Purchase event that did not track the order value correct
3497
+
3498
+ = 9.7.5 =
3499
+ Another recode of the lowest price variation feature
3500
+
3501
+ = 9.7.4 =
3502
+ Added Bing Shopping Promotions template
3503
+
3504
+ = 9.7.3 =
3505
+ Added a new attribute "Stock Status WooCommerce"
3506
+ Fixed another quote issue with the Facebook pixel
3507
+
3508
+ = 9.7.2 =
3509
+ Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
3510
+
3511
+ = 9.7.1 =
3512
+ Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
3513
+
3514
+ = 9.7.0 =
3515
+ Fixed a bug where lowest priced variations where not making it to feeds
3516
+
3517
+ = 9.6.9 =
3518
+ Added product name parent hyphen attribute
3519
+
3520
+ = 9.6.8 =
3521
+ Added Google category taxonomy mapping for Snapchat feeds
3522
+
3523
+ = 9.6.7 =
3524
+ When suffixes and prefixes are used for the Heureka URL fields spaces are removed
3525
+
3526
+ = 9.6.6 =
3527
+ Added support for PHP 8.0
3528
+
3529
+ = 9.6.5 =
3530
+ Do not add Skroutz variable products to the feed when they do not have item_group_id's
3531
+
3532
+ = 9.6.4 =
3533
+ Fixed an issue with rules and filters
3534
+ When a rule was set on an image link, no longer lowercase the image link
3535
+
3536
+ = 9.6.3 =
3537
+ Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
3538
+ Reverted back some changes in filters and rules
3539
+
3540
+ = 9.6.2 =
3541
+ For Skroutz feed removing sizes from feeds when they are out-of-stock
3542
+
3543
+ = 9.6.1 =
3544
+ Added attribute that will allow you to uppercase every first character of a string in product names
3545
+
3546
+ = 9.6.0 =
3547
+ Changed g:itemid to g:id for the Google Local Product Feeds
3548
+
3549
+ = 9.5.9 =
3550
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
3551
+
3552
+ = 9.5.8 =
3553
+ Added shipping class name attribute
3554
+
3555
+ = 9.5.7 =
3556
+ Dynamic attribute values are now also added to parent variable products for Skroutz feeds
3557
+
3558
+ = 9.5.6 =
3559
+ Changed attribute name primary category to Yoast primary category as it caused lots of confussion
3560
+
3561
+ = 9.5.5 =
3562
+ Fixed a PHP notice that showed when creating a new rule
3563
+ Tested for compatibility with WooCommerce 5.0
3564
+
3565
+ = 9.5.4 =
3566
+ When free shipping zones are removed do not remove the other shipping zones
3567
+
3568
+ = 9.5.3 =
3569
+ Added a feature to remove free shipping zones from Google and Facebook feeds
3570
+
3571
+ = 9.5.2 =
3572
+ Fixed a minor issue in exclude rules for WooCommerce category names
3573
+
3574
+ = 9.5.1 =
3575
+ Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
3576
+
3577
+ = 9.5.0 =
3578
+ Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
3579
+
3580
+ = 9.4.9 =
3581
+ Added a seperate sale price attribute for bundled products
3582
+ Reviews for parent variable products are removed, the reviews are attached to its variations
3583
+
3584
+ = 9.4.8 =
3585
+ Fixed an issue with the ecomm_prodid on the cart page
3586
+
3587
+ = 9.4.7 =
3588
+ Solved an issue that shipping costs to the first product in a custom feed where empty
3589
+
3590
+ = 9.4.6 =
3591
+ Added a new attribute: product description parent product
3592
+
3593
+ = 9.4.5 =
3594
+ Added a Google Shopping field to their template: g:ship_from_country
3595
+ Stripping & characters from review names as it breaks the review feeds
3596
+
3597
+ = 9.4.4 =
3598
+ 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.
3599
+
3600
+ = 9.4.3 =
3601
+ Fixed an issue with an undefined ecomm_price variable on product variable pages
3602
+
3603
+ = 9.4.2 =
3604
+ Added the Dutch Boetiek.nl template
3605
+
3606
+ = 9.4.1 =
3607
+ Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
3608
+
3609
+ = 9.4.0 =
3610
+ Added a WP-cron check and notifications
3611
+
3612
+ = 9.3.9 =
3613
+ Bestprice.gr apparel products are now grouped by color
3614
+
3615
+ = 9.3.8 =
3616
+ Tested for compatibility with WooCommerce 4.9
3617
+
3618
  = 9.3.7 =
3619
  Added the Bestprice.gr template
3620
 
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,7 +101,8 @@ 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' );
@@ -115,7 +116,7 @@ function woosea_scripts($hook) {
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 +124,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,13 +139,27 @@ 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
  */
@@ -279,7 +294,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 +317,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,7 +329,6 @@ function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxono
314
  return $chain;
315
  }
316
 
317
-
318
  /**
319
  * Add Facebook pixel
320
  */
@@ -324,17 +338,39 @@ function woosea_add_facebook_pixel( $product = null ){
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 +381,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
  }
@@ -384,7 +421,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 +462,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 +500,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 +510,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 +544,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 +553,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 +610,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 +646,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 +673,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 +683,42 @@ 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 +733,16 @@ 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();
@@ -622,7 +759,7 @@ function woosea_add_remarketing_tags( $product = null ){
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,7 +796,9 @@ 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 {
@@ -671,14 +810,18 @@ function woosea_add_remarketing_tags( $product = null ){
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 = {
@@ -698,14 +841,14 @@ function woosea_add_remarketing_tags( $product = null ){
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
  /* ]]> */
@@ -714,7 +857,7 @@ function woosea_add_remarketing_tags( $product = null ){
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 -->
@@ -804,6 +947,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
  */
@@ -928,11 +1072,19 @@ 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' );
@@ -951,10 +1103,21 @@ add_action( 'wp_ajax_woosea_save_batch_size', 'woosea_save_batch_size' );
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
  */
@@ -2285,6 +2448,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 +2479,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 +2551,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 +2573,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' );
@@ -4618,13 +4844,16 @@ function woosea_blog_widgets() {
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'];
@@ -4633,6 +4862,8 @@ function woosea_my_rss_box() {
4633
  $my_feeds = array(
4634
  'https://www.adtribes.io/feed/'
4635
  );
 
 
4636
 
4637
  // Loop through Feeds
4638
  foreach ( $my_feeds as $feed) :
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
+ * Version: 10.3.5
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.7
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.4
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.3.5' );
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
+
106
  // JS files for ChartJS
107
  wp_register_script( 'woosea_chart-bundle-js', plugin_dir_url( __FILE__ ) . 'js/Chart.bundle.js', WOOCOMMERCESEA_PLUGIN_VERSION, true );
108
  wp_enqueue_script( 'woosea_chart-bundle-js' );
116
  wp_enqueue_script( 'typeahead-js' );
117
 
118
  // JS for adding input field validation
119
+ wp_register_script( 'woosea_validation-js', plugin_dir_url( __FILE__ ) . 'js/woosea_validation.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
120
  wp_enqueue_script( 'woosea_validation-js' );
121
 
122
  // JS for autocomplete
124
  wp_enqueue_script( 'woosea_autocomplete-js' );
125
 
126
  // JS for adding table rows to the rules page
127
+ wp_register_script( 'woosea_rules-js', plugin_dir_url( __FILE__ ) . 'js/woosea_rules.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
128
  wp_enqueue_script( 'woosea_rules-js' );
129
 
130
  // JS for adding table rows to the field mappings page
139
  wp_register_script( 'woosea_key-js', plugin_dir_url( __FILE__ ) . 'js/woosea_key.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
140
  wp_enqueue_script( 'woosea_key-js' );
141
 
142
+ // JS for managing addToCart event
143
+ // wp_register_script( 'woosea_addcart-js', plugin_dir_url( __FILE__ ) . 'js/woosea_add_cart.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
144
+ // wp_enqueue_script( 'woosea_addcart-js' );
145
  }
146
  // JS for manage projects page
147
+ wp_register_script( 'woosea_manage-js', plugin_dir_url( __FILE__ ) . 'js/woosea_manage.js?yo=12', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
148
  wp_enqueue_script( 'woosea_manage-js' );
149
  }
150
  add_action( 'admin_enqueue_scripts' , 'woosea_scripts' );
151
 
152
+ /**
153
+ * Enqueue front end scripts
154
+ */
155
+ function woosea_fe_scripts($hook) {
156
+ // JS for managing addToCart event
157
+ wp_enqueue_script( 'ajax-script', get_template_directory_uri() . 'js/my-ajax-script.js', array('jquery') );
158
+ wp_register_script( 'woosea_addcart-js', plugin_dir_url( __FILE__ ) . 'js/woosea_add_cart.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
159
+ wp_enqueue_script( 'woosea_addcart-js' );
160
+ }
161
+ //add_action('wp_enqueue_scripts', 'woosea_fe_scripts');
162
+
163
  /**
164
  * Get product variation ID based on dropdown selects product page
165
  */
294
  /**
295
  * Get category path for Facebook pixel
296
  */
297
+ function woosea_get_term_parents( $id, $taxonomy, $project_taxonomy, $link = false, $nicename = false, $visited = array() ) {
298
  // Only add Home to the beginning of the chain when we start buildin the chain
299
  if(empty($visited)){
300
  $chain = 'Home';
317
 
318
  if ($parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited, TRUE )){
319
  $visited[] = $parent->parent;
320
+ $chain .= woosea_get_term_parents( $parent->parent, $taxonomy, $separator, $link = false, $nicename, $visited );
321
  }
322
 
323
  if ($link){
329
  return $chain;
330
  }
331
 
 
332
  /**
333
  * Add Facebook pixel
334
  */
338
  }
339
  $fb_pagetype = WooSEA_Google_Remarketing::woosea_google_remarketing_pagetype();
340
  $add_facebook_pixel = get_option ('add_facebook_pixel');
341
+ $add_facebook_capi = get_option ('add_facebook_capi');
342
+ $viewContent = "";
343
  $currency = get_woocommerce_currency();
344
+
345
  if($add_facebook_pixel == "yes"){
346
  $facebook_pixel_id = get_option("woosea_facebook_pixel_id");
347
+ $facebook_capi_token = get_option("woosea_facebook_capi_token");
348
+
349
+ // Add vulnerability check
350
+ if(!is_numeric($facebook_pixel_id)){
351
+ unset($facebook_pixel_id);
352
+ }
353
 
354
  if($facebook_pixel_id > 0){
355
+ // Set Facebook conversion API data
356
+ define('FACEBOOK_APP_ACCESS_TOKEN', $facebook_capi_token);
357
+ define('FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID', $facebook_pixel_id);
358
+ $fb_capi_data["match_keys"] = array();
359
+ $fb_capi_data["event_time"] = time();
360
+ $fb_capi_data["event_id"] = time();
361
+ $fb_capi_data["user_data"]["client_ip_address"] = WC_Geolocation::get_ip_address();
362
+ $fb_capi_data["user_data"]["client_user_agent"] = $_SERVER['HTTP_USER_AGENT'];
363
+ $fb_capi_data["action_source"] = "website";
364
+ $fb_capi_data["event_source_url"] = home_url($_SERVER['REQUEST_URI']);
365
+
366
  if ($fb_pagetype == "product"){
367
  if ( '' !== $product->get_price()) {
368
 
369
  $fb_prodid = get_the_id();
370
  $product_name = $product->get_name();
371
+ $product_name = str_replace("\"","",$product_name);
372
+ $product_name = str_replace("'","",$product_name);
373
+
374
  $cats = "";
375
  $all_cats = get_the_terms( $fb_prodid, 'product_cat' );
376
  if(!empty($all_cats)){
381
  // strip last comma
382
  $cats = rtrim($cats, ",");
383
  $cats = str_replace("&amp;","&", $cats);
384
+ $cats = str_replace("\"","",$cats);
385
+ $cats = str_replace("'","",$cats);
386
 
387
  if(!empty($fb_prodid)){
 
388
  if(!$product) {
389
  return -1;
390
  }
421
  $fb_price = $fb_lowprice;
422
  }
423
  }
424
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
425
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
426
+
427
+ // Facebook CAPI data
428
+ $fb_capi_data["event_name"] = "ViewContent";
429
+ $fb_capi_data["custom_data"]["content_ids"] = $fb_prodid;
430
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
431
+ $fb_capi_data["custom_data"]["content_category"] = $cats;
432
+ $fb_capi_data["custom_data"]["currency"] = $currency;
433
+ $fb_capi_data["custom_data"]["value"] = $fb_price;
434
+ $fb_capi_data["custom_data"]["content_type"] = "product";
435
  } else {
436
  // This is a parent variable product
437
  // Since these are not allowed in the feed, at the variations product ID's
462
  $fb_highprice = wc_format_localized_price( $highest );
463
  $fb_price = $fb_lowprice;
464
  }
465
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
466
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product_group\", content_ids:[$content], value:\"$fb_price\", currency:\"$currency\"});";
467
+
468
+ // Facebook CAPI data
469
+ $fb_capi_data["event_name"] = "ViewContent";
470
+ $fb_capi_data["custom_data"]["content_ids"] = $fb_prodid;
471
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
472
+ $fb_capi_data["custom_data"]["content_category"] = $cats;
473
+ $fb_capi_data["custom_data"]["currency"] = $currency;
474
+ $fb_capi_data["custom_data"]["value"] = $fb_price;
475
+ $fb_capi_data["custom_data"]["content_type"] = "product_group";
476
  }
477
  } else {
478
  // This is a simple product page
479
+ $fb_price = wc_format_localized_price( $product->get_price() );
480
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
481
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
482
+
483
+ // Facebook CAPI data
484
+ $fb_capi_data["event_name"] = "ViewContent";
485
+ $fb_capi_data["custom_data"]["content_ids"] = $fb_prodid;
486
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
487
+ $fb_capi_data["custom_data"]["content_category"] = $cats;
488
+ $fb_capi_data["custom_data"]["currency"] = $currency;
489
+ $fb_capi_data["custom_data"]["value"] = $fb_price;
490
+ $fb_capi_data["custom_data"]["content_type"] = "product";
491
  }
492
  }
493
  }
500
  $order = wc_get_order( $order_id );
501
  $order_items = $order->get_items();
502
  $currency = get_woocommerce_currency();
 
503
  $contents = "";
504
+ $order_real = wc_format_localized_price($order->get_total());
505
 
506
  if ( !is_wp_error( $order_items )) {
507
  foreach( $order_items as $item_id => $order_item) {
510
  if($variation_id > 0){
511
  $prod_id = $variation_id;
512
  }
 
513
  $prod_quantity = $order_item->get_quantity();
 
 
 
 
 
514
  $contents .= "{'id': '$prod_id', 'quantity': $prod_quantity},";
515
  }
516
  }
517
  $contents = rtrim($contents, ",");
518
+ $order_real = floatval(str_replace(',', '.', str_replace(',', '.', $order_real)));
519
  $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$order_real', content_type:'product', contents:[$contents]});";
520
+
521
+ // Facebook CAPI data
522
+ $fb_capi_data["event_name"] = "Purchase";
523
+ $fb_capi_data["custom_data"]["content_ids"] = $prod_id;
524
+ $fb_capi_data["custom_data"]["currency"] = $currency;
525
+ $fb_capi_data["custom_data"]["value"] = $order_real;
526
+ $fb_capi_data["custom_data"]["content_type"] = "product";
527
  }
528
  } else {
529
  // This is on the cart page itself
530
  $currency = get_woocommerce_currency();
531
  $cart_items = WC()->cart->get_cart();
532
+ $cart_quantity = count($cart_items);
533
+
534
  $cart_real = 0;
535
  $contents = "";
536
 
537
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
538
+ $cart_total_amount = floatval(str_replace(',', '.', str_replace(',', '.', $cart_total_amount)));
539
+
540
  $checkoutpage = wc_get_checkout_url();
541
  $current_url = get_permalink(get_the_ID());
542
 
544
  if( !is_wp_error( $cart_items )) {
545
  foreach( $cart_items as $cart_id => $cart_item) {
546
  $prod_id = $cart_item['product_id'];
547
+ $product = $cart_item['data'];
548
+ $product_name = $product->get_name();
549
  if($cart_item['variation_id'] > 0){
550
  $prod_id = $cart_item['variation_id'];
551
  }
553
  //$contents .= "$prod_id,";
554
 
555
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
 
 
 
 
 
556
  }
557
  $contents = rtrim($contents, ",");
558
 
559
  // User is on the billing pages
560
  if($checkoutpage == $current_url){
561
+ $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
562
+
563
+ // Facebook CAPI data
564
+ $fb_capi_data["event_name"] = "InitiateCheckout";
565
+ $fb_capi_data["custom_data"]["content_ids"] = $contents;
566
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
567
+ $fb_capi_data["custom_data"]["currency"] = $currency;
568
+ $fb_capi_data["custom_data"]["value"] = $cart_total_amount;
569
+ $fb_capi_data["custom_data"]["content_type"] = "product";
570
  } else {
571
  // User is on the basket page
572
+ $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
573
+
574
+ // Facebook CAPI data
575
+ $fb_capi_data["event_name"] = "AddToCart";
576
+ $fb_capi_data["custom_data"]["content_ids"] = $contents;
577
+ $fb_capi_data["custom_data"]["content_name"] = $product_name;
578
+ $fb_capi_data["custom_data"]["currency"] = $currency;
579
+ $fb_capi_data["custom_data"]["value"] = $cart_total_amount;
580
+ $fb_capi_data["custom_data"]["content_type"] = "product";
581
  }
582
  }
583
  }
610
  }
611
  $fb_prodid = rtrim($fb_prodid, ",");
612
  $category_name = $term->name;
613
+ $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $project_taxonomy = false, $link = false, $nicename = false, $visited = array() );
614
+ $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:'$category_path', content_name:'$category_name', content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
615
+
616
+ // Facebook CAPI data
617
+ $fb_capi_data["event_name"] = "ViewCategory";
618
+ $fb_capi_data["custom_data"]["content_ids"] = $ids;
619
+ $fb_capi_data["custom_data"]["content_type"] = "product";
620
+
621
  } elseif ($fb_pagetype == "searchresults"){
622
  $term = get_queried_object();
623
  $search_string = sanitize_text_field($_GET['s']);
646
  }
647
  }
648
  $fb_prodid = rtrim($fb_prodid, ",");
649
+ $viewContent = "fbq(\"trackCustom\",\"Search\",{search_string:\"$search_string\", content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
650
+
651
+ // Facebook CAPI data
652
+ $fb_capi_data["event_name"] = "Search";
653
+ $fb_capi_data["custom_data"]["content_ids"] = $ids;
654
+ $fb_capi_data["custom_data"]["content_type"] = "product";
655
  } else {
656
  // This is another page than a product page
657
+ $fb_capi_data["event_name"] = "ViewContent";
658
  $viewContent = "";
659
  }
660
  ?>
673
  t.src=v;s=b.getElementsByTagName(e)[0];
674
  s.parentNode.insertBefore(t,s)}(window, document,'script',
675
  'https://connect.facebook.net/en_US/fbevents.js');
676
+
677
+ fbq("init", "<?php echo htmlentities($facebook_pixel_id, ENT_QUOTES, 'UTF-8');?>");
678
  fbq("track", "PageView");
679
  <?php
680
  if(strlen($viewContent) > 2){
683
  ?>
684
  </script>
685
  <noscript>
686
+ <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"/>
687
  </noscript>
688
  <!-- End Facebook Pixel Code -->
689
  <?php
690
+
691
+ // POST data to Facebook Conversion API
692
+ if(($add_facebook_capi == "yes") AND (!empty($facebook_capi_token))){
693
+ // Turn Data to JSON
694
+ $data_json = json_encode(array($fb_capi_data));
695
+
696
+ // Fill available fields
697
+ $fields = array();
698
+ $fields['access_token'] = FACEBOOK_APP_ACCESS_TOKEN;
699
+ $fields['upload_tag'] = $fb_capi_data["event_name"] . '-' . time(); // You should set a tag here (feel free to adjust)
700
+ $fields['data'] = $data_json;
701
+ $url = 'https://graph.facebook.com/v11.0/' . FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID . '/events';
702
+ $curl = curl_init($url);
703
+
704
+ curl_setopt_array($curl, array(
705
+ // Replace with your offline_event_set_id
706
+ CURLOPT_URL => 'https://graph.facebook.com/v11.0/' . FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID . '/events',
707
+ CURLOPT_RETURNTRANSFER => true,
708
+ CURLOPT_ENCODING => "",
709
+ CURLOPT_MAXREDIRS => 10,
710
+ CURLOPT_TIMEOUT => 30,
711
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
712
+ CURLOPT_CUSTOMREQUEST => "POST",
713
+ CURLOPT_POSTFIELDS => http_build_query($fields),
714
+ CURLOPT_HTTPHEADER => array(
715
+ "cache-control: no-cache",
716
+ //"content-type: multipart/form-data",
717
+ "Accept: application/json" ),
718
+ ));
719
+ $response = curl_exec($curl);
720
+ curl_close($curl);
721
+ }
722
  }
723
  }
724
  }
733
  }
734
  $ecomm_pagetype = WooSEA_Google_Remarketing::woosea_google_remarketing_pagetype();
735
  $add_remarketing = get_option ('add_remarketing');
736
+
737
  if($add_remarketing == "yes"){
738
  $adwords_conversion_id = get_option("woosea_adwords_conversion_id");
739
+ // Add vulnerability check, unset when no proper comversion ID was inserted
740
+ if(!is_numeric($adwords_conversion_id)){
741
+ unset($adwords_conversion_id);
742
+ }
743
 
744
  if($adwords_conversion_id > 0){
745
+
746
  if ($ecomm_pagetype == "product"){
747
  if ( '' !== $product->get_price()) {
748
  $ecomm_prodid = get_the_id();
759
  // In that case we need to put in the AggregateOffer structured data
760
  $variation_id = woosea_find_matching_product_variation( $product, $_GET );
761
  $nr_get = count($_GET);
762
+
763
  if($nr_get > 0){
764
  $variable_product = wc_get_product($variation_id);
765
 
796
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
797
  } else {
798
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
799
+ $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
800
+ $ecomm_price = $ecomm_lowprice;
801
+
802
  }
803
  }
804
  } else {
810
  var google_tag_params = {
811
  ecomm_prodid: <?php print "$ecomm_prodid";?>,
812
  ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
813
+ ecomm_totalvalue: <?php print "$ecomm_price";?>,
814
  };
815
  </script>
816
 
817
  <?php
818
  }
819
  } elseif ($ecomm_pagetype == "cart"){
820
+ // Get the first product from cart and use that product ID
821
+ foreach( WC()->cart->get_cart() as $cart_item ){
822
+ $ecomm_prodid = $cart_item['product_id'];
823
+ break;
824
+ }
825
  ?>
826
  <script type="text/javascript">
827
  var google_tag_params = {
841
  <?php
842
  }
843
  ?>
844
+ <!-- Google remarketing tag added by AdTribes.io -->
845
  <!--------------------------------------------------
846
  You need to make sure that the ecomm_prodid parameter, which we fill with your
847
  WooCommerce product Id matches the g:id field for your Google Merchant Center feed.
848
  --------------------------------------------------->
849
  <script type="text/javascript">
850
  /* <![CDATA[ */
851
+ var google_conversion_id = <?php echo htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>;
852
  var google_custom_params = window.google_tag_params;
853
  var google_remarketing_only = true;
854
  /* ]]> */
857
  </script>
858
  <noscript>
859
  <div style="display:inline;">
860
+ <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/<?php echo htmlentities($adwords_conversion_id, ENT_QUOTES, 'UTF-8');?>/?guid=ON&amp;script=0"/>
861
  </div>
862
  </noscript>
863
  <!-- End Google Remarketing Pixel Code -->
947
  }
948
  add_action('admin_notices', 'woosea_request_review');
949
 
950
+
951
  /**
952
  * Create a seperate MySql table for saving conversion information
953
  */
1072
  }
1073
  add_action( 'wp_ajax_woosea_categories_dropdown', 'woosea_categories_dropdown' );
1074
 
1075
+ /**
1076
+ * Sanitize XSS
1077
+ */
1078
+ function woosea_sanitize_xss($value) {
1079
+ return htmlspecialchars(strip_tags($value));
1080
+ }
1081
+
1082
  /**
1083
  * Save Google Dynamic Remarketing Conversion Tracking ID
1084
  */
1085
  function woosea_save_adwords_conversion_id() {
1086
  $adwords_conversion_id = sanitize_text_field($_POST['adwords_conversion_id']);
1087
+ $adwords_conversion_id = woosea_sanitize_xss($adwords_conversion_id);
1088
  update_option("woosea_adwords_conversion_id", $adwords_conversion_id);
1089
  }
1090
  add_action( 'wp_ajax_woosea_save_adwords_conversion_id', 'woosea_save_adwords_conversion_id' );
1103
  */
1104
  function woosea_save_facebook_pixel_id() {
1105
  $facebook_pixel_id = sanitize_text_field($_POST['facebook_pixel_id']);
1106
+ $facebook_pixel_id = woosea_sanitize_xss($facebook_pixel_id);
1107
  update_option("woosea_facebook_pixel_id", $facebook_pixel_id);
1108
  }
1109
  add_action( 'wp_ajax_woosea_save_facebook_pixel_id', 'woosea_save_facebook_pixel_id' );
1110
 
1111
+ /**
1112
+ * Save Facebook Conversion API Token
1113
+ */
1114
+ function woosea_save_facebook_capi_token() {
1115
+ $facebook_capi_token = sanitize_text_field($_POST['facebook_capi_token']);
1116
+ $facebook_capi_token = woosea_sanitize_xss($facebook_capi_token);
1117
+ update_option("woosea_facebook_capi_token", $facebook_capi_token);
1118
+ }
1119
+ add_action( 'wp_ajax_woosea_save_facebook_capi_token', 'woosea_save_facebook_capi_token' );
1120
+
1121
  /**
1122
  * Mass map categories to the correct Google Shopping category taxonomy
1123
  */
2448
  }
2449
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2450
 
2451
+ /**
2452
+ * This function enables the setting to remove
2453
+ * free shipping zones
2454
+ */
2455
+ function woosea_remove_free_shipping (){
2456
+ $status = sanitize_text_field($_POST['status']);
2457
+
2458
+ if ($status == "off"){
2459
+ update_option( 'remove_free_shipping', 'no', 'yes');
2460
+ } else {
2461
+ update_option( 'remove_free_shipping', 'yes', 'yes');
2462
+ }
2463
+ }
2464
+ add_action( 'wp_ajax_woosea_remove_free_shipping', 'woosea_remove_free_shipping' );
2465
+
2466
  /**
2467
  * This function enables the setting to use
2468
  * logging
2479
  add_action( 'wp_ajax_woosea_add_woosea_logging', 'woosea_add_woosea_logging' );
2480
 
2481
  /**
2482
+ * This function enables the setting to add CDATA to title and descriptions
 
2483
  */
2484
+ function woosea_add_woosea_cdata (){
2485
  $status = sanitize_text_field($_POST['status']);
2486
 
2487
  if ($status == "off"){
2488
+ update_option( 'add_woosea_cdata', 'no', 'yes');
2489
  } else {
2490
+ update_option( 'add_woosea_cdata', 'yes', 'yes');
2491
  }
2492
  }
2493
+ add_action( 'wp_ajax_woosea_add_woosea_cdata', 'woosea_add_woosea_cdata' );
2494
+
2495
+ /**
2496
+ * This function enables the setting to add
2497
+ * the Faceook pixel
2498
+ */
2499
+ function woosea_add_facebook_pixel_setting (){
2500
+ check_ajax_referer('woosea_ajax_nonce', 'security');
2501
+ $status = sanitize_text_field($_POST['status']);
2502
+
2503
+ // Only admin users are allowed to make changes that impact the front-end
2504
+ $user = wp_get_current_user();
2505
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2506
+ if ($status == "off"){
2507
+ update_option( 'add_facebook_pixel', 'no', 'yes');
2508
+ } else {
2509
+ update_option( 'add_facebook_pixel', 'yes', 'yes');
2510
+ }
2511
+ }
2512
+ }
2513
  add_action( 'wp_ajax_woosea_add_facebook_pixel_setting', 'woosea_add_facebook_pixel_setting' );
2514
 
2515
+ /**
2516
+ * This function enables the setting to enable
2517
+ * the Faceook Conversion API (CAPI)
2518
+ */
2519
+ function woosea_add_facebook_capi_setting (){
2520
+ check_ajax_referer('woosea_ajax_nonce', 'security');
2521
+ $status = sanitize_text_field($_POST['status']);
2522
+
2523
+ // Only admin users are allowed to make changes that impact the front-end
2524
+ $user = wp_get_current_user();
2525
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2526
+ if ($status == "off"){
2527
+ update_option( 'add_facebook_capi', 'no', 'yes');
2528
+ } else {
2529
+ update_option( 'add_facebook_capi', 'yes', 'yes');
2530
+ }
2531
+ }
2532
+ }
2533
+ add_action( 'wp_ajax_woosea_add_facebook_capi_setting', 'woosea_add_facebook_capi_setting' );
2534
+
2535
  /**
2536
  * This function saves the value that needs to be used in the Facebook pixel content_ids parameter
2537
  */
2551
  * Google's Dynamic Remarketing
2552
  */
2553
  function woosea_add_remarketing (){
2554
+ check_ajax_referer('woosea_ajax_nonce', 'security');
2555
+ $status = sanitize_text_field($_POST['status']);
2556
+
2557
+ // Only admin users are allowed to make changes that impact the front-end
2558
+ $user = wp_get_current_user();
2559
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2560
+ if ($status == "off"){
2561
+ update_option( 'add_remarketing', 'no', 'yes');
2562
+ } else {
2563
+ update_option( 'add_remarketing', 'yes', 'yes');
2564
+ }
2565
+ }
2566
  }
2567
  add_action( 'wp_ajax_woosea_add_remarketing', 'woosea_add_remarketing' );
2568
 
2573
  function woosea_add_batch (){
2574
  $status = sanitize_text_field($_POST['status']);
2575
 
2576
+ // Only admin users are allowed to make changes that impact the performance
2577
+ $user = wp_get_current_user();
2578
+ if ( in_array( 'administrator', (array) $user->roles ) ) {
2579
+ if ($status == "off"){
2580
+ update_option( 'add_batch', 'no', 'yes');
2581
+ } else {
2582
+ update_option( 'add_batch', 'yes', 'yes');
2583
+ }
2584
  }
2585
  }
2586
  add_action( 'wp_ajax_woosea_add_batch', 'woosea_add_batch' );
4844
 
4845
  add_meta_box('woosea_rss_dashboard_widget', __('Latest Product Feed Pro Tutorials', 'rc_mdm'), 'woosea_my_rss_box','dashboard','side','high');
4846
  }
4847
+ //add_action('wp_dashboard_setup', 'woosea_blog_widgets');
4848
 
4849
  /**
4850
  * Creates the RSS metabox
4851
  */
4852
+ function woosea_feed_interval( $seconds ) {
4853
+ return 172800; // Cache the feed for 2 days
4854
+ }
4855
+
4856
  function woosea_my_rss_box() {
 
4857
  // Get RSS Feed(s)
4858
  include_once(ABSPATH . WPINC . '/feed.php');
4859
  $domain = $_SERVER['HTTP_HOST'];
4862
  $my_feeds = array(
4863
  'https://www.adtribes.io/feed/'
4864
  );
4865
+
4866
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'woosea_feed_interval' );
4867
 
4868
  // Loop through Feeds
4869
  foreach ( $my_feeds as $feed) :